Infratex
InfratexAPI Referencev1
/ DOCUMENT AI, ONE PIPELINE

Parse, extract, index, and answer — from one API.

Infratex turns PDFs and images into clean Markdown, pulls structured fields with evidence, indexes clean context, and streams cited answers. Server-side keys, async resources, and typed SDKs for Python and Node.

Quickstart Jump to Parsing
Base URL
api.infratex.io
Auth
Bearer API key
SDKs
Python + Node
pipeline_runready
Parse01

PDF or images → Markdown + page metadata

Extract02

Structured fields with evidence

Index03

Vector or hybrid retrieval artifacts

Answer04

Stream cited, grounded responses

curl -X POST https://api.infratex.io/api/v1/documents \
  -H "Authorization: Bearer $INFRATEX_API_KEY" \
  -F "file=@report.pdf" \
  -F "method=standard"

Server-side keys

Direct API calls use infratex_sk_... bearer tokens. Keep them out of browser code.

Async resources

Uploads, indexes, and extraction runs return 202 and expose status endpoints for polling.

Explicit scope

Search and responses take one scope: document_ids, collection_id, or conversation_id.

Citations by default

Response streams start with source events before model text so UIs can render evidence first.

/ QUICKSTART

From upload to a cited answer in one file.

Work server-side. Parse a document, index it, then stream a grounded answer from that context. The SDK waits for async steps by default; pass wait=False to manage polling yourself.

01

Install

Add the SDK to your backend service, or start with curl while wiring env vars.

export INFRATEX_API_KEY=infratex_sk_...
02

Get an API key

Create a key in the dashboard. The full key is shown once — store it in server secrets.

http
Authorization: Bearer infratex_sk_your_key_here
# 1. Parse
curl -X POST https://api.infratex.io/api/v1/documents \
  -H "Authorization: Bearer $INFRATEX_API_KEY" \
  -F "file=@contract.pdf" -F "method=standard"

# 2. Index (after status is "parsed")
curl -X POST https://api.infratex.io/api/v1/documents/{id}/indexes \
  -H "Authorization: Bearer $INFRATEX_API_KEY" \
  -H "Content-Type: application/json" -d '{"method":"hybrid"}'

# 3. Stream a cited answer
curl -N -X POST https://api.infratex.io/api/v1/responses \
  -H "Authorization: Bearer $INFRATEX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message":"Summarize termination rights.","method":"hybrid","model":"fast","document_ids":["{id}"],"limit":5}'
/ SDKS

One resource model, Python or Node.

Python

ETL workers, extraction jobs, notebooks, and backend APIs. Sync client, waits by default.

pip install infratex

Node.js

Next.js route handlers, Express, queues, and streaming backends. Zero-dependency, native fetch.

npm install infratex

Both SDKs expose the same resources — documents, extractions, searches, responses, collections, conversations, account, billing — and the same wait-by-default contract. Python uses snake_case; Node uses camelCase.

from infratex import Infratex

client = Infratex(api_key="infratex_sk_...")

doc = client.documents.upload("board_pack.pdf", method="standard")
client.documents.wait_until_parsed(doc.id)

markdown = client.documents.markdown(doc.id)
print(markdown[:1000])
/ AUTHENTICATION

One header, tenant-scoped.

Every /api/v1/* route takes a server-side API key as a bearer token. Create keys in the dashboard — the full infratex_sk_... value is shown once. Keys are stored as SHA-256 hashes and never expire until revoked.

http
Authorization: Bearer infratex_sk_your_key_here
Do

Keep keys server-side. Rotate on exposure. Scope work per tenant with separate keys.

Don't

Ship keys in browser or mobile bundles. Public, dashboard-only routes (keys, templates, AST) return 403 to API keys.

/ PARSING

PDFs and images into clean Markdown.

Upload a PDF or an ordered image batch. Parsing is asynchronous — upload returns 202 with a pending document, then you poll status or let the SDK wait. The parse method you pick controls the engine, table fidelity, and cost.

MethodEngineTablesCredits / pageBest for
standardFast multimodalMarkdown pipe tables1crDefault. Fast, high-quality Markdown for most documents.
maxFast multimodalMarkdown tables3crAdds [visual-note] lines for charts, figures, and photos.
infratex-phiIn-house · self-deployableOTSL tables; charts tabulated3crDense tables, financial statements, faithfulness-first OCR.
standard-ultra-2High-fidelity visionRaw HTML tables (colspan/rowspan)3crComplex nested tables. API-only, advanced.
Choosing a method

Start with standard. Reach for max when figures and charts carry meaning, or infratex-phi for table-dense financial and legal documents. standard-ultra-2 is API-only for complex nested HTML tables.

POST/api/v1/documentsHTTP 202

Upload a PDF

Multipart file + method + optional collection_id. Returns a pending document.

POST/api/v1/documents/imagesHTTP 202

Upload page images

Repeated files — file order is page order. PNG, JPEG, WebP.

GET/api/v1/documents/{id}/markdown

Get Markdown

Returns extracted Markdown as text/markdown after parsing.

PATCH/api/v1/documents/{id}

Rename or move

Set filename, collection_id, or remove_collection.

Upload parameters — POST /api/v1/documents

ParameterTypeDefaultDescription
filerequiredfileSingle PDF, ≤ 50 MB. Must be a valid PDF.
methodstringstandardOne of standard, max, infratex-phi, standard-ultra-2.
collection_iduuidAssign to an owned collection on upload.

List parameters — GET /api/v1/documents

ParameterTypeDefaultDescription
statusenumFilter by pending, processing, parsed, indexed, error.
collection_iduuidFilter by collection.
limitint50Page size.
offsetint0Pagination offset.
curl -X POST https://api.infratex.io/api/v1/documents \
  -H "Authorization: Bearer $INFRATEX_API_KEY" \
  -F "file=@report.pdf" \
  -F "method=standard" \
  -F "collection_id=col_123"

# then, after status is "parsed":
curl https://api.infratex.io/api/v1/documents/{id}/markdown \
  -H "Authorization: Bearer $INFRATEX_API_KEY"
/ EXTRACTION

Structured fields, with evidence.

Pull typed fields out of a parsed document. Provide inline inline_fields, or reference a dashboard template_id — exactly one. Set include_evidence to get the source span behind every value.

Parse with the right method first

Extraction reads your document's parsed Markdown, so parse quality drives extraction quality. For dense tables parse with infratex-phi; for charts and figures use max. Large documents (Tier L) also require a ready vector or hybrid index before extracting.

Field types

TypeExtra keyShape
string{ "name": "counterparty", "type": "string", "description": "Legal name" }
number{ "name": "fee", "type": "number", "description": "Termination fee" }
integer{ "name": "term_months", "type": "integer", "description": "Term length" }
boolean{ "name": "auto_renews", "type": "boolean", "description": "Auto-renewal?" }
date{ "name": "effective_date", "type": "date", "description": "Effective date" }
enumenum_values{ "type": "enum", "enum_values": ["NY","DE","CA"], ... }
objectproperties{ "type": "object", "properties": [ ...fields ], ... }
arrayitems{ "type": "array", "items": { ...field }, ... }

Every field needs name (1–64, ^[a-zA-Z_][a-zA-Z0-9_]*$) and a description (required). Optional instructions and required refine behavior. Nest with object.properties and array.items; an array<object> field is what CSV/XLSX export reads. Max 50 fields per run.

POST/api/v1/documents/{id}/extractionsHTTP 202

Create a run

Inline fields or a template_id. Returns pending.

GET/api/v1/extractions/{run_id}

Poll or fetch

Add include_evidence=true for evidence payloads.

GET/api/v1/documents/{id}/extractions

List runs

Prior runs for a document. limit 1–100.

GET/api/v1/extractions/{run_id}/export

Export tabular

format=xlsx (default) or csv for array<object> fields.

Run parameters — POST /api/v1/documents/{id}/extractions

ParameterTypeDefaultDescription
inline_fieldsFieldDefinition[]Inline schema. Exactly one of this or template_id.
template_iduuidReference a dashboard-managed template.
inline_system_promptstringOptional guidance (≤ 8000). Only valid with inline_fields.
modelstringfastfast or pro for harder documents.
include_evidenceboolfalseReturn per-field source evidence.
curl -X POST https://api.infratex.io/api/v1/documents/{id}/extractions \
  -H "Authorization: Bearer $INFRATEX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "fast",
    "include_evidence": true,
    "inline_fields": [
      {"name": "counterparty", "type": "string", "description": "Legal name of the counterparty"},
      {"name": "effective_date", "type": "date", "description": "Contract effective date"}
    ]
  }'

# poll (add ?include_evidence=true for evidence)
curl "https://api.infratex.io/api/v1/extractions/{run_id}?include_evidence=true" \
  -H "Authorization: Bearer $INFRATEX_API_KEY"
/ INDEXING

Build retrieval before you search or answer.

Indexing turns parsed Markdown into retrieval artifacts. It's asynchronous — poll GET /api/v1/documents/{id}/indexes/{method} until status is indexed.

vector

Vector embeddings over chunks. Good default for natural-language questions. 20 credits / 1M tokens.

hybrid

Vector + keyword + document-structure (AST) retrieval. Recommended for contracts, filings, and tables. 100 credits / 1M tokens.

POST/api/v1/documents/{id}/indexesHTTP 202

Create index

Queues vector or hybrid indexing for a parsed document.

GET/api/v1/documents/{id}/indexes/{method}

Get index status

Poll until status is indexed before search or responses.

Parameters — POST /api/v1/documents/{id}/indexes

ParameterTypeDefaultDescription
methodstringvectorvector or hybrid.
Readiness invariant

Search and responses require a ready index for the selected method. If you request hybrid, the selected documents or collection must already have a hybrid index.

curl -X POST https://api.infratex.io/api/v1/documents/{id}/indexes \
  -H "Authorization: Bearer $INFRATEX_API_KEY" \
  -H "Content-Type: application/json" -d '{"method":"hybrid"}'
/ RESPONSES

Stream grounded, cited answers.

fast

Lower-latency model for product surfaces, summaries, and routine Q&A.

pro

Higher-capability model for complex synthesis, legal analysis, and cross-document questions.

POST/api/v1/responses

Create streaming response

Server-sent events: sources, thinking (when enabled), text deltas, then done.

Parameters — POST /api/v1/responses

ParameterTypeDefaultDescription
messagerequiredstring1–8000 characters.
methodstringvectorvector or hybrid.
modelstringfastfast or pro.
reasoningboolfalseWhen true, streams thinking events before text.
limitint5Source chunks. 1–20 (tighter than search's 50).
document_idsuuid[]Mutually exclusive with collection_id.
collection_iduuidMutually exclusive with document_ids.
conversation_iduuidContinue a thread. Omit scope selectors — scope comes from the conversation, else 400 conversation_scope_locked.

Stream events

sourcesRetrieved source chunks, streamed first so UIs can render evidence.
thinkingReasoning deltas — only when reasoning=true.
textAnswer text deltas.
doneStream complete.
errorAn error occurred mid-stream.
curl -N -X POST https://api.infratex.io/api/v1/responses \
  -H "Authorization: Bearer $INFRATEX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message":"What are the top risks?","method":"hybrid","model":"fast","collection_id":"col_123","limit":8,"reasoning":false}'
Multi-turn threads

Create a conversation to persist scope across turns, then pass only conversation_id to each response — the conversation supplies document_ids / collection_id.

/ COLLECTIONS & CONVERSATIONS

Group documents, persist threads.

Collections are a durable scope you can search and answer over together. Conversations persist a multi-turn thread with a fixed scope.

POST/api/v1/collections

Create collection

{ name } (1–255). Group documents for retrieval and responses.

PATCH/api/v1/documents/{id}

Move document

Set collection_id or remove_collection on a document.

POST/api/v1/conversations

Create conversation

{ title?, document_ids? | collection_id? } — scope is mutually exclusive.

GET/api/v1/conversations/{id}

Get conversation

Returns the thread and its messages.

json
{
  "message": "Compare warranty limits across the uploaded agreements.",
  "method": "hybrid",
  "model": "pro",
  "collection_id": "col_123",
  "limit": 10,
  "reasoning": true
}
/ MCP

Connect agent clients to the same pipeline.

The remote MCP server exposes the full pipeline — parsing, indexing, retrieval, and grounded answers — to any MCP client. Connect with a server-side API key (Claude Code, Claude Desktop, Cursor) or via OAuth (ChatGPT, Claude.ai web). Both resolve to the same tenant scope and billing as REST.

Endpoint
https://api.infratex.io/mcp/

Streamable HTTP. The trailing slash is required — the no-slash URL redirects and most clients will fail to connect.

API key

Claude Code, Claude Desktop, Cursor. Send Authorization: Bearer infratex_sk_... — no OAuth round-trip.

OAuth

ChatGPT and Claude.ai web. Paste the URL; the client self-registers, then you sign in and approve on the Infratex consent screen.

Claude Code
claude mcp add --transport http infratex https://api.infratex.io/mcp/ \
  --header "Authorization: Bearer infratex_sk_..."

# verify — status should be: ✔ Connected
claude mcp get infratex
Desktop / Cursor
{
  "mcpServers": {
    "infratex": {
      "type": "http",
      "url": "https://api.infratex.io/mcp/",
      "headers": {
        "Authorization": "Bearer infratex_sk_..."
      }
    }
  }
}
search_documents

Vector or hybrid retrieval across documents or collections.

answer_documents

Generate cited answers from indexed context.

create_document

Queue PDF parsing from a base64 payload.

create_document_images

Queue parsing for ordered image batches.

create_index

Queue vector or hybrid indexing.

get_document_markdown

Fetch extracted Markdown for a parsed document.

search

ChatGPT Deep Research: ranked results with id, title, text, url.

fetch

ChatGPT Deep Research: full document text for a result id.

/ REFERENCE

Errors, credits, and the endpoint map.

Error codes

StatusMeaning
400Bad request — e.g. conversation_scope_locked, invalid_pdf.
401Missing or invalid API key.
402Insufficient credits.
403Endpoint not available via API key (dashboard-only).
409Not ready — document_not_ready, index_required_for_tier_l, extraction_not_done.
413Payload too large — payload_too_large, context_too_large.
415Unsupported media type.
422Validation error — too_many_fields, markdown_unavailable.
429Rate limited.

Credits — 1 credit = $0.005

ParameterTypeDefaultDescription
parse.standardper page1 credit / page.
parse.max / infratex-phi / standard-ultra-2per page3 credits / page.
index.vectorper 1M tokens20 credits.
index.hybridper 1M tokens100 credits.
search.vectorper search2 credits.
search.hybridper search10 credits.
response.fastper 1M tokens1500 in / 9000 out.
response.proper 1M tokens5000 in / 30000 out.

Documents

POST /api/v1/documentsPOST /api/v1/documents/imagesGET /api/v1/documents/{id}PATCH /api/v1/documents/{id}GET /api/v1/documents/{id}/markdownDELETE /api/v1/documents/{id}

Retrieval

POST /api/v1/documents/{id}/indexesGET /api/v1/documents/{id}/indexesPOST /api/v1/searchesPOST /api/v1/responses

Extraction

POST /api/v1/documents/{id}/extractionsGET /api/v1/documents/{id}/extractionsGET /api/v1/extractions/{run_id}GET /api/v1/extractions/{run_id}/export

Account

GET /api/v1/accountGET /api/v1/account/settingsGET /api/v1/billingGET /api/v1/collectionsPOST /api/v1/collections
Two limits, two caps

searches.limit accepts 1–50; responses.limit accepts 1–20. Easy to conflate — the response context window is tighter on purpose.