> For the complete documentation index, see [llms.txt](https://docs.cleartax.in/cleartax-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cleartax.in/cleartax-docs/e-invoicing-api/e-invoicing-api-reference/cleartax-e-invoicing-apis-xml-schema/e-waybills-apis/generate-e-waybill-by-irn.md).

# Generate E-Waybill by IRN

You can use this API to generate the e-waybill using the Invoice Registration Number (IRN).

### Request Method

POST

### Request URL

```
{{HOST}}/einv/v2/eInvoice/ewaybill
```

### Request Headers

<table><thead><tr><th width="238">PARAMETER</th><th>PARAM TYPE</th><th width="150">TYPE</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td>X-Cleartax-Auth-Token</td><td>Header</td><td>String</td><td>Mandatory. The auth token generated from ClearTax user id and password.</td></tr><tr><td>gstin</td><td>Header</td><td>String</td><td>Mandatory. Users GSTIN</td></tr></tbody></table>

### Request Path Params

There are no path parameters for this API.

### Request Query Params

There are no query parameters for this API.

### Request Body

| Parameter   | Data Type | Field Validations                                                                                          | Description                                                                                                                                                              |                   |                             |
| ----------- | --------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------- | --------------------------- |
| Irn         | String    | <p>minLength: 64</p><p>maxLength: 64</p>                                                                   | Mandatory. IRN generated for the invoice.                                                                                                                                |                   |                             |
| TransId     | String    | <p>minLength: 15</p><p>maxLength: 15</p><p>pattern: "(\[0-9]{2}\[0-9A-Z]{13})"</p>                         | Conditional. Transporter GSTIN or CEN (Common Enrollment Number)                                                                                                         |                   |                             |
| TransName   | String    | <p>minLength: 3</p><p>maxLength: 100</p><p>pattern: "^(\[^\\"])\*$"</p>                                    | Optional. Name of the transporter.                                                                                                                                       |                   |                             |
| TransMode   | String    | <p>minLength: 1</p><p>maxLength: 1</p><p>enum: \["1", "2", "3", "4"]</p>                                   | Conditional. Mode of transport (Road-1, Rail-2, Air-3, Ship-4)                                                                                                           |                   |                             |
| Distance    | Number    | <p>minimum: 1</p><p>maximum: 4000</p>                                                                      | Mandatory. Distance between source and destination PIN codes                                                                                                             |                   |                             |
| TransDocNo  | String    | <p>minLength: 1</p><p>maxLength: 15</p><p>pattern: "^(\[a-zA-Z0-9/-]{1,15})$"</p>                          | Optional. Transport Document Number                                                                                                                                      |                   |                             |
| TransDocDt  | String    | <p>minLength: 10</p><p>maxLength: 10</p><p>pattern: "^\[0-3]\[0-9]/\[0-1]\[0-9]/\[2]\[0]\[1-2]\[0-9]$"</p> | Optional. Transport Document Date                                                                                                                                        |                   |                             |
| VehNo       | String    | <p>minLength: 4</p><p>maxLength: 20</p><p>pattern: "^(\[A-Z                                                | a-z                                                                                                                                                                      | 0-9]{4,20})$"</p> | Conditional. Vehicle Number |
| VehType     | String    | <p>minLength: 1, maxLength: 1,</p><p>enum: \["O", "R"],</p>                                                | Conditional. Whether O-ODC or R-Regular                                                                                                                                  |                   |                             |
| ExpShipDtls | Object    | <p><br></p>                                                                                                | Optional. [ExpShipDetails Object.](/cleartax-docs/e-invoicing-api/e-invoicing-api-reference/resources-and-master/e-invoice-object.md#ship-to-details-object)             |                   |                             |
| DispDtls    | Object    | <p><br></p>                                                                                                | Optional. [Dispatch From Details Object](/cleartax-docs/e-invoicing-api/e-invoicing-api-reference/resources-and-master/e-invoice-object.md#dispatch-from-details-object) |                   |                             |

### Response Status Codes

| HTTP Status Code | Description                                                                  |
| ---------------- | ---------------------------------------------------------------------------- |
| 200              | For a successfully processed request (may be a success or validation error). |
| 400              | Bad Request. Invalid JSON Payload                                            |
| 401              | If the user is not authenticated for the operation.                          |
| 403              | If the user is not authorized for the operation.                             |
| 500              | If there are any unhandled exceptions on the Clear side.                     |

### Response Schema

| Parameter    | Data Type | Field Validations | Description                                                                              |
| ------------ | --------- | ----------------- | ---------------------------------------------------------------------------------------- |
| Success      | Boolean   | ‘Y’, ‘N’          | If Success or Failure.                                                                   |
| AckNo        | Number    | NA                | IRN Acknowledgement Number                                                               |
| AckDt        | String    | NA                | IRN Acknowledgement Date                                                                 |
| IRN          | String    | 64 Digits         | Invoice Reference Number                                                                 |
| Status       | String    | Enum: Generated   | Generation Status of EWB                                                                 |
| EwbNo        | Number    | NA                | E-Way bill Number.                                                                       |
| EwbDt        | String    | NA                | E-Way bill generation date and time.                                                     |
| EwbValidTill | String    | NA                | E-Way bill expiry date and time.                                                         |
| info         | List      | NA                | List of Objects. If there will be error, this field will not be present in the response. |

#### Info Object Details

| Parameter | Data Type | Field Validations | Description                                  |
| --------- | --------- | ----------------- | -------------------------------------------- |
| InfCd     | String    | NA                | <p>EWBPPD </p><p>EWB Pin to Pin Distance</p> |
| Desc      | String    | NA                | Pin to Pin calculated distance               |

### Sample Request & Response&#x20;

#### Request&#x20;

```json
[
    {
        "Irn": "1f4f2e175c590658931cca809b6b0880bcb176469cb874ae35d6bc7d5ac68a52",
        "Distance": 0,
        "TransMode": "1",
        "TransId": "12AWGPV7107B1Z1",
        "TransName": "trans name",
        "TransDocDt": "26/10/2023",
        "TransDocNo": "TRAN/DOC/11",
        "VehNo": "KA12ER1234",
        "VehType": "R",
        "ExpShipDtls": {
            "Addr1": "7th block, kuvempu layout",
            "Addr2": "kuvempu layout",
            "Loc": "Banagalore",
            "Pin": 562160,
            "Stcd": "29"
        },
        "DispDtls": {
            "Nm": "ABC company pvt ltd",
            "Addr1": "7th block, kuvempu layout",
            "Addr2": "kuvempu layout",
            "Loc": "Banagalore",
            "Pin": 560027,
            "Stcd": "29"
        }
    }
]
```

#### Response - **Success:**&#x20;

**HTTP Status code - 200**

```json
[
    {
        "TransId": "12AWGPV7107B1Z1",
        "TransName": "trans name",
        "TransMode": "1",
        "Distance": 0,
        "VehNo": "KA12ER1234",
        "VehType": "R",
        "Irn": "49463cfdd39b418b85fa3173a0c2a3d528c2168255b45360221205be2b3904e2",
        "govt_response": {
            "Success": "Y",
            "AckNo": 112310186089002,
            "AckDt": "2023-10-19 15:15:00",
            "Irn": "49463cfdd39b418b85fa3173a0c2a3d528c2168255b45360221205be2b3904e2",
            "Status": "GENERATED",
            "EwbNo": 121010274297,
            "EwbDt": "2023-10-19 15:15:00",
            "EwbValidTill": "2023-10-20 23:59:00",
            "info": [
                {
                    "InfCd": "EWBPPD",
                    "Desc": "Pin-Pin calc distance: 80KM"
                }
            ]
        },
        "ewb_status": "GENERATED"
    }
]
```

**Response - Failure:**

**HTTP Status Code - 200**

```json
[
    {
        "TransId": "12AWGPV7107B1Z1",
        "TransName": "trans name",
        "TransMode": "1",
        "Distance": 0,
        "TransDocNo": "TRAN/DOC/11",
        "TransDocDt": "26/10/2023",
        "VehNo": "KA12ER1234",
        "VehType": "R",
        "Irn": "1f4f2175c590658931cca809b6b0880bcb176469cb874ae35d6bc7d5ac68a52",
        "ExpShipDtls": {
            "Addr1": "7th block, kuvempu layout",
            "Addr2": "kuvempu layout",
            "Loc": "Banagalore",
            "Pin": 562160,
            "Stcd": "29"
        },
        "DispDtls": {
            "Nm": "ABC company pvt ltd",
            "Addr1": "7th block, kuvempu layout",
            "Addr2": "kuvempu layout",
            "Loc": "Banagalore",
            "Pin": 560027,
            "Stcd": "29"
        },
        "govt_response": {
            "Success": "N",
            "Irn": "1f4f2175c590658931cca809b6b0880bcb176469cb874ae35d6bc7d5ac68a52",
            "ErrorDetails": [
                {
                    "error_code": "107",
                    "error_message": "irn : Invalid Invoice Reference Number, should be 64 characters in length. Please correct the IRN and try again.",
                    "error_source": "CLEARTAX"
                }
            ]
        }
    }
]
```

### API Validations

Currently there are no known validations for this API.

### API Constraints

A Maximum of 5 E-Waybills can be generated in an API call.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cleartax.in/cleartax-docs/e-invoicing-api/e-invoicing-api-reference/cleartax-e-invoicing-apis-xml-schema/e-waybills-apis/generate-e-waybill-by-irn.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
