Skip to main content
Endpoint
GET /ocr/v1/:id/download/:type

Output formats

TypeDescription
textPlain text extraction
jsonStructured data with word coordinates and confidence
pdfSearchable PDF with invisible text layer

Download text

import Casedev from 'casedev';

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

const text = await client.ocr.v1.download(jobId, 'text');
console.log(text);

Download searchable PDF

The searchable PDF looks identical to the original but has an invisible text layer. Users can Ctrl+F to search.
const pdf = await client.ocr.v1.download(jobId, 'pdf');

// Save to file
fs.writeFileSync('searchable.pdf', Buffer.from(pdf));

Download structured JSON

JSON includes word-level bounding boxes, confidence scores, and table structures.
const data = await client.ocr.v1.download(jobId, 'json');

// Access word-level data
for (const page of data.pages) {
  for (const block of page.blocks) {
    console.log(block.text, block.confidence);
  }
}
JSON structure
{
  "pages": [
    {
      "page_number": 1,
      "width": 612,
      "height": 792,
      "blocks": [
        {
          "type": "text",
          "text": "DEPOSITION OF JOHN SMITH",
          "confidence": 0.98,
          "bbox": {"x": 72, "y": 72, "width": 468, "height": 24},
          "words": [
            {
              "text": "DEPOSITION",
              "confidence": 0.99,
              "bbox": {"x": 72, "y": 72, "width": 120, "height": 24}
            }
          ]
        }
      ]
    }
  ],
  "tables": [...],
  "metadata": {
    "page_count": 150,
    "engine": "doctr"
  }
}

Complete workflow

// 1. Submit document
const job = await client.ocr.v1.process({
  document_url: 'https://storage.example.com/deposition.pdf'
});

// 2. Wait for completion
let result = await client.ocr.v1.retrieve(job.id);
while (result.status !== 'completed') {
  await new Promise(r => setTimeout(r, 5000));
  result = await client.ocr.v1.retrieve(job.id);
}

// 3. Download results
const text = await client.ocr.v1.download(job.id, 'text');
const pdf = await client.ocr.v1.download(job.id, 'pdf');

// 4. Use with LLM
const analysis = await client.llm.v1.chat.createCompletion({
  model: 'anthropic/claude-sonnet-4.5',
  messages: [
    { role: 'system', content: 'Summarize this deposition.' },
    { role: 'user', content: text }
  ]
});