SourceID Docs

Optical Character Recognition (OCR)

This endpoint allows you to perform Optical Character Recognition (OCR) on images to extract text, tables, forms, and signatures.

Endpoint: POST {baseurl}/v1/api/verification/ocr

Request Body

ParameterTypeRequiredDescription
referencestringYesA unique reference for the verification request.
base64ImagestringYesA base64 encoded string of the image.
customerstringNoID of the customer (optional).
verificationGroupstringNoID of the verification group (optional).

Sample Request

curl -X POST "https://your-domain.com/v1/api/verification/ocr" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    # "country": "NGA",
    "reference": "1234567890",
    # "verificationLevel": "basic",
    "base64Image": "data:image/jpeg;base64,/9j/4AAQSkZJRg...",
    "customer": "6791457be570f7f292f1fe23",
    "verificationGroup": "6791457be570f7f292f1fe23"
  }'

Sample Response

{
  "status": true,
  "responseCode": "00",
  "statusCode": "200",
  "message": "Ocr verification successful",
  "data": {
    "message": "string",
    "tableCount": 2,
    "content": {
      "lines": [
        "Sample text line 1",
        "Sample text line 2"
      ],
      "tables": [
        "Table content 1",
        "Table content 2"
      ],
      "forms": [
        "Form field 1: value",
        "Form field 2: value"
      ],
      "signatures": [
        "Signature detected in region 1",
        "Signature detected in region 2"
      ]
    }
  },
  "meta": {
    "statusCode": "200",
    "isValid": true,
    "timeStamp": "Tue Jun 17 2025 23:45:49 GMT+0000 (Coordinated Universal Time)"
  }
}

Response Data Structure

FieldTypeDescription
messagestringA descriptive message about the OCR processing.
tableCountnumberThe number of tables detected in the image.
contentobjectThe extracted content from the image.
content.linesarrayArray of text lines extracted from the image.
content.tablesarrayArray of table content extracted from the image.
content.formsarrayArray of form fields and values extracted.
content.signaturesarrayArray of signature regions detected.

Integration Flow

  1. Prepare the image for OCR processing by converting it to base64 format.
  2. Send a POST request to the OCR verification endpoint with the required parameters.
  3. Process the response to extract the relevant text, tables, forms, or signatures.
  4. Use the extracted data for further processing or validation.

Use Cases

  • Document Processing: Extract text from scanned documents
  • Form Recognition: Automatically fill forms from images
  • Table Extraction: Convert image tables to structured data
  • Signature Detection: Identify and validate signatures on documents
  • Receipt Processing: Extract information from receipts and invoices

On this page