v2.4 CURRENT PROTOCOLMultipart

Document Upload API

Every PDF Editor operation starts with an upload. The POST /pdf/documents endpoint takes the file as multipart/form-data, returns a document id (doc_...) right away and runs the processing in the background. If scanned pages are detected, OCR runs automatically.

1

Prepare an API Key

Create a key with the pdf:write scope under Settings → API Keys and put it in the INCAPON_API_KEY environment variable. Use inc_test_... keys for experiments; documents uploaded with test keys are deleted after 24 hours and no credits are charged.

2

Upload the File

The file field is required in the request body. The optional ocr_languages field sets the OCR languages, and the metadata field carries a free-form JSON object for matching against your own system.

3

Wait for Processing to Finish

A document moves through uploaded → processing → processed; on an error it becomes failed. Instead of polling, listen for the document.processed webhook event; its payload contains the page count, the pages OCR was applied to and the credits charged.

Upload Examples

import fs from 'node:fs';
import Incapon from '@incapon/node';

const incapon = new Incapon(process.env.INCAPON_API_KEY);

const doc = await incapon.pdf.documents.create({
  file: fs.createReadStream('./contract-scanned.pdf'),
  ocrLanguages: ['tur', 'eng'],
  metadata: { customer_id: 'C-1042' },
});

console.log(doc.id, doc.status); // doc_4b7e... processing

Limits

ParameterValueNote
max_file_size200 MBLarger files return 422
max_pages2,000 pagesPer document
mime_typesapplication/pdf, image/tiff, image/png, image/jpegMulti-page TIFF is supported
encryptedNot supportedPassword-protected PDFs return 422 document_encrypted
If credits run short

the upload is rejected with 402 and no document is created. Before long batch uploads, check your balance with GET /credits/balance or turn on auto top-up.

Next Steps & Guides

Was this guide helpful?

Your feedback helps us improve our documentation.