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
| Format | Contents | Suited to |
|---|---|---|
| json | Page and block structure, coordinates of every word, OCR confidence scores, the redaction audit record | Data extraction, search indexes, LLM pipelines |
| docx | An editable Word document with paragraphs, headings and tables preserved | Legal and operations teams working on the text |
| The 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);data = client.pdf.documents.export("doc_4b7e", format="json")
print(data["page_count"], data["redactions"])curl -L "https://api.incapon.com/v2.4/pdf/documents/doc_4b7e/export?format=pdf" \ -H "Authorization: Bearer $INCAPON_API_KEY" \ -o contract-redacted.pdf
processed state, export returns 409 document_not_ready. Send the request after you receive the document.processed or document.redacted event.