v2.4 CURRENT PROTOCOLJSON

Output Formats

You can download a processed document in one of three formats with GET /pdf/documents/{id}/export?format=.... All three are produced from the same internal representation: positioned text at page, block, line and word level. So you can process a document once and export it in as many formats as you like; export is free.

Formats

FormatContentsSuited to
jsonPage and block structure, coordinates of every word, OCR confidence scores, the redaction audit recordData extraction, search indexes, LLM pipelines
docxAn editable Word document with paragraphs, headings and tables preservedLegal and operations teams working on the text
pdfThe original page image + a searchable invisible text layer (PDF/A-2b)Archiving, sharing, official correspondence

If the document has been redacted, all three formats return the redacted version. After redaction, the pre-redaction version cannot be downloaded in any format.

JSON Structure

The JSON output carries the most information when you import into your own system. Coordinates are given from the top-left corner of the page, in points (pt).

{
  "document_id": "doc_4b7e",
  "page_count": 12,
  "redacted": true,
  "pages": [
    {
      "number": 1,
      "source": "ocr",
      "ocr_confidence": 0.97,
      "blocks": [
        {
          "type": "paragraph",
          "text": "The tenant resides at ██████████.",
          "bbox": [72.0, 140.5, 523.2, 168.0]
        }
      ]
    }
  ],
  "redactions": [{ "rule": "tckn", "count": 3 }]
}

The source field shows where a page's text came from: text_layer is the digital PDF's own text, and ocr is text extracted from a scanned page.

Exporting

import fs from 'node:fs/promises';

const docx = await incapon.pdf.documents.export('doc_4b7e', { format: 'docx' });
await fs.writeFile('contract-redacted.docx', docx);
If the document is not yet in the processed state, export returns 409 document_not_ready. Send the request after you receive the document.processed or document.redacted event.

Next Steps & Guides

Was this guide helpful?

Your feedback helps us improve our documentation.