← Back to Home

📚 API Documentation

Image-to-Text Service API - Complete reference guide

GET Authentication
All API requests require authentication using an API key in the X-API-Key header.

Example:

curl -H "X-API-Key: YOUR_API_KEY" \ http://localhost:8000/me
GET /me
Get information about your current API key, including remaining requests.

Headers

Name Type Required Description
X-API-Key string Yes Your API key

Response (200 OK)

{ "api_key": "hNPC****nSDk", "requests_left": 29, "created_at": "2024-01-15T10:30:00" }

Example:

curl -H "X-API-Key: YOUR_API_KEY" \ http://localhost:8000/me
POST /parse/image
Recognize text from an image or PDF using OCR technology.

Headers

Name Type Required Description
X-API-Key string Yes Your API key
Content-Type string Yes multipart/form-data

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.

Response (200 OK)

{ "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 }

Example with file upload:

curl -X POST http://localhost:8000/parse/image \ -H "X-API-Key: YOUR_API_KEY" \ -F "[email protected]" \ -F "language=eng" \ -F "isOverlayRequired=true"

Example with URL:

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"
ERROR Error Responses
Common error responses you might encounter.

401 Unauthorized

{ "detail": { "error_code": "missing_api_key", "message": "X-API-Key header is required" } }

401 Unauthorized - Invalid Key

{ "detail": { "error_code": "invalid_api_key", "message": "Invalid or inactive API key" } }

413 Payload Too Large

{ "detail": { "error_code": "file_too_large", "message": "File size exceeds 1 MB limit. File size: 1.5 MB" } }

429 Too Many Requests

{ "detail": { "error_code": "quota_exceeded", "message": "API quota exceeded. No requests remaining.", "requests_left": 0 } }
INFO Supported Languages

Use language codes in the language parameter. Use auto for automatic detection.

Code Language Code Language
autoAuto-detectengEnglish
araArabicrusRussian
bulBulgarianspaSpanish
chsChinese SimplifiedfreFrench
chtChinese TraditionalgerGerman
jpnJapaneseitaItalian
korKoreanporPortuguese
polPolishukrUkrainian
turTurkishvnmVietnamese