GoodMemGoodMem
ReferenceAPIREST APIOCR

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

OCR request payload

contentstring | null

Base64-encoded document bytes

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

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

Example"PDF"
includeRawJson?boolean | null

Include raw OCR JSON payload in the response

Exampletrue
includeMarkdown?boolean | null

Include markdown rendering in the response

Exampletrue
startPage?integer | null

0-based inclusive start page

Example0
Formatint32
Range0 <= value
endPage?integer | null

0-based inclusive end page

Example4
Formatint32
Range0 <= value

Response Body

curl -X POST "https://loading/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",
        "layout": {
          "cells": [
            {
              "bbox": {
                "x1": 12.5,
                "y1": 34.7,
                "x2": 210.2,
                "y2": 98.3
              },
              "categoryLabel": "section-header",
              "category": "UNSPECIFIED",
              "text": "Introduction"
            }
          ]
        },
        "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