Extract text from base64 documents
POST/api/v2/Ocr/base64
Runs OCR over the provided documents and returns a provider-agnostic result per file. The model can be selected by model id or by model code + vendor. A failure on one file is reported as a per-file error and does not abort the others.
Request
Query Parameters
Use this param to override the culture of the response. Options: - en (default) - es
- application/json
Body
The OCR request with the base64 documents, the model selection and optional instructions.
Array [
]
base64Files
object[]
nullable
Base64-encoded documents, each with its explicit MIME type.
Possible values: non-empty
The base64-encoded content of the file (raw base64, without a data URI prefix).
Possible values: non-empty
The MIME type of the file (e.g. "image/png", "application/pdf").
Optional original file name, used for logging/labeling.
Possible values: <= 4000 characters
Optional instructions guiding the extraction. If not provided, the system will attempt to extract all text from the documents.
Possible values: <= 256 characters
Optional user identifier for tracking and cost management purposes.
Possible values: <= 64 characters
The channel used in the execution.
The unique identifier of the AI model to use. Used instead of Vendor and ModelCode.
The model code to use. Used together with Vendor when AIModelId is not provided.
The vendor of the model to use. Used together with ModelCode when AIModelId is not provided.
Responses
- 200
- 400
- 401
- 403
- 404
- 429
- 500
- 502
Returns the OCR result per file, plus the execution instance id and cost.
- text/plain
- application/json
- text/json
- Schema
- Example (from schema)
Schema
Array [
Array [
Array [
]
Array [
]
Array [
]
Array [
]
Array [
]
]
]
files
object[]
nullable
result
object
pages
object[]
nullable
images
object[]
nullable
boundingBox
object
Bounding box in coordinates normalised 0-1 relative to the page.
tables
object[]
nullable
Possible values: [0, 1]
The table content format. 0 = Html, 1 = Markdown.
boundingBox
object
Bounding box in coordinates normalised 0-1 relative to the page.
hyperlinks
object[]
nullable
boundingBox
object
Bounding box in coordinates normalised 0-1 relative to the page.
dimensions
object
confidence
object
wordScores
object[]
nullable
blocks
object[]
nullable
boundingBox
object
Bounding box in coordinates normalised 0-1 relative to the page.
usage
object
additionalCounts
object
nullable
tokenUsage
object
cost
object
usage
object
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"files": [
{
"index": 0,
"source": "string",
"success": true,
"result": {
"model": "string",
"provider": "string",
"pages": [
{
"index": 0,
"markdown": "string",
"images": [
{
"id": "string",
"base64": "string",
"boundingBox": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
}
}
],
"tables": [
{
"content": "string",
"format": 0,
"boundingBox": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
}
}
],
"hyperlinks": [
{
"url": "string",
"text": "string",
"boundingBox": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
}
}
],
"header": "string",
"footer": "string",
"dimensions": {
"width": 0,
"height": 0,
"dpi": 0
},
"confidence": {
"averagePageScore": 0,
"minimumPageScore": 0,
"wordScores": [
{
"word": "string",
"score": 0
}
]
},
"blocks": [
{
"label": "string",
"boundingBox": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
}
}
]
}
],
"usage": {
"inputTokenCount": 0,
"outputTokenCount": 0,
"totalTokenCount": 0,
"cachedInputTokenCount": 0,
"reasoningTokenCount": 0,
"additionalCounts": {}
},
"markdown": "string"
},
"error": "string"
}
],
"tokenUsage": {
"promptTokens": 0,
"completionTokens": 0,
"totalTokens": 0
},
"cost": {
"amount": 0,
"currency": "string"
},
"usage": {
"inputUnit": "string",
"input": 0,
"outputUnit": "string",
"output": 0
}
}
- Schema
- Example (from schema)
Schema
Array [
Array [
Array [
]
Array [
]
Array [
]
Array [
]
Array [
]
]
]
files
object[]
nullable
result
object
pages
object[]
nullable
images
object[]
nullable
boundingBox
object
Bounding box in coordinates normalised 0-1 relative to the page.
tables
object[]
nullable
Possible values: [0, 1]
The table content format. 0 = Html, 1 = Markdown.
boundingBox
object
Bounding box in coordinates normalised 0-1 relative to the page.
hyperlinks
object[]
nullable
boundingBox
object
Bounding box in coordinates normalised 0-1 relative to the page.
dimensions
object
confidence
object
wordScores
object[]
nullable
blocks
object[]
nullable
boundingBox
object
Bounding box in coordinates normalised 0-1 relative to the page.
usage
object
additionalCounts
object
nullable
tokenUsage
object
cost
object
usage
object
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"files": [
{
"index": 0,
"source": "string",
"success": true,
"result": {
"model": "string",
"provider": "string",
"pages": [
{
"index": 0,
"markdown": "string",
"images": [
{
"id": "string",
"base64": "string",
"boundingBox": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
}
}
],
"tables": [
{
"content": "string",
"format": 0,
"boundingBox": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
}
}
],
"hyperlinks": [
{
"url": "string",
"text": "string",
"boundingBox": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
}
}
],
"header": "string",
"footer": "string",
"dimensions": {
"width": 0,
"height": 0,
"dpi": 0
},
"confidence": {
"averagePageScore": 0,
"minimumPageScore": 0,
"wordScores": [
{
"word": "string",
"score": 0
}
]
},
"blocks": [
{
"label": "string",
"boundingBox": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
}
}
]
}
],
"usage": {
"inputTokenCount": 0,
"outputTokenCount": 0,
"totalTokenCount": 0,
"cachedInputTokenCount": 0,
"reasoningTokenCount": 0,
"additionalCounts": {}
},
"markdown": "string"
},
"error": "string"
}
],
"tokenUsage": {
"promptTokens": 0,
"completionTokens": 0,
"totalTokens": 0
},
"cost": {
"amount": 0,
"currency": "string"
},
"usage": {
"inputUnit": "string",
"input": 0,
"outputUnit": "string",
"output": 0
}
}
- Schema
- Example (from schema)
Schema
Array [
Array [
Array [
]
Array [
]
Array [
]
Array [
]
Array [
]
]
]
files
object[]
nullable
result
object
pages
object[]
nullable
images
object[]
nullable
boundingBox
object
Bounding box in coordinates normalised 0-1 relative to the page.
tables
object[]
nullable
Possible values: [0, 1]
The table content format. 0 = Html, 1 = Markdown.
boundingBox
object
Bounding box in coordinates normalised 0-1 relative to the page.
hyperlinks
object[]
nullable
boundingBox
object
Bounding box in coordinates normalised 0-1 relative to the page.
dimensions
object
confidence
object
wordScores
object[]
nullable
blocks
object[]
nullable
boundingBox
object
Bounding box in coordinates normalised 0-1 relative to the page.
usage
object
additionalCounts
object
nullable
tokenUsage
object
cost
object
usage
object
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"files": [
{
"index": 0,
"source": "string",
"success": true,
"result": {
"model": "string",
"provider": "string",
"pages": [
{
"index": 0,
"markdown": "string",
"images": [
{
"id": "string",
"base64": "string",
"boundingBox": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
}
}
],
"tables": [
{
"content": "string",
"format": 0,
"boundingBox": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
}
}
],
"hyperlinks": [
{
"url": "string",
"text": "string",
"boundingBox": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
}
}
],
"header": "string",
"footer": "string",
"dimensions": {
"width": 0,
"height": 0,
"dpi": 0
},
"confidence": {
"averagePageScore": 0,
"minimumPageScore": 0,
"wordScores": [
{
"word": "string",
"score": 0
}
]
},
"blocks": [
{
"label": "string",
"boundingBox": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
}
}
]
}
],
"usage": {
"inputTokenCount": 0,
"outputTokenCount": 0,
"totalTokenCount": 0,
"cachedInputTokenCount": 0,
"reasoningTokenCount": 0,
"additionalCounts": {}
},
"markdown": "string"
},
"error": "string"
}
],
"tokenUsage": {
"promptTokens": 0,
"completionTokens": 0,
"totalTokens": 0
},
"cost": {
"amount": 0,
"currency": "string"
},
"usage": {
"inputUnit": "string",
"input": 0,
"outputUnit": "string",
"output": 0
}
}
If the request validation fails (no files, invalid base64), or if every submitted file failed and the provider rejected at least one as invalid.
- application/json
- Schema
- Example (from schema)
Schema
- MOD1
- MOD2
Array [
]
Array [
]
Array [
Array [
]
]
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
errors
object
nullable
Map of keys (an invalid request field or the rule that failed) to messages. Only present when the error has specific detail to report. Values are strings, except on input_validation_error, where each value is an array of messages for that field.
property name*
object
nullable
oneOf
string
string
attempts
object[]
nullable
One entry per attempt to call the AI provider, in order. Only present on agent_execution_failed and aiservice_execution_failed.
Zero-based index of the attempt.
Model pool an agent attempt used: main or fallback. Omitted for AI service attempts.
Error code of this attempt, e.g. vendor_rate_limit_error. See Vendor error codes on the API Errors page.
Raw HTTP status the AI provider returned for this attempt. Informational only; it does not set the response status.
Human-readable, localised summary of this attempt's failure.
errors
object
nullable
Detail for this attempt, e.g. vendor_error with the provider-supplied message.
files
object[]
nullable
Only on aiservice_execution_failed from OCR: the attempts grouped per submitted file, in place of attempts.
Zero-based index of the file in the submitted batch.
Original file name or URL.
attempts
object[]
Every attempt made for this file, even when there is only one.
Zero-based index of the attempt.
Model pool an agent attempt used: main or fallback. Omitted for AI service attempts.
Error code of this attempt, e.g. vendor_rate_limit_error. See Vendor error codes on the API Errors page.
Raw HTTP status the AI provider returned for this attempt. Informational only; it does not set the response status.
Human-readable, localised summary of this attempt's failure.
errors
object
nullable
Detail for this attempt, e.g. vendor_error with the provider-supplied message.
{
"code": "string",
"message": "string",
"documentationUrl": "string",
"errors": {},
"attempts": [
{
"index": 0,
"modelType": "string",
"code": "string",
"statusCode": 0,
"message": "string",
"errors": {}
}
],
"files": [
{
"index": 0,
"source": "string",
"attempts": [
{
"index": 0,
"modelType": "string",
"code": "string",
"statusCode": 0,
"message": "string",
"errors": {}
}
]
}
]
}
The user is unauthorized or the session expired
- application/json
- Schema
- Example (from schema)
Schema
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
{
"code": "string",
"message": "string",
"documentationUrl": "string"
}
The user does not have permission
- application/json
- Schema
- Example (from schema)
Schema
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
{
"code": "string",
"message": "string",
"documentationUrl": "string"
}
If the specified model is not found or does not support OCR.
- application/json
- Schema
- Example (from schema)
Schema
- MOD1
- MOD2
Array [
]
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
errors
object
nullable
Map of keys (an invalid request field or the rule that failed) to messages. Only present when the error has specific detail to report. Values are strings, except on input_validation_error, where each value is an array of messages for that field.
property name*
object
nullable
oneOf
string
string
{
"code": "string",
"message": "string",
"documentationUrl": "string",
"errors": {}
}
If OCR failed for every submitted file because the provider rate-limited every attempt.
- application/json
- Schema
- Example (from schema)
Schema
- MOD1
- MOD2
Array [
]
Array [
]
Array [
Array [
]
]
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
errors
object
nullable
Map of keys (an invalid request field or the rule that failed) to messages. Only present when the error has specific detail to report. Values are strings, except on input_validation_error, where each value is an array of messages for that field.
property name*
object
nullable
oneOf
string
string
attempts
object[]
nullable
One entry per attempt to call the AI provider, in order. Only present on agent_execution_failed and aiservice_execution_failed.
Zero-based index of the attempt.
Model pool an agent attempt used: main or fallback. Omitted for AI service attempts.
Error code of this attempt, e.g. vendor_rate_limit_error. See Vendor error codes on the API Errors page.
Raw HTTP status the AI provider returned for this attempt. Informational only; it does not set the response status.
Human-readable, localised summary of this attempt's failure.
errors
object
nullable
Detail for this attempt, e.g. vendor_error with the provider-supplied message.
files
object[]
nullable
Only on aiservice_execution_failed from OCR: the attempts grouped per submitted file, in place of attempts.
Zero-based index of the file in the submitted batch.
Original file name or URL.
attempts
object[]
Every attempt made for this file, even when there is only one.
Zero-based index of the attempt.
Model pool an agent attempt used: main or fallback. Omitted for AI service attempts.
Error code of this attempt, e.g. vendor_rate_limit_error. See Vendor error codes on the API Errors page.
Raw HTTP status the AI provider returned for this attempt. Informational only; it does not set the response status.
Human-readable, localised summary of this attempt's failure.
errors
object
nullable
Detail for this attempt, e.g. vendor_error with the provider-supplied message.
{
"code": "string",
"message": "string",
"documentationUrl": "string",
"errors": {},
"attempts": [
{
"index": 0,
"modelType": "string",
"code": "string",
"statusCode": 0,
"message": "string",
"errors": {}
}
],
"files": [
{
"index": 0,
"source": "string",
"attempts": [
{
"index": 0,
"modelType": "string",
"code": "string",
"statusCode": 0,
"message": "string",
"errors": {}
}
]
}
]
}
There was an unexpected error
- application/json
- Schema
- Example (from schema)
Schema
- MOD1
- MOD2
Array [
]
Array [
]
Array [
Array [
]
]
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
errors
object
nullable
Map of keys (an invalid request field or the rule that failed) to messages. Only present when the error has specific detail to report. Values are strings, except on input_validation_error, where each value is an array of messages for that field.
property name*
object
nullable
oneOf
string
string
attempts
object[]
nullable
One entry per attempt to call the AI provider, in order. Only present on agent_execution_failed and aiservice_execution_failed.
Zero-based index of the attempt.
Model pool an agent attempt used: main or fallback. Omitted for AI service attempts.
Error code of this attempt, e.g. vendor_rate_limit_error. See Vendor error codes on the API Errors page.
Raw HTTP status the AI provider returned for this attempt. Informational only; it does not set the response status.
Human-readable, localised summary of this attempt's failure.
errors
object
nullable
Detail for this attempt, e.g. vendor_error with the provider-supplied message.
files
object[]
nullable
Only on aiservice_execution_failed from OCR: the attempts grouped per submitted file, in place of attempts.
Zero-based index of the file in the submitted batch.
Original file name or URL.
attempts
object[]
Every attempt made for this file, even when there is only one.
Zero-based index of the attempt.
Model pool an agent attempt used: main or fallback. Omitted for AI service attempts.
Error code of this attempt, e.g. vendor_rate_limit_error. See Vendor error codes on the API Errors page.
Raw HTTP status the AI provider returned for this attempt. Informational only; it does not set the response status.
Human-readable, localised summary of this attempt's failure.
errors
object
nullable
Detail for this attempt, e.g. vendor_error with the provider-supplied message.
{
"code": "string",
"message": "string",
"documentationUrl": "string",
"errors": {},
"attempts": [
{
"index": 0,
"modelType": "string",
"code": "string",
"statusCode": 0,
"message": "string",
"errors": {}
}
],
"files": [
{
"index": 0,
"source": "string",
"attempts": [
{
"index": 0,
"modelType": "string",
"code": "string",
"statusCode": 0,
"message": "string",
"errors": {}
}
]
}
]
}
If OCR failed for every submitted file because of a provider error.
- application/json
- Schema
- Example (from schema)
Schema
- MOD1
- MOD2
Array [
]
Array [
]
Array [
Array [
]
]
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
errors
object
nullable
Map of keys (an invalid request field or the rule that failed) to messages. Only present when the error has specific detail to report. Values are strings, except on input_validation_error, where each value is an array of messages for that field.
property name*
object
nullable
oneOf
string
string
attempts
object[]
nullable
One entry per attempt to call the AI provider, in order. Only present on agent_execution_failed and aiservice_execution_failed.
Zero-based index of the attempt.
Model pool an agent attempt used: main or fallback. Omitted for AI service attempts.
Error code of this attempt, e.g. vendor_rate_limit_error. See Vendor error codes on the API Errors page.
Raw HTTP status the AI provider returned for this attempt. Informational only; it does not set the response status.
Human-readable, localised summary of this attempt's failure.
errors
object
nullable
Detail for this attempt, e.g. vendor_error with the provider-supplied message.
files
object[]
nullable
Only on aiservice_execution_failed from OCR: the attempts grouped per submitted file, in place of attempts.
Zero-based index of the file in the submitted batch.
Original file name or URL.
attempts
object[]
Every attempt made for this file, even when there is only one.
Zero-based index of the attempt.
Model pool an agent attempt used: main or fallback. Omitted for AI service attempts.
Error code of this attempt, e.g. vendor_rate_limit_error. See Vendor error codes on the API Errors page.
Raw HTTP status the AI provider returned for this attempt. Informational only; it does not set the response status.
Human-readable, localised summary of this attempt's failure.
errors
object
nullable
Detail for this attempt, e.g. vendor_error with the provider-supplied message.
{
"code": "string",
"message": "string",
"documentationUrl": "string",
"errors": {},
"attempts": [
{
"index": 0,
"modelType": "string",
"code": "string",
"statusCode": 0,
"message": "string",
"errors": {}
}
],
"files": [
{
"index": 0,
"source": "string",
"attempts": [
{
"index": 0,
"modelType": "string",
"code": "string",
"statusCode": 0,
"message": "string",
"errors": {}
}
]
}
]
}