BuildPDF and documents

PDF and documents

⚠️
Preview — this feature is being built; the design below is the spec.

Send a PDF, Word file, spreadsheet or text file inside a message and ask the model about it. Syntic extracts the text, and on models that read images it also adds an image of each page, so tables, charts and scanned pages are understood too.

When to use it

  • Questions over contracts, reports, manuals and papers.
  • Pulling fields out of forms and statements (pair it with JSON output).
  • Summaries of long documents.
  • Answers that must quote their source (turn on citations).

For the same document across many requests, send it a single time through the Files API, then refer to it by id. Repeat calls then also benefit from prompt caching.

Endpoint and auth

POST https://app.syntic.ai/v1/chat/completions, Authorization: Bearer sk_live_.... On Messages use a document block.

Request fields

A file content part on a user message:

FieldTypeRequiredDetails
typestringYes"file"
file.file_idstringOne of these twoA file uploaded with purpose: "document".
file.file_datastringOne of these twoA data: URL, for example data:application/pdf;base64,.... Up to 10 MB.
file.filenamestringWith file_dataUsed to detect the type and shown to the model.
file.titlestringNoA friendly name the model uses when it refers to the document.
file.pagesstringNoA page range such as "1-12,40". Only these pages are read and billed.
file.modestringNoauto (default), text (text only) or pages (text plus page images).
file.citationsobjectNo{"enabled": true}. See Citations.

Supported types

TypeRead as
PDFText per page, plus page images when the model has vision and mode allows
DOCX, PPTXText with headings and tables kept
XLSX, CSVOne table per sheet, as text
TXT, MD, HTML, JSONText

Password-protected or corrupted files return an error before the model runs.

Response

A normal chat completion. usage.prompt_tokens_details adds document_tokens and document_pages so you can see what the document cost.

Cost

PartBilling
Extracted textInput tokens as usual (roughly 500 to 1,500 per dense page)
Page imagesInput tokens per page, using the high image formula on Vision

Use pages to read only the part you need, and mode: "text" for born-digital documents without charts.

Examples

curl https://app.syntic.ai/v1/chat/completions \
  -H "Authorization: Bearer $SYNTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Amara S1.2",
    "stream": false,
    "messages": [{
      "role": "user",
      "content": [
        { "type": "file", "file": { "file_id": "file_01JBW9", "title": "Shop lease 2024", "pages": "1-20" } },
        { "type": "text", "text": "What notice period applies if the tenant leaves early?" }
      ]
    }]
  }'

Errors

Unified envelope.

StatuscodeCause
400unsupported_file_typeNot one of the types above.
400file_encryptedPassword-protected file.
400file_unreadableCorrupt or empty file.
400invalid_page_rangepages is malformed or outside the document.
400too_many_pagesMore than 600 pages after pages is applied.
400context_window_exceededThe extracted document does not fit in the model’s context. Use pages.
404file_not_foundUnknown file_id, deleted, or from another organisation.
413payload_too_largefile_data over 10 MB; upload with the Files API instead.

Limits

LimitValue
Inline file_data10 MB
Uploaded file100 MB
Pages per request (all documents)600
Documents per request20

Build notes for the platform team

  • Reuse the extract-file pipeline; cache extraction by file hash so repeat requests skip it.
  • Page rendering at 150 dpi, long side capped at 1,568 px.
  • Extraction runs inside the org boundary; no extracted text is shared across orgs even for identical hashes.
Was this page helpful?