PlatformXeDocs
Get API Key

OCR

SDK methods for identity document verification using optical character recognition and graded name matching.

The client.ocr namespace provides typed methods for verify identity (document OCR + profile name matching) and, where enabled for your tenant, processor configuration. The HTTP API is the source of truth for field names: documentUrl / documentBase64, profileName, expectedDocumentType.

SDKInstallNamespace
TypeScriptnpm install @caldera/platformxe-sdkclient.ocr
Pythonpip install platformxeclient.ocr
Gogo get github.com/calderax/platformxe-goclient.Ocr

Verify identity document

Runs POST /api/v1/ocr/verify-identity: extracts text, matches profileName against OCR output, returns isVerified, nameReliabilityLevel, matchResult, requiresSecondaryValidation, verificationAdvisories, and extractedData.

See the full Verify Identity (OCR) reference for all fields, profileName.matchingContext (optional stateOfOriginCode, maritalStatus, etc.), and reliability tiers.

const { data } = await client.ocr.verifyIdentity({
  documentUrl: 'https://storage.example.com/uploads/nin-slip.jpg',
  profileName: {
    firstName: 'Ada',
    lastName: 'Okafor',
    middleName: 'Ngozi',
    idNumber: '98765432101',
    matchingContext: {
      stateOfOriginCode: 'DE',
      geoSignalSource: 'user',
    },
  },
  expectedDocumentType: 'NIN',
});

console.log(data.isVerified); // true only for FULL reliability + strong OCR
console.log(data.nameReliabilityLevel); // FULL | HIGH | MEDIUM | LOW | NONE
console.log(data.matchResult?.details?.regionalGeo); // when state code sent
console.log(data.requiresSecondaryValidation);
result = client.ocr.verify_identity(
    document_url="https://storage.example.com/uploads/nin-slip.jpg",
    profile_name={
        "firstName": "Ada",
        "lastName": "Okafor",
        "idNumber": "98765432101",
        "matchingContext": {"stateOfOriginCode": "AN"},
    },
    expected_document_type="NIN",
)
result, err := client.Ocr.VerifyIdentity(map[string]interface{}{
    "documentUrl": "https://storage.example.com/uploads/nin-slip.jpg",
    "profileName": map[string]interface{}{
        "firstName": "Ada",
        "lastName":  "Okafor",
        "matchingContext": map[string]interface{}{
            "stateOfOriginCode": "DE",
        },
    },
    "expectedDocumentType": "NIN",
})

Parameters (REST-aligned)

FieldRequiredDescription
documentUrlOne of URL/base64Public HTTPS URL to the image
documentBase64One of URL/base64Base64-encoded image bytes
profileNameYesfirstName, lastName, optional middleName, idNumber, matchingContext
expectedDocumentTypeNoDocument type hint (NIN, PASSPORT, …)

Python/Go parameter names may use snake_case — map to the same JSON body as the REST API.

Processor configuration

Where exposed for your organisation, processor endpoints tune OCR behaviour (confidence threshold, languages, supported types). See OCR processor.

Get processor config

const config = await client.ocr.getProcessor();

Update processor config

const updated = await client.ocr.updateProcessor({
  enabled: true,
  config: {
    confidenceThreshold: 0.9,
    supportedDocumentTypes: ['NIN', 'PASSPORT'],
  },
});

OCR verification processes PII. Use signed or short-lived URLs, restrict API keys, and follow your retention policy.

Auth

Use a valid PlatformXe API key (x-api-key) with the permissions required by your integration. Exact scope names depend on your key type — see Authentication.