Public REST API
API documentation
Extract English text from JPEG, PNG, and GIF images using Google Cloud Vision. Requests are synchronous and uploads or OCR results are never retained.
https://api.ocr.lelbaba.top
01
Quick start
No API key or authentication header is required.
curl -X POST \
-F "image=@test_image.jpg" \
https://api.ocr.lelbaba.top/extract-text
02
/extract-text
Send one image as multipart/form-data.
Request
| Field | Type | Required | Description |
|---|---|---|---|
image | file | Yes | JPEG, PNG, or GIF image up to 10 MiB. |
Query parameters
| Parameter | Default | Description |
|---|---|---|
normalize | false |
Add cleaned text without changing the raw OCR result. |
metadata | false |
Add safe dimensions, byte size, color mode, and format. |
Success response · 200
{
"success": true,
"text": "extracted text content here",
"confidence": 0.95,
"processing_time_ms": 1234
}
An image containing no readable text is still successful, with an empty
text value and confidence: 0.0.
03
/extract-text/batch
Send one to five repeated images fields. Each image may be 10 MiB;
combined image data may not exceed 25 MiB. Results preserve input order.
curl -X POST \
-F "images=@first.jpg" \
-F "images=@second.png" \
https://api.ocr.lelbaba.top/extract-text/batch
A valid batch returns 200. Each item has its own
success and status_code, so one invalid image does not
discard successful results.
04
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Whether OCR succeeded. |
text | string | Raw text returned by Vision. |
confidence | number | Confidence from 0.0 to 1.0. |
processing_time_ms | integer | Server processing time. |
normalized_text | string | Present when normalization is enabled. |
metadata | object | Present when metadata is enabled. |
05
Error responses
Application errors use one stable JSON envelope.
{
"success": false,
"error": {
"code": "unsupported_image_format",
"message": "Only JPEG, PNG, and GIF images are supported."
},
"processing_time_ms": 3
}
| Status | Possible codes | Meaning |
|---|---|---|
| 400 | malformed_request, invalid_batch, empty_upload | Invalid multipart request, image count, or empty file. |
| 413 | image_too_large, image_dimensions_too_large, batch_too_large, request_too_large | A documented size or dimension limit was exceeded. |
| 415 | unsupported_image_format | Decoded image is not JPEG, PNG, or GIF. |
| 422 | corrupt_image | Image data is corrupt or unreadable. |
| 503 | ocr_unavailable | OCR dependency is temporarily unavailable. |
| 504 | ocr_deadline_exceeded | OCR exceeded its processing deadline. |
| 500 | internal_error | Unexpected sanitized server error. |
/health
Returns {"status":"ok"} without calling the OCR provider.