---
title: "Document parsing (PDF, images, OCR)"
method: POST
path: "/api/parse"
tags: ["Parse"]
---

# Document parsing (PDF, images, OCR)

`POST /api/parse`

Parse documents into structured markdown. Supports PDF, images, and scanned
documents. Fast mode is synchronous (~15 pages/sec), HiRes mode is asynchronous
with OCR (~16 pages/min).

## Request body

- ParseRequest
  - `url` string — Document URL
  - `base64` string — Base64-encoded file content
  - `filename` string — Filename hint (required with base64)
  - `mode` 'fast' | 'hires' | 'auto' — fast: ~15 pages/sec, synchronous. hires: ~16 pages/min, asynchronous with OCR. auto: server chooses.
  - `output` 'markdown' | 'json'
  - `wait` boolean — Wait for async result (block until complete)
  - `imageMode` 'embedded' | 's3' — How to handle images in output
  - `promptType` string — Custom prompt type for OCR
  - `callbackUrl` string, uri — URL for async completion callback
  - `includeDetection` boolean — Include detection data in response (bboxes, element types)

## Response `200`

Success (sync or async)

- ParseResponse
  - `success` boolean
  - `requestId` string — Unique request identifier
  - `mode` 'fast' | 'hires'
  - `async` boolean
  - `taskId` string — Task ID for async polling
  - `status` 'completed' | 'processing'
  - `document` object
    - `markdown` string
    - `text` string
    - `pageCount` integer
    - `metadata` object
      - `title` string
      - `author` string
      - `created_at` string
      - `file_type` string
    - `images` object[]
      - `page` integer
      - `url` string
      - `caption` string
    - `detections` object[] — Element detection data (when includeDetection=true)
      - `id` string
      - `type` string
      - `page` integer
      - `bbox` number[]
      - `content` string
    - `detectionSummary` object
      - `total_count` integer
      - `by_type` object
    - `bidirectionalIndexing` object
      - `detection_ids_count` integer
      - `ref_markers_count` integer
      - `enabled` boolean
    - `estimatedTime` integer — Estimated seconds for async processing
  - `usage` object
    - `inputPages` integer
    - `inputImages` integer
    - `outputChars` integer
    - `outputTokens` integer
  - `cost` object
    - `credits` number
    - `breakdown` object
      - `pages` number
      - `images` number
  - `endpoints` object — Polling endpoints (async mode only)
    - `status` string
    - `result` string
    - `stream` string
  - `processingTime` integer

## Other responses

- `400` — Invalid request parameters
- `401` — Missing or invalid authentication

---

[API](https://skmtc.dev/prismer-ai/apis/prismer-cloud-api.md) · [All operations](https://skmtc.dev/prismer-ai/apis/prismer-cloud-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/prismer-ai/prismer-cloud-api/revisions/7fef0836d17f/schema)
