Skip to main content

Prerequisites

  • An API endpoint URL provided by Trace
  • An HTTP client (curl, Python requests, or similar)

Make your first OCR request

Upload an image or PDF and get back structured text with bounding boxes and confidence scores.
curl -X POST https://ocr-api.trace.so/ocr/ \
  -F "[email protected]"

Response structure

The /ocr endpoint returns an array of results, one per uploaded file:
[
  {
    "name": "document.jpg",
    "orientation": { "value": 0.0, "confidence": 0.99 },
    "language": { "value": "en", "confidence": 0.99 },
    "dimensions": [1920, 1080],
    "pages": [
      {
        "blocks": [
          {
            "geometry": [0.12, 0.05, 0.88, 0.15],
            "detection_score": 0.97,
            "lines": [
              {
                "geometry": [0.12, 0.05, 0.88, 0.10],
                "detection_score": 0.97,
                "words": [
                  {
                    "value": "Hello",
                    "geometry": [0.12, 0.05, 0.30, 0.10],
                    "detection_score": 0.97,
                    "confidence": 0.99,
                    "text_orientation": { "value": 0, "confidence": null }
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
]
Each word includes:
  • value — the recognized text
  • geometry — normalized bounding box coordinates [x_min, y_min, x_max, y_max] where values range from 0 to 1 relative to the page dimensions
  • confidence — recognition confidence (0 to 1)
  • detection_score — how confident the detector is that this region contains text

Customize model parameters

Pass query parameters to change models or tune thresholds:
curl -X POST "https://ocr-api.trace.so/ocr/?detection_model=fast_base&recognition_model=parseq&binary_threshold=0.3" \
  -F "[email protected]"
See Available models for the full list of architectures.

Supported file formats