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

# Fetch E-Invoice

> With GST Taxpayer session, E-Invoices generated within the last 6 months can be fetched. This recipe shows the steps to fetch an E-Invoice from GST portal using Invoice Reference Number (IRN).

## 1. Authenticate and Get Taxpayer Session

Before fetching an E-Invoice using the Taxpayer API, you must authenticate and create a taxpayer session. Follow the steps in the [**Generate Taxpayer Session**](https://developer.sandbox.co.in/recipes/gst/authentication/generate_tax_payer_session.md) recipe to obtain a **Taxpayer access token**.

This access token is required for all GST Taxpayer API calls and is valid for 6 hours. Unlike the regular E-Invoice API which can only fetch invoices generated within the last 3 days, the Taxpayer API allows you to fetch E-Invoices generated within the **last 6 months**.

## 2. Fetch E-Invoice by IRN

Once you have the Taxpayer access token, you can fetch an E-Invoice using the [**Get E-Invoice by IRN**](https://developer.sandbox.co.in/api-reference/gst/compliance/endpoints/taxpayer/e-invoice/e_invoice.md) endpoint.

Provide the **Invoice Reference Number (IRN)** as a path parameter. The authenticated taxpayer must be a party in the transaction (either the seller or the buyer) to fetch the E-Invoice.

> **cURL Request**
>
> ```bash theme={null}
> curl --request GET \
>   --url https://api.sandbox.co.in/gst/compliance/tax-payer/e-invoice/1043b7fa87bee9c9d82c6771b64034c247430dbf423ecb7ba28a34e157cf8720 \
>   --header 'accept: application/json' \
>   --header 'authorization: {taxpayer-access-token}' \
>   --header 'x-api-key: xxxxxxxxxxxxxxxxxx' \
>   --header 'x-api-version: 1.0.0'
> ```

When the E-Invoice is fetched successfully, the response will include:

* **IRN** (Invoice Reference Number) - The unique identifier for the E-Invoice
* **SignedInvoice** - The digitally signed invoice in JWT format
* **SignedQRCode** - The signed QR code containing invoice summary details
* **AckDt** - Acknowledgment date
* **AckNo** - Acknowledgment number
* **Status** - Current status of the invoice (e.g., "ACT" for active)

> [!NOTE]
>
> **Important:** This endpoint can fetch E-Invoices that are up to **6 months old**, making it ideal for retrieving invoices that are older than the 3-day limit of the regular E-Invoice API.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.