For the complete documentation index, see llms.txt. This page is also available as Markdown.

Document Reader

This service is used to read information from a document image with FacePhi OCR technology and organize the information into fields.

The service can handle different types of documents including identity cards, foreign cards, invoices, and PDFs. It is necessary to specify the document type and the model to process the document correctly.

For a complete list of supported document types and models, see Documents supported by OCR.

Documents supported by OCR

Document types

The OCR service can process different types of documents. Use the parameter type to specify the type of document to process:

Type
Value
Description

Identity card

id_card

National identity cards

Foreign card

foreign_card

Foreign identification cards

PDF

pdf

PDF documents that require OCR processing

Invoice

invoice

Invoice documents

Supported models by document type

Identity cards (ID Cards)

For identity cards, use the country code ISO 3166-1 alpha-3 as the parameter model:

Country
ISO Code

Argentina

ARG

Mexico

MEX

Foreign cards (Foreign Cards)

For foreign cards, use the following codes as the parameter model:

Country
ISO Code

Mexico

MEX

Invoices

For invoices, use the supplier code as the parameter model:

Supplier
Code

TELMEX

TELMEX

CFE

CFE

PDF documents

For PDF documents, use the document type code as the parameter model:

Document type
Code

VAT: El Salvador

VAT

Income Tax: El Salvador

INCOME TAX

Endpoint

Headers

Name
Type
Required
Description

x-api-key

string

Yes

Access authorization API key.

family

string

No

Value: Onboarding. Required with the tracking service.

All calls to the Endpoints for Tracking with Identity Platform must contain the header family.

Request body

Content-Type: application/json

Parameters

Parameter
Type
Required
Description

type

string

Yes

Document type to process. Only the types allowed in the tenant configuration can be used. Possible values: id_card, passport, driver_license, foreign_card, invoice, pdf

model

string

Yes

Identifier of the document model to process. For identity documents, use the country code ISO 3166-1 alpha-3. For invoices or PDF documents, use the specific codes provided by FacePhi.

files

string[]

Yes

Document images encoded in Base64 (RFC4648). Maximum of two images per request. The first image is treated as the front side.

isCropped

boolean

No

Indicates whether the provided images are already cropped. Default value: false

forceDetection

boolean

No

Forces OCR detection even if automatic document detection fails. Default value: false

retrieveImages

boolean

No

Returns cropped images in the response when supported for the configured tenant. Default value: false

tracking

object

No

Object that represents the necessary tracking information.

tracking.extraData

string

No

Token generated by the Mobile/Web SDK. Contains tokenized tracking information with the Platform.

tracking.operationId

string

No

Operation identifier generated by the Mobile/Web SDK.

Request example

Responses

200 Success

Response parameters

Parameter
Type
Description

serviceResultCode

integer

Code indicating the overall result of the service execution.

serviceResultLog

string

Descriptive field of the service execution result.

timestamp

string

Moment when the service finished processing.

serviceTransactionId

string

Transaction identifier associated with the request processed by the API.

serviceResult

object

Object with the OCR result containing the extracted fields.

serviceTime

string

Total service execution time (milliseconds).

Service Result Code

The serviceResultCode indicates the overall result of the service execution:

serviceResultCode
Description
HTTP code

0

The service execution was successful, the module processed the request correctly.

200

Response example

400 Bad Request

401 Unauthorized

403 Forbidden

502 Bad Gateway

504 Gateway Timeout

Last updated