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
| Field | Type | Default | Description |
|---|---|---|---|
provider | string | "azure" | OCR provider engine |
confidenceThreshold | number | 0.85 | Minimum confidence score (0-1) for accepting extracted text. Extractions below this threshold return an UNPROCESSABLE error |
supportedDocumentTypes | string[] | ["passport", "drivers_license", "national_id"] | Document types this tenant accepts for verification |
languages | string[] | ["en"] | ISO 639-1 language codes for OCR text extraction |
Supported document types
| Code | Document |
|---|---|
passport | International passport |
drivers_license | Drivers license |
national_id | National identity card |
nin_slip | NIN slip (Nigeria) |
voters_card | Voter's registration card |
residence_permit | Residence 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 anUNPROCESSABLEerror. Raise this value to reduce false positives at the cost of rejecting more borderline documents. - Document types: When
expectedDocumentTypeis provided in a verify request, it is validated againstsupportedDocumentTypes. If the document type is not in the list, the request fails with aBAD_REQUESTerror. - 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
| Code | Description |
|---|---|
FORBIDDEN | API key does not have the ocr:manage scope |
BAD_REQUEST | Invalid config (e.g., threshold outside 0-1 range, unknown language code) |
RATE_LIMITED | Rate limit exceeded |