> ## Documentation Index
> Fetch the complete documentation index at: https://developers.getswipe.in/llms.txt
> Use this file to discover all available pages before exploring further.

# E-Invoices

> Generate GST e-invoices with IRN and QR code as part of document creation.

An e-invoice is a GST invoice registered with the government portal, which assigns it an IRN (Invoice Reference Number) and QR code. In the Swipe API, e-invoicing is a flag on [document creation](/api-reference/document-v2/create-a-document) — not a separate endpoint.

## Before you start

<Steps>
  <Step title="Enable the plan">
    E-invoice APIs need the **E-Invoices & EwayBills plan** on your account.
    Mail [api@getswipe.in](mailto:api@getswipe.in) for a trial and integration support.
  </Step>

  <Step title="Connect to the e-invoice portal">
    Open [E-invoices in your dashboard](https://app.getswipe.in/einvoices) and click
    **Connect to E-Invoice Portal**.
  </Step>

  <Step title="Know which government portal you're on">
    By default the API points to the **Government sandbox portal** — generated
    e-invoices aren't legally valid until you switch. Mail
    [api@getswipe.in](mailto:api@getswipe.in) to connect to the production portal.
  </Step>
</Steps>

## Generate an e-invoice

Create the document as usual and set `einvoice: true`. The response then carries the government-issued identifiers alongside the normal document fields:

```json theme={null}
{
  "success": true,
  "message": "Document created successfully",
  "data": {
    "hash_id": "PUlgCNPb",
    "serial_number": "INV-1",
    "irn": "35054cc24d1b3ad27b1b3aabf4966a1ae0d663fdb98f5b2f2fdbd5b0f0d5a133",
    "qr_code": "..."
  }
}
```

For a valid e-invoice the government portal needs correct GST data — the party's `gstin`, item `hsn_code`s, and address state values from [Currencies, States & Countries](/api-reference/reference-data). Portal rejections come back as `PORTAL_ERROR_{code}` — see [Error codes](/api-reference/error-codes).

## Download the PDF

The e-invoice PDF (with its QR code) comes from the standard [Get document PDF](/api-reference/document-v2/get-document-pdf) endpoint using the document's `hash_id`.

## Endpoints

<CardGroup cols={2}>
  <Card title="Create a document" icon="plus" href="/api-reference/document-v2/create-a-document">
    Set `einvoice: true` in the create payload.
  </Card>

  <Card title="Get document PDF" icon="file-pdf" href="/api-reference/document-v2/get-document-pdf">
    Download the e-invoice PDF.
  </Card>
</CardGroup>
