Using the OCR API
Our OCR API enables direct document processing for custom solutions.
Basic Implementation
This guide explains the basic setup and usage of the /api/process
endpoint.
1. Endpoint Details
URL
POST /api/process
Headers
Required:
Authorization
: Your personal access key (provided by our team).
Body
Required:
{
"documents": [
"data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"data:image/jpeg;base64,oiBORw0KGgoAAAANSU2EUgAA..."
]
}
2. Example Request
curl -X POST https://api.onboarding.com/api/process \
-H "Authorization: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"documents": [
"data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"data:image/jpeg;base64,oiBORw0KGgoAAAANSU2EUgAA..."
]
}'
3. Example Response
Success Response (200)
{
"id": "5ad67ada-cbd3-45a8-a1aa-7acc35476365",
"startTimestamp": 1650451011751,
"endTimestamp": 1650453826335,
"value": {
"types": [
{
"name": "IDCARD",
"probability": 0.89302659034729,
"year": "2015",
"country": "ESP",
"id": "ESP_IDCARD_2015"
}
],
"fields": [
{
"name": "DATE_OF_EXPIRY",
"value": "2028-11-14"
}
],
"images": [
{
"name": "PORTRAIT",
"value": "/9j/4AAQSkZJRgABAQEAxwDHAAD/"
}
],
"authenticity": [
{
"name": "PATTERN_CHECKS",
"value": true
}
],
"validations": [
{
"name": "OVERALL",
"value": true
}
]
}
}
Response Fields
The response includes detailed results for the OCR process. For a full description of all keys and their possible values, please refer to the [API Keys Guide]. This guide provides a comprehensive explanation of every field returned by the API.
Error Response
Common Error Codes
400
: Bad Request: The request is invalid.403
: Forbidden: Invalid or missing Authorization key.
4. Notes
- Ensure that images are properly encoded in Base64 before sending.
- The API supports multiple documents in a single request.
- Contact support additional documentation.