PlatformXeDocs
Get API Key

OCR Processor

Configuration reference for OCR provider, confidence threshold, and document types.

The OCR processor controls text extraction behaviour including the minimum confidence threshold, which document types are accepted, and which languages are supported.

Endpoint

GET /api/v1/ocr/processor -- Read current configuration.

PUT /api/v1/ocr/processor -- Update configuration.

Scope: ocr:manage

Configuration schema

{
  "config": {
    "provider": "azure",
    "confidenceThreshold": 0.85,
    "supportedDocumentTypes": ["passport", "drivers_license", "national_id"],
    "languages": ["en"]
  }
}

Fields

FieldTypeDefaultDescription
providerstring"azure"OCR provider engine
confidenceThresholdnumber0.85Minimum confidence score (0-1) for accepting extracted text. Extractions below this threshold return an UNPROCESSABLE error
supportedDocumentTypesstring[]["passport", "drivers_license", "national_id"]Document types this tenant accepts for verification
languagesstring[]["en"]ISO 639-1 language codes for OCR text extraction

Supported document types

CodeDocument
passportInternational passport
drivers_licenseDrivers license
national_idNational identity card
nin_slipNIN slip (Nigeria)
voters_cardVoter's registration card
residence_permitResidence permit

How it affects runtime

  • Confidence threshold: After text extraction, the OCR engine reports a confidence score. If the score is below confidenceThreshold, the request fails with an UNPROCESSABLE error. Raise this value to reduce false positives at the cost of rejecting more borderline documents.
  • Document types: When expectedDocumentType is provided in a verify request, it is validated against supportedDocumentTypes. If the document type is not in the list, the request fails with a BAD_REQUEST error.
  • Languages: The OCR engine is optimized for the configured languages. Adding languages relevant to your user base improves extraction accuracy for names and addresses.

Examples

Lower the confidence threshold and add French

curl

curl -X PUT https://api.platformxe.com/api/v1/ocr/processor \
  -H "Content-Type: application/json" \
  -H "x-api-key: pxk_live_your_api_key_here" \
  -d '{
    "config": {
      "confidenceThreshold": 0.75,
      "languages": ["en", "fr"]
    }
  }'

TypeScript SDK

import { PlatformXe } from '@caldera/platformxe-sdk';

const px = new PlatformXe({ apiKey: 'pxk_live_your_api_key_here' });

await px.ocr.updateProcessor({
  config: {
    confidenceThreshold: 0.75,
    languages: ['en', 'fr'],
  },
});

Python SDK

from platformxe import PlatformXe

px = PlatformXe(api_key="pxk_live_your_api_key_here")

px.ocr.update_processor({
    "config": {
        "confidenceThreshold": 0.75,
        "languages": ["en", "fr"]
    }
})

Add NIN slip to supported document types

await px.ocr.updateProcessor({
  config: {
    supportedDocumentTypes: ['passport', 'drivers_license', 'national_id', 'nin_slip'],
  },
});

Error responses

CodeDescription
FORBIDDENAPI key does not have the ocr:manage scope
BAD_REQUESTInvalid config (e.g., threshold outside 0-1 range, unknown language code)
RATE_LIMITEDRate limit exceeded