Extract text from documents by file ID
POST/api/v2/Ocr/file
Used by the AI Services catalog: files are uploaded to the file manager first and then referenced by id. 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
- text/json
- application/*+json
Body
The OCR request with the file ids, the model selection and optional instructions.
The ids of the files to process. The files must already exist in the system.
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.
Body
The OCR request with the file ids, the model selection and optional instructions.
The ids of the files to process. The files must already exist in the system.
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.
Body
The OCR request with the file ids, the model selection and optional instructions.
The ids of the files to process. The files must already exist in the system.
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
- 500
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
{
"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"
}
}
- 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
{
"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"
}
}
- 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
{
"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"
}
}
If the request validation fails (no files, unsupported format).
- application/json
- Schema
- Example (from schema)
Schema
errors
object
nullable
{
"message": "string",
"errors": {}
}
The user is unauthorized or the session expired
The user does not have permission
If the specified model or a file is not found, or the model does not support OCR.
There was an unexpected error