Dynamiq
AI Gateway

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.

POST
/v1/ocr/parse

Authorization

personalAccessToken
AuthorizationBearer <token>

Personal Access Token of a Dynamiq user — the only credential accepted by the management API (api.*). Prefix dyn_pat_ (legacy uak_ tokens still authenticate). Send as Authorization: Bearer <token>.

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"
    }
  }
}