Skip to main content
Endpoint
GET /ocr/v1/:id
import Casedev from 'casedev';

const client = new Casedev({ apiKey: 'sk_case_YOUR_API_KEY' });

const job = await client.ocr.v1.retrieve(jobId);

console.log(job.status);           // 'pending' | 'processing' | 'completed' | 'failed'
console.log(job.chunks_completed); // Progress
console.log(job.page_count);       // Total pages
Response (processing)
{
  "id": "1f4a195e-026b-41ff-b367-c61089f5f367",
  "status": "processing",
  "page_count": 245,
  "chunk_count": 50,
  "chunks_completed": 23,
  "chunks_processing": 15,
  "created_at": "2025-11-04T09:30:12Z"
}
Response (completed)
{
  "id": "1f4a195e-026b-41ff-b367-c61089f5f367",
  "status": "completed",
  "page_count": 245,
  "text": "Full extracted text from all 245 pages...",
  "confidence": 0.96,
  "processing_time_ms": 1091000,
  "links": {
    "text": "https://api.case.dev/ocr/v1/.../download/text",
    "json": "https://api.case.dev/ocr/v1/.../download/json",
    "pdf": "https://api.case.dev/ocr/v1/.../download/pdf"
  }
}

Status values

StatusMeaning
pendingQueued, not started
processingOCR in progress
completedDone, results ready
failedProcessing failed

Polling example

async function waitForOCR(jobId: string) {
  while (true) {
    const job = await client.ocr.v1.retrieve(jobId);

    if (job.status === 'completed') {
      return job;
    }
    if (job.status === 'failed') {
      throw new Error('OCR failed');
    }

    // Wait 5 seconds before checking again
    await new Promise(r => setTimeout(r, 5000));
  }
}

const result = await waitForOCR(jobId);
console.log(result.text);
Use webhooks for large documents. Set callback_url when submitting to avoid polling.