Image-to-Text Service API - Complete reference guide
X-API-Key header.
curl -H "X-API-Key: YOUR_API_KEY" \
http://localhost:8000/me
| Name | Type | Required | Description |
|---|---|---|---|
| X-API-Key | string | Yes | Your API key |
{
"api_key": "hNPC****nSDk",
"requests_left": 29,
"created_at": "2024-01-15T10:30:00"
}
curl -H "X-API-Key: YOUR_API_KEY" \
http://localhost:8000/me
| Name | Type | Required | Description |
|---|---|---|---|
| X-API-Key | string | Yes | Your API key |
| Content-Type | string | Yes | multipart/form-data |
| Name | Type | Required | Description |
|---|---|---|---|
| file | file | No* | Image or PDF file (max 1 MB). Required if url is not provided. |
| url | string | No* | URL of image or PDF (max 1 MB). Required if file is not provided. |
| filetype | string | No | File type: JPG, PNG, PDF, GIF, BMP, TIF, WEBP. Auto-detected if not provided. |
| language | string | No | Language code (eng, rus, auto, etc.). Default: auto |
| isOverlayRequired | boolean | No | Return text coordinates. Default: false |
* Either file or url must be provided.
{
"ParsedResults": [
{
"ParsedText": "Recognized text here...",
"TextOverlay": {
"Lines": [
{
"LineText": "Line of text",
"Words": [
{
"WordText": "Word",
"Left": 10.0,
"Top": 20.0,
"Width": 50.0,
"Height": 30.0
}
]
}
]
}
}
],
"OCRExitCode": 1,
"IsErroredOnProcessing": false,
"ErrorMessage": null
}
curl -X POST http://localhost:8000/parse/image \
-H "X-API-Key: YOUR_API_KEY" \
-F "[email protected]" \
-F "language=eng" \
-F "isOverlayRequired=true"
curl -X POST http://localhost:8000/parse/image \
-H "X-API-Key: YOUR_API_KEY" \
-F "url=https://example.com/image.png" \
-F "filetype=PNG" \
-F "language=auto" \
-F "isOverlayRequired=true"
{
"detail": {
"error_code": "missing_api_key",
"message": "X-API-Key header is required"
}
}
{
"detail": {
"error_code": "invalid_api_key",
"message": "Invalid or inactive API key"
}
}
{
"detail": {
"error_code": "file_too_large",
"message": "File size exceeds 1 MB limit. File size: 1.5 MB"
}
}
{
"detail": {
"error_code": "quota_exceeded",
"message": "API quota exceeded. No requests remaining.",
"requests_left": 0
}
}
Use language codes in the language parameter. Use auto for automatic detection.
| Code | Language | Code | Language |
|---|---|---|---|
| auto | Auto-detect | eng | English |
| ara | Arabic | rus | Russian |
| bul | Bulgarian | spa | Spanish |
| chs | Chinese Simplified | fre | French |
| cht | Chinese Traditional | ger | German |
| jpn | Japanese | ita | Italian |
| kor | Korean | por | Portuguese |
| pol | Polish | ukr | Ukrainian |
| tur | Turkish | vnm | Vietnamese |