Authentication
Secure your API requests with API keys. OCR, batch, result polling, usage and warm-up endpoints require a key. The catalog and status endpoints (GET /v1/engines, /v1/models, the engine stats, health, latency and uptime endpoints, and /health) are public and ignore a key. /v1/status also answers without a key; with one it can add the router version and uptime.
API Keys
Include your API key in the Authorization header as a Bearer token. This is the only accepted form: there is no X-API-Key header or query parameter, and the word Bearer is case-sensitive with one space after it.
curl -X POST https://api.open-ocr.com/v1/ocr \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-ocr-your-api-key" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"engine": "mistral-mistral-ocr-4-1",
"input": {
"type": "url",
"url": "https://example.com/document.png"
}
}'Getting Your API Key
- Sign up at open-ocr.com/signup — you get $1.00 in free credits immediately.
- Go to your Dashboard → API Keys.
- Click Create Key, give it a name (e.g., "Production"), and choose its scope. A Read Only key can poll results and read usage, but
POST /v1/ocr, the batch endpoint and engine warm-up refuse it with 403insufficient_scope. - Copy the key — it starts with
sk-ocr-. You will only see the full key once.
Key Security
API keys are stored as SHA-256 hashes — we never store your raw key. Best practices:
- Never expose keys in client-side code — use a backend proxy.
- Use environment variables — don't hardcode keys in source.
- Separate keys per environment — one for dev, one for production.
- Watch usage per key — the dashboard shows each key's requests this UTC month next to its limit. New requests over that limit return a 429
api_key_limit_reachederror and are not charged. Create a key with a higher limit or use another key from the dashboard. Retries of an admitted request with the sameIdempotency-Keyare not counted twice. - Rotate regularly — revoke old keys and generate new ones.
# Store your key in environment variables
export OPENOCR_API_KEY="sk-ocr-your-api-key"
# Use it in your application
curl -H "Authorization: Bearer $OPENOCR_API_KEY" \
https://api.open-ocr.com/v1/enginesHTTP Client Configuration
import os
import requests
response = requests.get(
"https://api.open-ocr.com/v1/engines",
headers={"Authorization": f"Bearer {os.environ['OPENOCR_API_KEY']}"},
)
response.raise_for_status()// Node.js 18+
const response = await fetch("https://api.open-ocr.com/v1/engines", {
headers: { Authorization: `Bearer ${process.env.OPENOCR_API_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);Official OpenOCR SDKs are coming soon. For now, call the REST API with your preferred HTTP client.
Session Authentication
The Playground uses session-based authentication via Supabase JWT tokens. When logged in, your browser sends a JWT access token whose signature the router verifies (ES256 through the auth server's JWKS, or the HS256 signing secret when no ES256 key is published). Credits are charged directly to your account balance.
For programmatic access, always use API keys. Session tokens are for the web playground only.
Rate Limits
OCR, batch, usage and warm-up requests share a limit of 300 requests per sliding 60 seconds per API key (per user for a signed-in session). Over the limit, POST /v1/ocr, the batch endpoint and engine warm-up return 429 rate_limited. OCR and batch send a Retry-After header; warm-up sends none, and its error message gives the seconds to wait. GET /v1/usage counts toward the limit but is never refused. Polling a result and the public catalog endpoints are not limited. See Error Codes for which responses carry the headers.
# Rate limit headers on POST /v1/ocr and GET /v1/usage responses:
# X-RateLimit-Limit: 300
# X-RateLimit-Remaining: 299
# X-RateLimit-Reset: 60 # the window length on an allowed request; on a 429, seconds until a slot freesAuthentication Errors
If authentication fails, you'll receive a 401 response:
{
"error": {
"code": "authentication_error",
"message": "Invalid API key"
}
}The message names the cause: Missing Authorization header, Authorization must use Bearer token (no Bearer prefix), API key must match format: sk-... or provide a valid session token, Invalid API key (unknown or revoked key, or a typo), API key is no longer active (revoked while the request was in progress), or Invalid or expired session token. A valid read-only key used for OCR gets 403 insufficient_scope instead. See the Error Codes page for the full reference.