Developer Documentation

Integrate StructOCR's proprietary AI models into your application. Our REST API provides specialized endpoints for identity document extraction with enterprise-grade reliability and a Zero-Retention privacy policy.

High Performance

Average response time < 5s with global edge acceleration.

Privacy First

Images are processed in memory and purged within 24 hours.

Structured Data

Clean JSON output mapped to standard identity schemas.

Authentication

All API requests require an API key. This key should be included in the x-api-key custom header. You can manage multiple keys in your API Management console.

x-api-key: YOUR_API_KEY

Security Warning: API keys carry full account privileges. Never expose them in client-side code (browsers, mobile apps). Always proxy requests through your own backend server.

Quickstart

Each successful OCR request costs 2 Credits. Failed requests (non-200 status) are never billed. Use the JSON request (with Base64 encoded image) below to extract data from a document.

cURL Request (Passport Example)
curl -X POST https://api.structocr.com/v1/passport \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "img": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."
  }'

Successful extraction returns a structured JSON object:

{
  "success": "true",
  "data": {
    "type": "P",
    "country_code": "USA",
    "passport_number": "E12345678",
    "expiry_date": "2030-12-25",
    "surname": "DOE",
    "nationality": "UNITED STATES"
    // ... more fields
  }
}

Error Handling

Our API uses standard HTTP response codes. For security and stability, we mask internal upstream errors into branded status codes.

CodeMessageReason
402INSUFFICIENT_CREDITSYour balance is too low for this request.
429QUOTA_EXCEEDEDRate limit hit. Standard limit is 25 req/sec.
503SYSTEM_BUSYMasked internal provider error. Retry recommended.