Skip to content

Quick Start

Get started with OpenOCR in 5 minutes.

1. Get your API key

Sign up for a free account at open-ocr.com/signup. New accounts include credits to get started. Then generate an API key from your dashboard.

Account and API-key creation require a human (CAPTCHA). AI agents: ask your user for an sk-ocr- key.

Choosing an engine

  • General documents, scans and tables: mistral-mistral-ocr-4-1 (Mistral OCR 4.1). This is our recommended default, and it reads multi-page PDFs natively.
  • Cheapest acceptable quality: google-gemini-3.1-flash-lite.
  • Mistral OCR 4.1 may normalize spelling (for example it corrects obvious typos); for strictly verbatim transcription, LLM vision engines follow our verbatim instruction.
  • Compare every engine on the rankings page.

2. Make your first request

Send a POST request to the OCR endpoint with your API key and an image URL. Every request requires an Idempotency-Key header to prevent duplicate processing:

bash
curl -X POST https://api.open-ocr.com/v1/ocr \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "engine": "mistral-mistral-ocr-4-1",
    "input": {
      "type": "url",
      "url": "https://tesseract-ocr.github.io/tessdoc/images/eurotext.png"
    }
  }'

3. Read the response

json
{
  "request_id": "req_abc123",
  "status": "succeeded",
  "engine": "mistral-mistral-ocr-4-1",
  "extracted_text": "INVOICE #12345\nDate: January 15, 2024\n...",
  "extracted_text_preview": "INVOICE #12345...",
  "cost_debited": 0.004,
  "remaining_balance": 0.996,
  "provider_latency_ms": 280
}

Cost per page depends on the engine you choose. See the pricing page for current rates. The remaining_balance field shows your updated credit balance.

4. Use base64 input

You can also send images as base64-encoded data — useful when you have files in memory:

bash
# Encode a local file and send it
BASE64=$(base64 -w0 receipt.png)

curl -X POST https://api.open-ocr.com/v1/ocr \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "engine": "mistral-mistral-ocr-4-1",
    "input": {
      "type": "base64",
      "data_base64": "'$BASE64'",
      "mime_type": "image/png"
    }
  }'

5. Call from any language

OpenOCR is a plain REST + JSON API — no SDK install required. Use whatever HTTP client you already have.

python
import uuid
import requests

resp = requests.post(
    "https://api.open-ocr.com/v1/ocr",
    headers={
        "Authorization": "Bearer sk-ocr-your-api-key",
        "Content-Type": "application/json",
        "Idempotency-Key": str(uuid.uuid4()),  # new UUID per logical request
    },
    json={
        "engine": "mistral-mistral-ocr-4-1",
        "input": {"type": "url", "url": "https://example.com/receipt.png"},
    },
)
resp.raise_for_status()  # an error envelope has no "status" field
result = resp.json()
if result["status"] != "succeeded":
    raise RuntimeError(f"OCR ended as {result['status']}: {result.get('provider_error')}")
print(result["extracted_text"])
typescript
const resp = await fetch("https://api.open-ocr.com/v1/ocr", {
  method: "POST",
  headers: {
    Authorization: "Bearer sk-ocr-your-api-key",
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(), // new UUID per logical request
  },
  body: JSON.stringify({
    engine: "mistral-mistral-ocr-4-1",
    input: { type: "url", url: "https://example.com/receipt.png" },
  }),
});
const result = await resp.json();
if (result.status !== "succeeded") throw new Error("OCR ended as " + (result.status ?? result.error?.code)); // error envelopes have no status
console.log(result.extracted_text);

6. Query usage history (/api/usage)

For dashboard-style usage history (with pagination and date filters), useGET /api/usage.Use Authorization header auth.Passing api_keyas a query parameter is supported only as a deprecated fallback.

bash
# Preferred — the API key alone identifies the caller
curl "https://open-ocr.com/api/usage?page=1&per_page=50"   -H "Authorization: Bearer sk-ocr-your-api-key"

# Deprecated fallback (migration only; avoid in new clients)
# curl "https://open-ocr.com/api/usage?api_key=sk-ocr-your-api-key"

Migration note: move existing clients from query auth to header auth to avoid leaking API keys in URLs, logs, analytics referrers, and browser history.

7. Explore engines

OpenOCR offers multiple OCR engines, each optimized for different use cases. See our engine catalog or read the comparison tool to find the best fit.

bash
# List available engines
curl https://api.open-ocr.com/v1/engines \
  -H "Authorization: Bearer YOUR_API_KEY"

# Quick guide:
# mistral-mistral-ocr-4-1       — Recommended default: general documents, scans, tables
# google-gemini-3.1-flash-lite  — Cheapest acceptable quality
# local-tesseract               — OpenOCR-hosted, clean printed text
# local-easyocr                 — OpenOCR-hosted, multi-language
# local-doctr                   — OpenOCR-hosted, complex layouts
# openocr-ocrmypdf              — OpenOCR-hosted, scanned PDFs with auto-deskew
# openocr-rapidocr              — OpenOCR-hosted, lightweight

8. Rate limits

Responses to POST /v1/ocr and GET /v1/usage include rate limit headers:

text
X-RateLimit-Limit: 300       # requests per sliding 60 seconds, per API key
X-RateLimit-Remaining: 299  # requests left in the window
X-RateLimit-Reset: 60       # the window length; on a 429, seconds until a slot frees

POST /v1/ocr, POST /v1/ocr/batch, GET /v1/usage and engine warm-up share 300 requests per sliding 60 seconds per API key. Over the limit, OCR, batch and warm-up requests get 429 rate_limited, with a Retry-After header on OCR and batch (warm-up gives the wait only in its error message); GET /v1/usage is counted but never refused. Polling a result is not limited.