Serverless AI Image Content Extraction
AI powered OCR service that extracts specific text content from images based on the provided content keys.
Endpoint
This API uses multipart/form-data format. You must send the image file and the contents as form fields.
POSThttps://api.xtartapp.com/image/content-extraction
*Authentication
You must use a Bearer token provided by the dashboard to use for authentication. Add the token to the Authorization header.
Request body
| Name | Type | Required | Max | Description |
|---|---|---|---|---|
| image | File | Yes | - | The image file to analyze. Must be provided as a file in multipart/form-data. |
| contents | string | Yes | 20 items | A JSON string containing an array of content keys and descriptions to extract from the image. Maximum 20 items. Format: '[{"key":"example_key","description":"description text"}]' |
| contents[].key | string | Yes | 25 | The key for the content to extract from the image. |
| contents[].description | string | Yes | 150 | A description of the content to extract. |
Response
| Name | Type | Description |
|---|---|---|
| data | object | An object containing all extracted content with keys matching the input content keys |
| data.<key> | string | The extracted key for the specified content key |
| data.<value> | string | The extracted value about the extracted key |
| metadata | object | Metadata about the image analysis process |
| metadata.cost | number | The cost of the image extraction request |
Errors
{
"error": "string",
"code": "string"
}| HTTP Status | Error Code | Message |
|---|---|---|
| 400 | INVALID_PAYLOAD | Occurs when the payload is invalid. |
| 400 | INVALID_REQUEST | The request is invalid. |
| 400 | IMAGE_CONTENT_EXTRACTION_ERROR | Could not extract content from image | parsing error. |
| 400 | INVALID_IMAGE | The image was not found or is invalid. |
| 400 | HARM_CONTENT | The content is harmful and cannot be processed. |
| 400 | INSUFFICIENT_BALANCE | The user has insufficient balance. |
| 401 | UNAUTHORIZED | The token is invalid. |
| 429 | TOO_MANY_REQUESTS | The request limit has been reached. |