Skip to main content
POST
/
api
/
v1
/
dev
/
tools
/
lens
/
ocr
Lens OCR
curl --request POST \
  --url https://api.autype.com/api/v1/dev/tools/lens/ocr \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "fileId": "550e8400-e29b-41d4-a716-446655440000",
  "pages": [
    "1",
    "3-5"
  ],
  "outputFormat": "md",
  "webhook": {
    "webhookUrl": "https://example.com/webhook",
    "webhookAuth": {
      "headerName": "X-API-Key",
      "headerValue": "my-secret-key",
      "basicAuthUsername": "user",
      "basicAuthPassword": "pass"
    }
  }
}
'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "action": "pdf.merge",
  "status": "PENDING",
  "inputFileIds": [
    "file-id-1",
    "file-id-2"
  ],
  "outputFileId": null,
  "error": null,
  "createdAt": "2023-11-07T05:31:56Z",
  "startedAt": {},
  "completedAt": {},
  "result": {},
  "metadata": {}
}

Authorizations

X-API-Key
string
header
required

API Key (starts with ak_...)

Body

application/json
fileId
string
required

File ID of the document to process (PDF, DOCX, ODT, or Markdown)

Example:

"550e8400-e29b-41d4-a716-446655440000"

pages
string[]

Page specifications (e.g. "1", "2-5", "3-"). If omitted, all pages are processed. Only applicable to PDF files with "md" output format.

Example:
["1", "3-5"]
outputFormat
enum<string>

Output format. "md" returns raw standard markdown (Mistral OCR). "mdd" returns Autype extended markdown with document settings and defaults. "json" returns full Autype document JSON with sections. Note: "mdd" and "json" formats are only supported for PDF files — DOCX, ODT, and Markdown files always return "md" regardless of this setting.

Available options:
md,
mdd,
json
Example:

"md"

webhook
object

Optional webhook configuration

Response

201 - application/json

Lens OCR job created

id
string
required

Job ID

Example:

"550e8400-e29b-41d4-a716-446655440000"

action
string
required

Action that was performed

Example:

"pdf.merge"

status
enum<string>
required

Current job status

Available options:
PENDING,
PROCESSING,
COMPLETED,
FAILED
Example:

"PENDING"

inputFileIds
string[]
required

Input file IDs

Example:
["file-id-1", "file-id-2"]
outputFileId
object
required

Output file ID (available when COMPLETED)

Example:

null

error
object
required

Error message (available when FAILED)

Example:

null

createdAt
string<date-time>
required

Job creation timestamp

startedAt
object
required

Job start timestamp

completedAt
object
required

Job completion timestamp

result
object

Structured job result data (e.g. OCR markdown/JSON, generated filename, PDF metadata, form fields). Available when the job produces a direct result instead of an output file.

metadata
object
deprecated

Deprecated — use result instead. Additional metadata, duplicated from result for backward compatibility.