OCR Sync

This service performs the OCR on the sent document and returns the extracted data in the same request.

Run synchronous OCR

Send images of an individual's document to get the data extracted by OCR.

POSThttps://api.combateafraude.com/v1/transactions
Header parameters
Body
template*object
files*array of object

List of files to be analysed.

forceDocTypestring

Force the use of a specific template and skip the document type identification step, improving the request's response time. This must be the same value returned by the Document Detector SDK. Allowed values: cnh, cnh_new, rg, rg_new, rne, rnm, ctps, passport, crlv, crlv_new, cin.

Example: "rg"
returnSelectedImagesboolean

Whether or not to return 'images.selectedFront' and/or 'images.selectedBack' attributes as URLs to download processed images.

Example: false
Response

Success

Body
requestIdstring

Unique identifier of request.

Example: "6cb8093c-14ef-4fd1-810b-ee9fa5f9aae9"
idstring

Unique identifier of created transaction.

Example: "6021a21b3811c35ecb8dea20"
typestring

Document type. Possible values: rg, new_rg or cin (Brazilian General Registry - official identity card), cnh or new_cnh (Brazilian Driver's License), crlv or new_crlv (Vehicle Registration and License Certificate), rne (Brazilian Foreigner Registry), rnm (Brazilian Migratory Registry), ctps (Employment and Social Security Card), passport, outros (Others - when there is a document in the image but it is not of a type mapped by us), invalido (Invalid - when there is no document in the image).

Example: "rg"
dataobject

Data extracted from the document. It may vary depending on the document type.

Request
const response = await fetch('https://api.combateafraude.com/v1/transactions', {
    method: 'POST',
    headers: {
      "Authorization": "text",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "template": {
        "services": [
          "ocr_sync"
        ]
      },
      "files": [
        {
          "data": "https://my-image-name.jpg",
          "type": "FRONT"
        }
      ]
    }),
});
const data = await response.json();
Response
{
  "requestId": "6cb8093c-14ef-4fd1-810b-ee9fa5f9aae9",
  "id": "6021a21b3811c35ecb8dea20",
  "type": "rg",
  "data": {
    "federativeUnit": "ESTADO DA BAHIA",
    "rg": "00.000.000-00",
    "via": "",
    "issueDate": "13/04/2015",
    "name": "JANE DOE",
    "fatherName": "JOHN DOE",
    "motherName": "MARIA DOE",
    "birthPlace": "JAGUAQUARA BA",
    "birthDate": "25/02/1952",
    "referenceDocument": "C.NAS. CM JAGUAQUARA BA",
    "cpf": "00000000000",
    "issueState": "BA",
    "issuingAuthority": "SSP",
    "rgIssuingAuthority": "SSP",
    "rgIssueState": "BA"
  }
}

Last updated

Logo

2023 © Caf. - All rights reserved