Parse a document with OCR
Extracts the text of a PDF or image as Markdown using an LLM-based OCR pipeline. The `options` form field is a JSON string selecting the LLM. With `"stream": true` the response is an SSE stream of extraction events instead of JSON.
Organization or project Access Key created in the Dynamiq console. Used for deployed-app (Runs API), AI Gateway, traces collector, and management API requests. Send as Authorization: Bearer <access-key>.
In: header
Request Body
multipart/form-data
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/v1/ocr/parse" \ -F file="string" \ -F options="string"{
"data": {
"text": "# Invoice 4812\n\n| Item | Amount |\n| --- | --- |\n| Pro plan (June) | $49.00 |\n| Pro plan (June) | $49.00 |"
}
}{
"error": {
"code": "bad_request",
"message": "Bad Request",
"details": {
"input": "cannot be blank"
}
}
}{
"error": {
"code": "unauthorized",
"message": "Unauthorized"
}
}{
"error": {
"code": "bad_request",
"message": "Failed to parse data",
"details": {
"error": "1 validation error for LLMRequest"
}
}
}Create a chat completion
OpenAI-compatible chat completions endpoint. The `model` is a Dynamiq router model slug; the gateway resolves it to the configured upstream provider and relays the request. Set `stream: true` to receive Server-Sent Events of `chat.completion.chunk` objects. Unknown request fields are passed through to the upstream provider.
Extract structured data from a document
Runs OCR on a PDF or image and then extracts structured data matching a JSON schema template. The `options` form field selects the OCR LLM, the structured-output LLM, and the extraction template. With `"stream": true` the response is an SSE stream instead of JSON.