OCR
This API is used to read information from a document image with OCR Facephi technology and sort the information into fields.
Usage
| Field | Description |
|---|---|
| type | It 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. |
| model | This 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. |
| files | Array 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)
| Type | Value |
|---|---|
| ID Card | id_card |
| Foreign Card | foreign_card |
| Invoice | invoice |
ID Card supported (model parameter)
| Model | Value |
|---|---|
| Argentina | ARG |
| México | MEX |
Foreign Card supported (model parameter)
| Model | Value |
|---|---|
| México | MEX |
Invoice supported (model parameter)
| Model | Value |
|---|---|
| TELMEX | TELMEX |
| CFE | CFE |
PDF supported (model parameter)
| Model | Value |
|---|---|
| IVA: El Salvador | IVA |
| RENTA: El Salvador | RENTA |
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"
}