Skip to content

e-Invoice OCR API

New

Read a GST e-invoice and get its IRN, acknowledgement number and date, seller and buyer GSTINs, document details, total value and whether its signed QR code checked out.

Overview

e-Invoice OCR reads an invoice that was reported for GST e-invoicing and returns the registration details printed on it as structured fields. An e-invoice carries more than a commercial invoice: an Invoice Reference Number, an acknowledgement number and date from the invoice registration portal, and a signed QR code. The response returns the IRN, the acknowledgement number and date, the seller and buyer GSTINs, the document number, type and date, the total invoice value, the item count, the main HSN code, and whether the QR code on the document was verified. Reading the document tells you what it claims. To confirm that the IRN was reported, validate it with the e-Invoicing API.

Coverage
Invoices reported for GST e-invoicing in India that print an IRN and signed QR code
Input
An e-invoice image or PDF uploaded by your application
Output
IRN, acknowledgement number and date, seller and buyer GSTINs, document number, type and date, total value, item count, main HSN code and QR result
Typical users
Payables, supply chain finance, GST compliance and logistics teams
Coverage note
Reads the printed e-invoice; confirming the IRN was reported is a separate check

The overview and the sections after the reference are the FinSour API catalog’s own record for this service, rendered unaltered.

Endpoint URL and method

POSThttps://gateway.staging.finsour.io/v1/documents/e-invoice

Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.

Authentication

Scheme API key travels in the X-Api-Key header

Send your API key in this header on every call, from your own server: a key sent from a browser is refused. A key starting fs_test_ calls the sandbox and one starting fs_live_ calls production, at the same address. Create keys in the FinSour console.

Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.

Request parameters

Content type multipart/form-data

Headers

NameTypeRequiredDescriptionConstraints
Idempotency-KeystringRequiredA key you generate for each attempt. Sending the same key again returns the first answer instead of running the check twice; the same key with a different body is refused.8 to 255 characters. Matches ^[A-Za-z0-9._:-]+$
FinSour-VersionstringRequiredSend 2026-11-01 on this call and on every poll to get the receipt and the result described on this page. A call without it is served under 2026-09-01, whose job has a different shape.—

Body

NameTypeRequiredDescriptionConstraints
filefileRequiredThe document to read.—
payloadstring (JSON)OptionalA JSON string carrying the call's options.—
payload.optionsobjectOptionalSettings for this call.—
payload.options.referencestringOptionalYour own reference for this call. It comes back unchanged as meta.reference.1 to 128 characters
payload.options.consentobjectOptionalThe person's consent to this check.—
payload.options.consent.obtainedbooleanRequiredSend true once the person has agreed to the check.Always true
payload.options.consent.atstring (date-time)RequiredWhen the person gave consent.—
payload.options.consent.purposestringRequiredWhat the check is for, for example kyc.1 to 64 characters

Request samples

cURL

curl -X POST https://gateway.staging.finsour.io/v1/documents/e-invoice \
  -H "X-Api-Key: $FINSOUR_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "FinSour-Version: 2026-11-01" \
  -F "file=@<path-to-document>"

Node.js

import { openAsBlob } from "node:fs";

const form = new FormData();
form.append("file", await openAsBlob("<path-to-document>"));

const response = await fetch("https://gateway.staging.finsour.io/v1/documents/e-invoice", {
  method: "POST",
  headers: {
    "X-Api-Key": process.env.FINSOUR_API_KEY,
    "Idempotency-Key": crypto.randomUUID(),
    "FinSour-Version": "2026-11-01",
  },
  body: form,
});

console.log(response.status, await response.json());

Python

import os
import uuid

import requests

response = requests.post(
    "https://gateway.staging.finsour.io/v1/documents/e-invoice",
    headers={
        "X-Api-Key": os.environ["FINSOUR_API_KEY"],
        "Idempotency-Key": str(uuid.uuid4()),
        "FinSour-Version": "2026-11-01",
    },
    files={"file": open("<path-to-document>", "rb")},
    timeout=30,
)

print(response.status_code, response.json())

Generated from the fields above. Replace each value in angle brackets with your own; the key is read from FINSOUR_API_KEY.

Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.

Response schema

Status 202 · content type application/json

NameTypePresentDescriptionConstraints
dataobjectAlwaysThe job that will read the document.—
data.jobIdstringAlwaysThe job's id. Poll GET /v1/jobs/{jobId} with it.Matches ^[0-9A-HJKMNP-TV-Z]{26}$
data.statusstringAlwaysAlways queued: the job is accepted and has not started.Always "queued"

The result

Poll GET /v1/jobs/{jobId}. Once the job has finished, data holds these fields:

NameTypePresentDescriptionConstraints
jobIdstringAlways——
statusstringAlways—One of queued, processing, completed, needs_review, unreadable, failed, expired, cancelled
documentTypestring or nullAlwaysThe kind of document found, once it has been read; null before that.—
confidencenumber or nullAlwaysThe document's confidence, 0 to 1, to two places; null until it has been read.Minimum 0. Maximum 1
fieldsobjectAlwaysWhat was read. Every key is always present: null means the document does not carry it, or it could not be read with enough confidence.—
fields.irnstring or nullAlways——
fields.ackNumberstring or nullAlways——
fields.ackDatestring or nullAlwaysISO date, YYYY-MM-DD (the date the IRP acknowledged the invoice).—
fields.sellerGstinstring or nullAlways——
fields.buyerGstinstring or nullAlways——
fields.documentNumberstring or nullAlways——
fields.documentTypestring or nullAlways——
fields.documentDatestring or nullAlwaysISO date, YYYY-MM-DD; a year or month alone is YYYY or YYYY-MM.—
fields.totalInvoiceValuestring or nullAlwaysDecimal rupees as text, for example "12345.50".—
fields.itemCountinteger or nullAlways——
fields.mainHsnCodestring or nullAlways——
fields.qrVerifiedboolean or nullAlways——
fieldsToReviewarray of stringsAlwaysWhen status is needs_review, the fields a person should confirm; empty otherwise.—
failureReasonstringSometimesPresent only when status is unreadable or failed.One of UNREADABLE_IMAGE, LOW_CONFIDENCE, DOCUMENT_TYPE_MISMATCH, UNSUPPORTED_MEDIA_TYPE, FILE_TOO_LARGE, INPUT_CORRUPT, PAGE_LIMIT_EXCEEDED, TIMEOUT, PROCESSING_ERROR

Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.

Error codes

CodeStatusMeaningRetrying
API_VERSION_UNSUPPORTED400That API version is no longer supported.Do not retry automatically
IDEMPOTENCY_KEY_INVALID400That Idempotency-Key does not meet the required format.Do not retry automatically
IDEMPOTENCY_KEY_REQUIRED400An Idempotency-Key header is required for this request.Do not retry automatically
REQUEST_MALFORMED400The request could not be parsed.Do not retry automatically
AUTH_KEY_EXPIRED401The API key is not valid.Do not retry automatically
AUTH_KEY_INVALID401The API key is not valid.Do not retry automatically
AUTH_KEY_MISSING401No API key was presented.Do not retry automatically
AUTH_KEY_REVOKED401The API key is not valid.Do not retry automatically
INSUFFICIENT_BALANCE402The available balance is not enough for this request.Do not retry automatically
AUTH_IP_NOT_ALLOWED403This API key may not be used from this address.Do not retry automatically
ENTITLEMENT_MISSING403This organization is not entitled to that product in this environment.Do not retry automatically
ORGANIZATION_SUSPENDED403This organization is not active.Do not retry automatically
PRODUCT_NOT_AVAILABLE403That product is not available.Do not retry automatically
PRODUCT_RETIRED403That product has been withdrawn.Do not retry automatically
SCOPE_INSUFFICIENT403This API key does not carry the scope this product requires.Do not retry automatically
PRODUCT_NOT_FOUND404No such product.Do not retry automatically
IDEMPOTENCY_KEY_REUSED409That idempotency key was already used for a different request.Do not retry automatically
PRICE_UNAVAILABLE409No active price covers this product right now.Safe to retry
REQUEST_IN_PROGRESS409An earlier attempt with this key is still running.Safe to retry
SETTLEMENT_PENDING409This request is awaiting reconciliation by an operator.Do not retry automatically
API_VERSION_SUNSET410That API version passed its announced sunset date.Do not retry automatically
REQUEST_TOO_LARGE413The request body is too large.Do not retry automatically
OCR_UNSUPPORTED_MEDIA_TYPE415That document format is not accepted.Do not retry automatically
UNSUPPORTED_MEDIA_TYPE415That content type is not accepted on this route.Do not retry automatically
SANDBOX_FIXTURE_MISSING422No sandbox fixture exists for this input. Use a different test value.Do not retry automatically
UPSTREAM_REJECTED422The upstream source rejected the input.Do not retry automatically
VALIDATION_FAILED422The request payload is invalid.Do not retry automatically
CONCURRENCY_LIMIT429Too many simultaneous requests.Safe to retry
OCR_QUEUE_SATURATED429The document queue is full. Retry shortly.Safe to retry
QUOTA_EXCEEDED429The allowance for this window is spent.Do not retry automatically
RATE_LIMITED429Too many requests.Safe to retry
INTERNAL_ERROR500An unexpected error occurred.Safe to retry
OUTCOME_UNCERTAIN502The outcome of this request is not yet known. Retry with the same Idempotency-Key.Do not retry automatically
UPSTREAM_UNAVAILABLE502The upstream source is unavailable. Retry shortly.Safe to retry
MAINTENANCE_MODE503The service is in a maintenance window.Safe to retry
NO_PROVIDER_AVAILABLE503No provider can serve this product right now.Safe to retry
OCR_UNAVAILABLE503Document reading is unavailable right now. Retry later.Safe to retry
SERVICE_OVERLOADED503The service is shedding load. Retry shortly.Safe to retry
UPSTREAM_TIMEOUT504The upstream source did not respond in time.Safe to retry

Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.

Rate limits

ScopeLimitWindowAt the limit
Your API key, within your organisation's limitThe figure in X-RateLimit-LimitPer minute429 RATE_LIMITED, with Retry-After in seconds. Every answer past authentication carries X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.

Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.

Use cases

  • Accounts payable: capturing the IRN of every supplier e-invoice
  • Supply chain finance: reading the IRN and value of an invoice before financing it
  • GST reconciliation: matching received e-invoices with purchase records
  • Logistics: reading the e-invoice that travels with a consignment
  • Compliance software: flagging invoices whose QR code does not verify

What this service does

  • The registration details

    The IRN, acknowledgement number and acknowledgement date come back as fields, ready to validate with the e-Invoicing API.

  • A QR code check

    The response says whether the signed QR code on the document was verified, so a tampered or mismatched code can be flagged early.

  • The figures that matter

    Seller and buyer GSTINs, document number, type and date, total invoice value, item count and the main HSN code.

  • Read and validate as separate steps

    OCR reports what the document claims. The e-Invoicing API confirms the IRN was reported. Keeping both results lets a reviewer see each one.

How a check runs

  1. Arrange access

    Tell us where e-Invoice OCR fits in your process. We arrange access for your organization under the applicable service contract, which also sets the file formats and sizes you can send.

  2. Upload the e-invoice

    Your application uploads the e-invoice image or PDF and sends a request that names it.

  3. Let the reading run

    The request is accepted with a job reference and read in the background.

  4. Collect the result

    Collect the IRN, acknowledgement, GSTINs, values and QR result by the job reference, with any fields marked for review.

  5. Validate and file

    Validate the IRN with the e-Invoicing API where you need assurance, then file the invoice against its purchase record.

Questions

What is an e-Invoice OCR API?
An interface that reads a GST e-invoice document and returns its IRN, acknowledgement details, GSTINs, document details and total value as structured fields.
Does e-Invoice OCR read the IRN?
Yes. The Invoice Reference Number is returned as a field, together with the acknowledgement number and acknowledgement date printed on the document.
Does it check the QR code?
The response includes whether the signed QR code on the document was verified. It is empty when the document carries no readable QR code.
Does reading an e-invoice prove it was reported?
No. OCR reports what the document claims. Validate the IRN with the e-Invoicing API to confirm the invoice was reported.
Does e-Invoice OCR return line items?
It returns the item count and the main HSN code. For every line item with its quantity, rate and amount, use Invoice OCR.
Do I need consent to read an e-invoice?
An e-invoice is a business document between two registered businesses. Read it for the purpose you received it for, and keep it under your own retention policy.

Catalog entry last updated .