Documents
Read an invoice or utility bill (OCR)
Upload a tax invoice or utility bill and get the buyer and seller details, GSTINs, line items, totals and bank details as structured fields.
POST
/
v2
/
verify
/
invoice_ocr
Extract address details from an invoice or utility bill
curl --request POST \
--url https://prod.idto.ai/v2/verify/invoice_ocr \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-Key: <api-key>' \
--header 'X-Client-ID: <api-key>' \
--form file=@example-fileconst form = new FormData();
form.append('file', '(binary file of the invoice or bill)');
const options = {
method: 'POST',
headers: {'X-Client-ID': '<api-key>', 'X-API-Key': '<api-key>'}
};
options.body = form;
fetch('https://prod.idto.ai/v2/verify/invoice_ocr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const form = new FormData();
form.append('file', '(binary file of the invoice or bill)');
const options = {
method: 'POST',
headers: {'X-Client-ID': '<api-key>', 'X-API-Key': '<api-key>'}
};
options.body = form;
fetch('https://prod.idto.ai/v2/verify/invoice_ocr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://prod.idto.ai/v2/verify/invoice_ocr"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"X-Client-ID": "<api-key>",
"X-API-Key": "<api-key>"
}
response = requests.post(url, files=files, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://prod.idto.ai/v2/verify/invoice_ocr"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary file of the invoice or bill)\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-ID", "<api-key>")
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://prod.idto.ai/v2/verify/invoice_ocr",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary file of the invoice or bill)\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"X-API-Key: <api-key>",
"X-Client-ID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://prod.idto.ai/v2/verify/invoice_ocr")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Client-ID"] = '<api-key>'
request["X-API-Key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary file of the invoice or bill)\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://prod.idto.ai/v2/verify/invoice_ocr")
.header("X-Client-ID", "<api-key>")
.header("X-API-Key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary file of the invoice or bill)\r\n-----011000010111000001101001--")
.asString();{
"status": "success",
"message": "Invoice details extracted successfully.",
"error_code": null,
"data": {
"document_type": "TAX_INVOICE",
"buyer": {
"address": "12 SAMPLE STREET, SAMPLE AREA, BENGALURU, KARNATAKA-560001",
"contact": "9999999999",
"email": "rahul.sharma@example.com",
"gstin": "29ABCDE1234F1Z5",
"pan": "ABCDE1234F",
"state": "KARNATAKA",
"state_code": "29",
"name": "RAHUL SHARMA"
},
"vendor": {
"address": "12 SAMPLE STREET, SAMPLE AREA, BENGALURU, KARNATAKA-560002",
"contact": "9999999999",
"email": "billing@example.com",
"gstin": "29ABCDE1234F1Z5",
"pan": "ABCDE1234F",
"state": "KARNATAKA",
"state_code": "29",
"name": "SAMPLE VENDOR PRIVATE LIMITED"
},
"invoice_details": {
"invoice_number": "INV-2026-000123",
"invoice_date": "2026-08-01",
"order_reference": "PO-000456"
},
"line_items": [
{
"description": "SAMPLE SERVICE",
"hsn_sac": "998314",
"quantity": "1",
"unit_rate": "1000.00",
"total_amount": "1180.00"
}
],
"totals": {
"cgst": "90.00",
"sgst": "90.00",
"igst": null,
"grand_total": "1180.00",
"amount_in_words": "ONE THOUSAND ONE HUNDRED EIGHTY RUPEES ONLY"
},
"bank_details": {
"account_number": "XXXXXX2333",
"ifsc": "ABCD0123456",
"bank_name": "SAMPLE BANK"
}
},
"billed": true,
"tranx_id": "8f14e45f-ceea-467e-bd93-4a2c11e0a1b2",
"timestamp": "2026-09-14T10:15:30Z"
}Upload the document as
Every value is what is printed on the document. Validate a GSTIN or bank account with the matching verification endpoint before you rely on it.
The second
Questions: Documents FAQ.
Was this page helpful? Email us at tech@idto.ai with the page link.
multipart/form-data in the file field. idto classifies it, rejects document types that cannot prove an address, and returns the parties, invoice details, line items, tax totals and payment details. Use it for address verification and for supplier or merchant onboarding.
Every response has the same shape whichever source serves the call. Branch on error_code, never on status:
error_code: nullwithdata: the document is a tax invoice or utility bill and fields were read. Billed.error_code: "IDTO_202"withdata: null: the file was read but is not an accepted document, or carries no invoice details. Billed.- Any non-2xx response: the check did not complete. Never billed.
Environments
| Environment | Base URL | Notes |
|---|---|---|
| Production | https://prod.idto.ai | Keys from the dashboard after go-live. Billed. |
| Staging | https://dev.idto.ai | Keys on request from your idto account manager. Calls reach live sources, so use identities you are authorised to verify. Staging credits are deducted from your staging account. |
Input rules
| Field | Rule |
|---|---|
file | Required. One file of the invoice or bill, at most 12 MB. Larger uploads return IDTO_503 (413). |
workflow_session_token | Optional. Pass only when the call is part of an idto workflow session. |
Accepted documents
data.document_type | Result |
|---|---|
TAX_INVOICE, UTILITY_BILL | Accepted. Fields returned. |
DELIVERY_CHALLAN, RENT_AGREEMENT, BANK_STATEMENT, OTHER | IDTO_202. data.document_type is set and every other field is null, so you can tell the user what they uploaded. |
Response fields
| Field | Meaning |
|---|---|
data.buyer, data.vendor | Billed party and issuing party: name, address, GSTIN, PAN, state, contact, email. |
data.invoice_details | Invoice number, date and order reference. |
data.line_items | Description, HSN or SAC, quantity, unit rate and total per line. |
data.totals | CGST, SGST, IGST, grand total and amount in words. |
data.bank_details | Account number, IFSC and bank name printed on the document. |
billed | true when this call was charged. |
Retries and duplicate protection
Send anIdempotency-Key header (at most 255 characters) to make retries safe. Replaying the same key with the same body within 48 hours returns the stored first response without a new check or a new charge. The same key with a different body returns IDTO_010 (422). A replay while the first call is still running returns IDTO_004 (409). If the first call returned an error, nothing is stored, so a retry runs the check again.
Errors
| Code | HTTP | Message | Billed |
|---|---|---|---|
IDTO_202 | 200 | The document was read but no invoice details were found on it. Please upload a tax invoice or a utility bill that shows the billing address. | Yes |
IDTO_202 | 200 | This document appears to be a bank statement, which is not accepted for address verification. Please upload a tax invoice or a utility bill. | Yes |
IDTO_001 | 400 | Invalid input. Please check the request and try again. | No |
IDTO_503 | 413 | The image could not be processed. Please try a clearer, smaller image. | No |
IDTO_001 | 422 | Invalid input. Please check the request and try again. (a required field is missing or has the wrong type) | No |
null | 400 | Insufficient credits for this operation. (your idto balance is too low; recharge and retry) | No |
IDTO_004 | 409 | An identical request is already in progress; retry shortly. | No |
IDTO_010 | 422 | Idempotency-Key was already used with a different request body. | No |
IDTO_006 | 429 | Too many requests. Please wait a moment and retry. | No |
IDTO_007 | 500 | Verification could not be completed due to a service configuration issue. Please contact support at tech@idto.ai. | No |
IDTO_008 | 503 | The verification service is facing downtime due to issues from the source. Please drop a mail to tech@idto.ai, and try again later. | No |
IDTO_202 message names the detected type, for example a delivery challan or a rent agreement. IDTO_008 is also returned when the reader is at capacity; retry it, IDTO_004 and IDTO_006 with backoff. Full taxonomy: v2 error codes.
Test scenarios
| Input | Expected error_code | HTTP | Billed |
|---|---|---|---|
| Clear scan of a GST tax invoice | null | 200 | Yes |
| Electricity bill showing the billing address | null | 200 | Yes |
| Bank statement | IDTO_202 | 200 | Yes |
| Photo with no invoice text | IDTO_202 | 200 | Yes |
| File larger than 12 MB | IDTO_503 | 413 | No |
Request without the file part | IDTO_001 | 422 | No |
Was this page helpful? Email us at tech@idto.ai with the page link.
Authorizations
Headers
Make retries of this exact request safe. If the same key is replayed with an identical request body, the original result is returned without re-running the verification or billing again. If the same key is replayed with a different body, the request is rejected with IDTO_010 (422). Omitting this header runs every request as new.
Maximum string length:
255Response
The document was OCR'd for address-verification purposes.
Last modified on December 1, 2026
Extract address details from an invoice or utility bill
curl --request POST \
--url https://prod.idto.ai/v2/verify/invoice_ocr \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-Key: <api-key>' \
--header 'X-Client-ID: <api-key>' \
--form file=@example-fileconst form = new FormData();
form.append('file', '(binary file of the invoice or bill)');
const options = {
method: 'POST',
headers: {'X-Client-ID': '<api-key>', 'X-API-Key': '<api-key>'}
};
options.body = form;
fetch('https://prod.idto.ai/v2/verify/invoice_ocr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const form = new FormData();
form.append('file', '(binary file of the invoice or bill)');
const options = {
method: 'POST',
headers: {'X-Client-ID': '<api-key>', 'X-API-Key': '<api-key>'}
};
options.body = form;
fetch('https://prod.idto.ai/v2/verify/invoice_ocr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://prod.idto.ai/v2/verify/invoice_ocr"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"X-Client-ID": "<api-key>",
"X-API-Key": "<api-key>"
}
response = requests.post(url, files=files, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://prod.idto.ai/v2/verify/invoice_ocr"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary file of the invoice or bill)\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-ID", "<api-key>")
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://prod.idto.ai/v2/verify/invoice_ocr",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary file of the invoice or bill)\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"X-API-Key: <api-key>",
"X-Client-ID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://prod.idto.ai/v2/verify/invoice_ocr")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Client-ID"] = '<api-key>'
request["X-API-Key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary file of the invoice or bill)\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://prod.idto.ai/v2/verify/invoice_ocr")
.header("X-Client-ID", "<api-key>")
.header("X-API-Key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary file of the invoice or bill)\r\n-----011000010111000001101001--")
.asString();{
"status": "success",
"message": "Invoice details extracted successfully.",
"error_code": null,
"data": {
"document_type": "TAX_INVOICE",
"buyer": {
"address": "12 SAMPLE STREET, SAMPLE AREA, BENGALURU, KARNATAKA-560001",
"contact": "9999999999",
"email": "rahul.sharma@example.com",
"gstin": "29ABCDE1234F1Z5",
"pan": "ABCDE1234F",
"state": "KARNATAKA",
"state_code": "29",
"name": "RAHUL SHARMA"
},
"vendor": {
"address": "12 SAMPLE STREET, SAMPLE AREA, BENGALURU, KARNATAKA-560002",
"contact": "9999999999",
"email": "billing@example.com",
"gstin": "29ABCDE1234F1Z5",
"pan": "ABCDE1234F",
"state": "KARNATAKA",
"state_code": "29",
"name": "SAMPLE VENDOR PRIVATE LIMITED"
},
"invoice_details": {
"invoice_number": "INV-2026-000123",
"invoice_date": "2026-08-01",
"order_reference": "PO-000456"
},
"line_items": [
{
"description": "SAMPLE SERVICE",
"hsn_sac": "998314",
"quantity": "1",
"unit_rate": "1000.00",
"total_amount": "1180.00"
}
],
"totals": {
"cgst": "90.00",
"sgst": "90.00",
"igst": null,
"grand_total": "1180.00",
"amount_in_words": "ONE THOUSAND ONE HUNDRED EIGHTY RUPEES ONLY"
},
"bank_details": {
"account_number": "XXXXXX2333",
"ifsc": "ABCD0123456",
"bank_name": "SAMPLE BANK"
}
},
"billed": true,
"tranx_id": "8f14e45f-ceea-467e-bd93-4a2c11e0a1b2",
"timestamp": "2026-09-14T10:15:30Z"
}