Document OCR
Service that extracts the fields from the identity document. Supports the front side and, optionally, the back side.
The assets are provided inline or by reference, depending on the value of source.
Endpoint
POST /document/ocrHeaders
consumer-id
string
Yes
Consumer identifier.
operation-id
string
Conditional
Identifier of the operation to which the referenced assets belong. Required when source is FILE_KEY. See Storage.
Request body
Content-Type: application/json
Parameters
source
string
Yes
Mode in which the assets are provided: FILE_KEY for stored asset keys, FILE for content in Base64. See Storage.
files
array
Yes
One or two inputs: index 0 the front side, index 1 the back side. Asset keys or Base64 contents, depending on source.
documentType
string
Yes
Document type: ID_CARD, PASSPORT, DRIVING_LICENSE or FOREIGN_CARD.
countryCode
string
Yes
Document issuing country, as a code ISO 3166-1 alpha-3.
isCropped
boolean
No
Indicates that the images are already cropped. By default false.
forceDetection
boolean
No
Forces detection even if automatic document detection fails. By default false.
retrieveImages
boolean
No
Returns the cropped images in the response. By default false.
files supports at most two inputs. Multipage forms are processed in Form OCR.
Request example
Responses
200 Success
Response parameters
serviceResultCode
integer
Code indicating the overall result of the service execution. 0 is success.
serviceResultLog
string
Descriptive field for the result of the service execution.
serviceTransactionId
string
Transaction identifier associated with the processed request.
serviceTime
string
Total processing time (milliseconds).
timestamp
string
Moment when processing finished, in format ISO 8601.
serviceResult
object
OCR result with the fields extracted from the identity document.
Response example
Other responses
400
Required field missing or unsupported value; missing header operation-id with references; or a key does not have the form {operationId}/{CONTEXTO} or declares a context that the slot does not support.
403
The consumer is not provisioned with the service DOCUMENT_OCR.
404
The operation declared in operation-id does not exist or belongs to another consumer.
409
A referenced asset contains content already processed in another operation.
410
The operation declared in operation-id has expired.
422
A key names an operation different from the one declared in operation-id, or the context has no stored asset.
429
The consumer has exceeded its request rate limit, or a referenced asset has exhausted its invocation budget on this Endpoint. In the first case the response includes Retry-After, X-RateLimit-Limit and X-RateLimit-Burst, and waiting resolves it; in the second it does not. The underlying service is not invoked and the call is not billed.
The body of an error response has the form described in MIDAPI v2.
Last updated