Saltar al contenido principal

OCR

This API is used to read information from a document image with OCR Facephi technology and sort the information into fields.

Usage

FieldDescription
typeIt is necessary to specify the document type you wish to process as our service can handle different types of documents. Values availables in the JSON: id_card, foreign_card, invoice, pdf.
modelThis parameter specifies the ID of the document to be processed. In the case of invoices or PDF documents, please refer to the list below. Otherwise, this identifier corresponds to the country of origin of the document. To specify this country, follow the standard specified in ISO_3166-1 alpha-3. In case of invoice or pdf use the key in the below tables.
filesArray of strings. Each position of the array is an image raw buffer encoded in base64 RFC4648. Maximum two files. The first image will be the front side of a id_card.

Model supported

Document type supported (type parameter)

TypeValue
ID Cardid_card
Foreign Cardforeign_card
PDFpdf
Invoiceinvoice

ID Card supported (model parameter)

ModelValue
ArgentinaARG
MéxicoMEX

Foreign Card supported (model parameter)

ModelValue
MéxicoMEX

Invoice supported (model parameter)

ModelValue
TELMEXTELMEX
CFECFE

PDF supported (model parameter)

ModelValue
IVA: El SalvadorIVA
RENTA: El SalvadorRENTA

Example request:

curl --location '{IDENTITY_API_BASE_URL}/ocr' \
--header 'x-api-key: {IDENTITY_API_APIKEY}' \
--header 'Content-Type: application/json' \
--data '{
"type": "pdf",
"model": "IVA",
"files": ["JVBERi0xLjQKJeLjz9MKNSAwIG9iago8P..."]
}'

Example response:

200 OK

{
"serviceResultCode": 200,
"serviceResultLog": "Service executed ok",
"timestamp": "2024-07-12T09:43:36Z",
"serviceTransactionId": "99999999-9999-9999-9999-999999999999",
"serviceResult": {
"dictionary": {
"CommercialName": "Example Comercial Name",
"DeclarationNumber": "11111111111",
"EconomicActivity": "National Transports",
"NIT": "9999-999999-999-9",
"NRC": "999999-9",
"Name": "John Doe",
"TaxedPeriod": "04 2021"
},
"model": "IVA",
"side": "front",
"type": "pdf",
"version": "2021"
},
"serviceTime": "638"
}