Read an image and pull out emails, phone numbers, URLs, dates, amounts, PAN and GSTIN

Extracts the text and pulls out structured fields: emails, phone numbers, URLs, dates, amounts, PAN and GSTIN numbers.

Request

POSThttps://ocr-image-to-text.p.apihiver.com/v1/extract-data

Upload the image in the file field (max 25 MB). Instead of a file you can send JSON: {"url": "https://…"} for a public image URL, or {"base64": "…"} — the options below then go in the same JSON object.

*
No file chosen
File. The image file (JPG, PNG, WebP, GIF, BMP or TIFF).
String. OCR language(s), as for /v1/extract.

Parameters and body structure are inherited from this endpoint's definition. Changes here only apply to this test run.

Language
Client
1curl --request POST \
2  --url https://ocr-image-to-text.p.apihiver.com/v1/extract-data \
3  --header 'Accept: application/json' \
4  --header 'X-API-Key: YOUR_API_KEY' \
5  --header 'content-type: multipart/form-data' \
6  --form file=@file.bin \
7  --form lang=eng

Read an image and pull out emails, phone numbers, URLs, dates, amounts, PAN and GSTIN: OCR API — Image to Text reference

Extracts the text and pulls out structured fields: emails, phone numbers, URLs, dates, amounts, PAN and GSTIN numbers. This endpoint is part of the OCR API — Image to Text: Extract text from images and scans in English, Hindi and Marathi, and pull out emails, phone numbers, URLs, PAN and GSTIN.

Example response (200, application/json)

Success.

1{
2  "text": "Invoice from APIHiver\nEmail: [email protected]\n\nPhone: +91 98765 43210",
3  "urls": [],
4  "dates": [],
5  "emails": [
6    "[email protected]"
7  ],
8  "gstins": [],
9  "phones": [
10    "+91 98765 43210"
11  ],
12  "amounts": [],
13  "pan_numbers": []
14}

Errors

  • 400 — A required parameter is missing or a value has the wrong format.
    1{
    2  "error": {
    3    "code": "INVALID_INPUT",
    4    "message": "Provide a file upload, 'url', or 'base64'."
    5  }
    6}

Gateway errors (missing key, no subscription, rate limits) are listed in Error codes.