GoodMem
ReferenceAPIREST APIGeneral

Run OCR on a document or image

Runs layout-aware OCR on the provided document bytes and returns per-page results. When a page range is provided, only the inclusive subset is processed. Requires OCR_DOCUMENT permission.

POST
/v1/ocr:document
x-api-key<token>

In: header

OCR request payload

contentstring | null

Base64-encoded document bytes

Default"JVBERi0xLjQKJcTl8uXr..."
format?OcrInputFormat | null

Input format hint (AUTO, PDF, TIFF, PNG, JPEG, BMP)

Default"PDF"
includeRawJson?boolean | null

Include raw OCR JSON payload in the response

Defaulttrue
includeMarkdown?boolean | null

Include markdown rendering in the response

Defaulttrue
startPage?integer | null

0-based inclusive start page

Default0
Formatint32
endPage?integer | null

0-based inclusive end page

Default4
Formatint32

Response Body

curl -X POST "http://localhost:8080/v1/ocr:document" \  -H "Content-Type: application/json" \  -d '{    "content": "JVBERi0xLjQKJcTl8uXr...",    "format": "PDF",    "includeRawJson": true,    "includeMarkdown": true,    "startPage": 0,    "endPage": 4  }'
{
  "detectedFormat": "PDF",
  "pageCount": 12,
  "pages": [
    {
      "pageIndex": 0,
      "page": {
        "rawJson": "[{\"text\":\"Example\"}]",
        "markdown": "# Heading",
        "timings": {
          "queueWaitMs": 15,
          "renderMs": 42,
          "ocrMs": 118,
          "totalMs": 175
        },
        "image": {
          "widthPx": 2150,
          "heightPx": 2575,
          "dpi": 200
        }
      },
      "status": {
        "code": 13,
        "message": "OCR request failed for page 3"
      }
    }
  ],
  "timings": {
    "wallTimeMs": 14324,
    "sumQueueWaitMs": 3959255,
    "sumRenderMs": 14005,
    "sumOcrMs": 50987,
    "sumPageTotalMs": 4024248
  }
}
Empty
Empty
Empty
Empty
Empty