# GST Invoice Parser: PDF & Scan to Excel/JSON (GSTIN, HSN) (`rowforge/gst-invoice-parser`) Actor

Extract GSTINs, HSN codes and CGST/SGST/IGST from Indian GST invoice PDFs and scans into Excel, CSV or JSON. Checks that totals add up. $0.02 per invoice.

- **URL**: https://apify.com/rowforge/gst-invoice-parser.md
- **Developed by:** [Rowforge Data](https://apify.com/rowforge) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 invoices parsed

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## GST Invoice Parser: PDF & Scan to Excel/JSON (GSTIN, HSN)

Built for accountants, CA firms, and developers who need to turn Indian GST invoice PDFs and scans into structured Excel, CSV, or JSON data.

### What you get

- **Seller and buyer GSTINs** checked with the official checksum.
- **Taxable value, CGST, SGST, IGST, Cess, and totals**, with a check that they add up.
- **HSN/SAC codes and line items** extracted from the invoice.

Download the results as Excel (XLSX), CSV, or JSON.

### Who it is for

- **Accountants and CA firms** processing client GST invoices.
- **Bookkeepers and accounts teams** who key purchase invoices in by hand for entry into Tally, Excel, or other software.
- **Developers** building Indian accounting or expense apps.

### Price

Price: $0.02 per invoice parsed (plus $0.001 per run start). Error rows are free.

| Volume | Estimated cost |
|---|---|
| 1 invoice | $0.02 |
| 100 invoices in one run | about $2.00 |
| 1,000 invoices in 10 runs | about $20.01 |

Apify's free plan includes $5 of monthly usage, enough for about 250 invoices.

### How to use it

To try it first, run it with the pre-filled sample invoice (a fictitious invoice marked SAMPLE).

1. Put each invoice at a public direct-download link (a link that returns the file itself, not a web page).
2. Paste the links into `urls` (up to 100 per run).
3. Start the run.
4. Open the run's dataset and export it as Excel, CSV, or JSON.

### Use it from your own tools

Pull results directly from the Apify API, or connect this Actor to Google Sheets, Make, Zapier, or n8n using [Apify's integrations](https://docs.apify.com/platform/integrations).

***

### What It Does

- **Comprehensive GST Extraction:** Captures invoice numbers, dates (standardized to ISO YYYY-MM-DD), seller/buyer names, addresses, and GSTINs.
- **GSTIN Validation:** Validates 15-character GSTINs using the official Indian GST base-36 checksum algorithm and resolves state names and 2-digit state codes.
- **Tax Breakdown:** Parses taxable value, CGST, SGST, IGST, Cess, total tax, and grand totals, supporting Indian number formats (e.g. `1,23,456.78`).
- **Automated Consistency Checks:**
  - `taxAddsUp`: Verifies that taxable value + total tax equals grand total (within 1 rupee).
  - `interStateConsistent`: Verifies that IGST is applied for inter-state transactions and CGST + SGST for intra-state transactions.
- **HSN / SAC Codes & Line Items:** Best-effort detection of HSN/SAC codes and item tables.
- **Deterministic & Offline:** Pure rules over OCR/text layers. No LLMs, no external network calls, no hallucinated numbers. Missing fields are `null`.

***

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `urls` | Array of strings | *(Required)* | Direct URLs to invoice files (PDF, PNG, JPG, WEBP, TIFF). Up to 100 files per run. |
| `maxPagesPerFile` | Integer | `5` | Maximum pages to parse per invoice file (clamped between 1 and 20). |
| `includeText` | Boolean | `false` | When true, includes the extracted text of the document as Markdown. |

#### Example Input

```json
{
  "urls": [
    "https://pricewire.dev/tools/samples/gst-invoice-sample.pdf"
  ],
  "maxPagesPerFile": 5,
  "includeText": false
}
```

***

### Output Sample

Each invoice generates one row in the dataset:

```json
{
  "url": "https://example.com/invoices/tax-invoice-101.pdf",
  "status": "ok",
  "error": null,
  "pages": 1,
  "invoice": {
    "invoiceNumber": "INV-2026-0042",
    "invoiceDate": "2026-03-15",
    "seller": {
      "name": "Bharat Electronics Solutions Pvt Ltd",
      "gstin": "27AAACB1234F1Z5",
      "gstinValid": true,
      "stateCode": "27",
      "state": "Maharashtra",
      "address": "42 MG Road, Nariman Point, Mumbai 400021"
    },
    "buyer": {
      "name": "Deccan Tech Services LLP",
      "gstin": "29AABBD5678G1Z8",
      "gstinValid": true,
      "stateCode": "29",
      "state": "Karnataka",
      "address": "100 Feet Road, Indiranagar, Bengaluru 560038"
    },
    "placeOfSupply": "29-Karnataka",
    "currency": "INR",
    "taxableValue": 100000.0,
    "cgst": null,
    "sgst": null,
    "igst": 18000.0,
    "cess": null,
    "totalTax": 18000.0,
    "grandTotal": 118000.0,
    "rates": {
      "igst": 18.0
    },
    "hsnCodes": ["8471"],
    "lineItems": [
      {
        "description": "Enterprise Cloud Server Unit",
        "hsn": "8471",
        "quantity": 1.0,
        "rate": 100000.0,
        "amount": 100000.0
      }
    ],
    "checks": {
      "taxAddsUp": true,
      "interStateConsistent": true
    },
    "confidence": {
      "invoiceNumber": "high",
      "invoiceDate": "high",
      "sellerGstin": "high",
      "buyerGstin": "high",
      "taxableValue": "high",
      "totalTax": "high",
      "grandTotal": "high"
    },
    "warnings": []
  }
}
```

***

### Limits

- **Maximum URLs per run:** 100.
- **Maximum pages per file:** 20 (default 5).
- **Maximum file size:** 25 MB per file.
- **Supported formats:** PDF, PNG, JPG, WEBP, TIFF.
- **URL input only:** Files are read from links; there is no upload box in the input form.

***

### What It Does Not Do

- **No e-invoice IRN or QR verification:** Does not decode or verify cryptographic QR signatures or e-invoice IRNs against the National Informatics Centre (NIC).
- **No GST Portal lookups:** Does not make live network API calls to the GSTN portal to check taxpayer registration or return filing status.
- **No guessing:** Fields that are missing or obscured in the invoice are reported as `null`, never guessed.
- **No handwriting:** Handwritten or very poor scans give null fields, not guesses.

# Actor input Schema

## `urls` (type: `array`):

Direct public URLs to invoice files (PDF with text layer, scanned PDF, PNG, JPG, WEBP, TIFF). Up to 100 files per run.

## `maxPagesPerFile` (type: `integer`):

Maximum number of pages to process per invoice file (safeguard for bulk documents).

## `includeText` (type: `boolean`):

When true, includes the extracted text of the invoice as Markdown in the dataset row.

## Actor input object example

```json
{
  "urls": [
    "https://pricewire.dev/tools/samples/gst-invoice-sample.pdf"
  ],
  "maxPagesPerFile": 5,
  "includeText": false
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset containing structured Indian GST invoice fields extracted from the provided files.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://pricewire.dev/tools/samples/gst-invoice-sample.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("rowforge/gst-invoice-parser").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": ["https://pricewire.dev/tools/samples/gst-invoice-sample.pdf"] }

# Run the Actor and wait for it to finish
run = client.actor("rowforge/gst-invoice-parser").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://pricewire.dev/tools/samples/gst-invoice-sample.pdf"
  ]
}' |
apify call rowforge/gst-invoice-parser --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rowforge/gst-invoice-parser"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/OgFxJdkXucDx53nkg/builds/Z6ZV1KRoF8gIWR6oA/openapi.json
