Skip to content

Document and file tools

OmniDoc offers synchronous file tools and trackable asynchronous document operations. Call the capability endpoints first; do not hard-code supported formats or limits in the client.

GET /api/v1/document-operations/capabilities
GET /api/v1/artifacts/convert/capabilities

These return the operations currently open, their input formats, billing and technical limits. Capabilities listed under unavailable cannot be created.

POST /api/v1/document-operations
Idempotency-Key: unique-request-id
{
"document_id": "4q8mx2q9z1k7p6ra",
"kind": "visual_extract"
}

This endpoint requires an Idempotency-Key. kind currently includes:

  • extract: structured extraction, free.
  • pdf_to_html: PDF to online HTML, free.
  • visual_extract: visual structured extraction, charged per page (1 credit per page). Before it starts, the number of pages it may process is set from the balance (at most 20 pages); if the balance covers less than 1 page, it returns 402. When it finishes, the pages actually processed are charged, and the balance may become negative.

Query and cancel:

GET /api/v1/document-operations/{operation_id}
GET /api/v1/document-operations?limit=25
POST /api/v1/document-operations/{operation_id}/cancel

When it completes, the response’s output_document_id can go into the file library or another job, and credit_operation_id gives the settlement record.

POST /api/v1/file-tools/pdf/merge
POST /api/v1/file-tools/pdf/split
POST /api/v1/file-tools/pdf/compress

Merge example:

{"document_ids":["4q8mx2q9z1k7p6ra","b6t1n8c3v9m2x5ka"]}

Split example:

{"document_id":"4q8mx2q9z1k7p6ra","ranges":["1-3","5","8-10"]}
POST /api/v1/file-tools/image/convert
POST /api/v1/file-tools/image/compress
{
"document_id": "4q8mx2q9z1k7p6ra",
"target_format": "webp",
"quality": 85
}

The tools accept only documents the current account owns and whose type matches. Stream binary responses, and take the file name and type from the response headers.