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.

Base URL https://api.ocr.lelbaba.top

01

Quick start

No API key or authentication header is required.

Terminal
curl -X POST \
  -F "image=@test_image.jpg" \
  https://api.ocr.lelbaba.top/extract-text
Upload limits 10 MiB per image · 40 megapixels decoded · JPEG, PNG, or GIF

02

POST

/extract-text

Send one image as multipart/form-data.

Request

FieldTypeRequiredDescription
imagefileYes JPEG, PNG, or GIF image up to 10 MiB.

Query parameters

ParameterDefaultDescription
normalizefalse Add cleaned text without changing the raw OCR result.
metadatafalse Add safe dimensions, byte size, color mode, and format.

Success response · 200

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

POST

/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.

Terminal
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

FieldTypeDescription
successbooleanWhether OCR succeeded.
textstringRaw text returned by Vision.
confidencenumberConfidence from 0.0 to 1.0.
processing_time_msintegerServer processing time.
normalized_textstringPresent when normalization is enabled.
metadataobjectPresent when metadata is enabled.

05

Error responses

Application errors use one stable JSON envelope.

JSON
{
  "success": false,
  "error": {
    "code": "unsupported_image_format",
    "message": "Only JPEG, PNG, and GIF images are supported."
  },
  "processing_time_ms": 3
}
StatusPossible codesMeaning
400malformed_request, invalid_batch, empty_uploadInvalid multipart request, image count, or empty file.
413image_too_large, image_dimensions_too_large, batch_too_large, request_too_largeA documented size or dimension limit was exceeded.
415unsupported_image_formatDecoded image is not JPEG, PNG, or GIF.
422corrupt_imageImage data is corrupt or unreadable.
503ocr_unavailableOCR dependency is temporarily unavailable.
504ocr_deadline_exceededOCR exceeded its processing deadline.
500internal_errorUnexpected sanitized server error.
GET

/health

Returns {"status":"ok"} without calling the OCR provider.