> ## 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.

# Generate E-Way Bill by IRN

> Generate an E-Way Bill for an e-Invoice by passing the IRN and transportation details.

#### Request body schema

<Card title="View request body schema" icon="code" href="https://raw.githubusercontent.com/in-co-sandbox/in-co-sandbox-docs/refs/heads/main/data/gst/schema/request/e-invoice/generate_e_way_bill.json" arrow="true" horizontal />


## OpenAPI

````yaml api-reference/gst/compliance/openapi.json POST /gst/compliance/e-invoice/tax-payer/invoice/{irn}/e-way-bill
openapi: 3.0.1
info:
  title: compliance
  description: >-
    **GST Compliance API** enables businesses to automate compliance
    requirements like [Taxpayer
    verification](https://developer.sandbox.co.in/reference/search-gstin-api),
    [GSTR
    Filing](https://developer.sandbox.co.in/reference/gst-taxpayer-authentication),
    [Generating
    E-Invoices](https://developer.sandbox.co.in/reference/e-invoice-authentication-api),
    and [E-Way
    Bills](https://developer.sandbox.co.in/reference/e-way-bill-authentication-api).We
    provide these APIs from GSTN-authorised GST Suvidha Providers, handling the
    encryption-decryption and signing so you don't have to handle the
    complexities.
  version: 1.0.0
servers:
  - url: https://api.sandbox.co.in
  - url: https://test-api.sandbox.co.in
security: []
tags:
  - name: Public
  - name: Taxpayer
  - name: Taxpayer Auth
  - name: Returns
  - name: GSTR-1 Documents
  - name: File GSTR-1
  - name: GSTR-2A Documents
  - name: GSTR-2B Document
  - name: File GSTR-3B
  - name: GSTR-4
  - name: File GSTR-9
  - name: Invoice Management System
  - name: GSTR-1A Documents
  - name: File GSTR-1A
  - name: Ledgers
  - name: e-Invoice
  - name: Sales e-Invoices for return period
  - name: Purchase e-Invoices for return period
  - name: Front Office Notices
  - name: Front Office
  - name: AATO
  - name: e-Invoice1
  - name: Authentication
  - name: e-Invoice12
  - name: E-Way Bill
  - name: E-Way Bill1
  - name: Authentication1
  - name: Consignor
  - name: Consolidated E-Way Bill
  - name: Multi-Vehicle Movement
  - name: Consignee
  - name: Transporter
  - name: Consolidated E-Way Bill1
  - name: Multi-vehicle Movement
  - name: Common
paths:
  /gst/compliance/e-invoice/tax-payer/invoice/{irn}/e-way-bill:
    post:
      tags:
        - e-Invoice1
        - E-Way Bill
      summary: Generate E-Way Bill by IRN
      operationId: generateEWayBillByIrn
      parameters:
        - name: irn
          in: path
          description: ''
          required: true
          example: ''
          schema:
            type: string
        - name: authorization
          in: header
          description: >-
            E-Invoice access token. For token-generation steps, refer to the
            [Generate E-Invoice
            Session](/recipes/gst/authentication/generate_e_invoice_session)
            recipe, then pass the token in the authorization header.
          required: true
          example: ''
          schema:
            type: string
        - name: x-source
          in: header
          description: >-
            Specifies the source to access, either primary (NIC 1) or secondary
            (NIC 2)
          required: false
          example: ''
          schema:
            type: string
            enum:
              - primary
              - secondary
            default: primary
            example: primary
        - name: x-proxy
          in: header
          description: >-
            Enables criss-cross operations by routing requests through the
            specified source (e.g., access primary via secondary if primary is
            unavailable)
          required: false
          example: ''
          schema:
            type: string
            enum:
              - primary
              - secondary
            example: secondary
        - name: x-api-version
          in: header
          description: API version
          required: false
          example: ''
          schema:
            type: string
            default: 1.0.0
        - name: x-api-key
          in: header
          description: API key for identification
          required: true
          example: ''
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - Irn
                - Distance
              properties:
                Irn:
                  type: string
                  description: Invoice Reference Number
                Distance:
                  type: integer
                  description: >-
                    Distance between source and destination PIN codes. Pass 0 to
                    auto calculate
                  format: int32
                TransId:
                  type: string
                  description: Transporter number/GSTIN
                TransMode:
                  type: string
                  description: >-
                    Mode of transport. Possible values: 1 - Road, 2 - Rail, 3 -
                    Air, 4 - Ship
                TransName:
                  type: string
                  description: Transporter name
                TrnDocDt:
                  type: string
                  description: Transport Document Date
                TrnDocNo:
                  type: string
                  description: Transport Document Number
                VehNo:
                  type: string
                  description: Vehicle Number
                VehType:
                  type: string
                  description: 'Vehicle type. Possible values: O - ODC, R - Regular'
            examples:
              200 EWB generated (road):
                value:
                  Irn: >-
                    20ba3c6f4945944c9c928369fb3047c6985302b17eaefc42eb8183caa99fde6b
                  Distance: 5
                  TransMode: '1'
                  TransId: 12AWGPV7107B1Z1
                  TransName: trans name
                  TrnDocDt: 01/01/2024
                  TrnDocNo: TRAN/DOC/11
                  VehNo: KA12ER1234
                  VehType: R
                summary: 200 EWB generated (road)
              4002 EWB already generated:
                value:
                  Irn: >-
                    84fb20bc18c8bcae011c106d1b99385c5e668f45b154c4e3bb401c7cfe8f73ed
                  Distance: 5
                  TransMode: '1'
                  TransId: 12AWGPV7107B1Z1
                  TransName: trans name
                  TrnDocDt: 01/01/2024
                  TrnDocNo: TRAN/DOC/11
                  VehNo: KA12ER1234
                  VehType: R
                summary: 4002 EWB already generated
              2302 Status of IRN is not active:
                value:
                  Irn: >-
                    4b6c5d74157759eb327d98c6473a9355ea1bac713a5325d1b9f214d8be15d154
                  Distance: 5
                  TransMode: '1'
                  TransId: 12AWGPV7107B1Z1
                  TransName: trans name
                  TrnDocDt: 01/01/2024
                  TrnDocNo: TRAN/DOC/11
                  VehNo: KA12ER1234
                  VehType: R
                summary: 2302 Status of IRN is not active
              4009 EWB cannot be generated for Services:
                value:
                  Irn: >-
                    163eb2ccf11a941b788508777bf6982415e89f762676c5fd1113b87a149e9dec
                  Distance: 5
                  TransMode: '1'
                  TransId: 12AWGPV7107B1Z1
                  TransName: trans name
                  TrnDocDt: 01/01/2024
                  TrnDocNo: TRAN/DOC/11
                  VehNo: KA12ER1234
                  VehType: R
                summary: 4009 EWB cannot be generated for Services
              200 Distance auto-calculated:
                value:
                  Irn: >-
                    2a501f2edbb9acf3b9e5a027d15c672df077b22648f4a7cc96685473ffc52e4a
                  Distance: 0
                  TransMode: '1'
                  TransId: 12AWGPV7107B1Z1
                  TransName: trans name
                  TrnDocDt: 01/01/2024
                  TrnDocNo: TRAN/DOC/11
                  VehNo: KA12ER1234
                  VehType: R
                summary: 200 Distance auto-calculated
              5002 Invalid distance:
                value:
                  Irn: >-
                    1cc78699fc244f3ec2d1b08defa9c0790ddc25893598c03f44e405619c727b3e
                  Distance: 5000
                  TransMode: '1'
                  TransId: 12AWGPV7107B1Z1
                  TransName: trans name
                  TrnDocDt: 01/01/2024
                  TrnDocNo: TRAN/DOC/11
                  VehNo: KA12ER1234
                  VehType: R
                summary: 5002 Invalid distance
              4038 Distance too high:
                value:
                  Irn: >-
                    1cc78699fc244f3ec2d1b08defa9c0790ddc25893598c03f44e405619c727b3e
                  Distance: 500
                  TransMode: '1'
                  TransId: 12AWGPV7107B1Z1
                  TransName: trans name
                  TrnDocDt: 01/01/2024
                  TrnDocNo: TRAN/DOC/11
                  VehNo: KA12ER1234
                  VehType: R
                summary: 4038 Distance too high
              4012 Transport document number missing:
                value:
                  Irn: >-
                    53a7790a23e0a7f0305f9add298b4f6d059373dc06140da861f095a2fd82334d
                  Distance: 5
                  TransMode: '2'
                  TransId: 12AWGPV7107B1Z1
                  TransName: trans name
                  TrnDocDt: 01/01/2024
                  TrnDocNo: TRAN/DOC/11
                  VehNo: KA12ER1234
                  VehType: R
                summary: 4012 Transport document number missing
              4039 Vehicle cannot be regular in ship mode:
                value:
                  Irn: >-
                    53a7790a23e0a7f0305f9add298b4f6d059373dc06140da861f095a2fd82334d
                  Distance: 5
                  TransMode: '4'
                  TransId: 12AWGPV7107B1Z1
                  TransName: trans name
                  TrnDocDt: 01/01/2024
                  TrnDocNo: TRAN/DOC/11
                  VehNo: KA12ER1234
                  VehType: R
                summary: 4039 Vehicle cannot be regular in ship mode
              4020 Invalid vehicle type:
                value:
                  Irn: >-
                    53a7790a23e0a7f0305f9add298b4f6d059373dc06140da861f095a2fd82334d
                  Distance: 5
                  TransMode: '1'
                  TransId: 12AWGPV7107B1Z1
                  TransName: trans name
                  TrnDocDt: 01/01/2024
                  TrnDocNo: TRAN/DOC/11
                  VehNo: KA12ER1234
                  VehType: S
                summary: 4020 Invalid vehicle type
              200 EWB generated (ship):
                value:
                  Irn: >-
                    40628c00eeb05d682e11551105deabc9018d886418afe1dcbd9fcb3f8783e4db
                  Distance: 5
                  TransMode: '4'
                  TransId: 12AWGPV7107B1Z1
                  TransName: trans name
                  TrnDocDt: 01/01/2024
                  TrnDocNo: TRAN/DOC/11
                  VehNo: KA12ER1234
                  VehType: O
                summary: 200 EWB generated (ship)
      responses:
        '200':
          description: >-
            4002 EWB already generated / 2302 Status of IRN is not active / 200
            EWB generated (road) / 4009 EWB cannot be generated for Services /
            200 Distance auto-calculated / 5002 Invalid distance / 4038 Distance
            too high / 4012 Transport document number missing / 4039 Vehicle
            cannot be regular in ship mode / 4020 Invalid vehicle type / 200 EWB
            generated (ship)
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: number
                    example: 200
                  data:
                    type: object
                    properties:
                      Data:
                        type: object
                        properties: {}
                        nullable: true
                        example: null
                      ErrorDetails:
                        type: array
                        items:
                          type: object
                          properties:
                            ErrorCode:
                              type: string
                              example: '4002'
                            ErrorMessage:
                              type: string
                              example: EwayBill is already generated for this IRN
                        nullable: true
                        example:
                          - ErrorCode: '4002'
                            ErrorMessage: EwayBill is already generated for this IRN
                      InfoDtls:
                        type: array
                        items:
                          type: object
                          properties:
                            InfoCode:
                              type: string
                            InfoMessage:
                              type: string
                        nullable: true
                        example: null
                      Status:
                        type: number
                        example: 0
                  timestamp:
                    type: number
                    example: 1763446641000
                  transaction_id:
                    type: string
                    example: 21f0d4c6-678b-473c-84f4-3c8849a08f1f
              examples:
                200 EWB generated (road):
                  summary: 200 EWB generated (road)
                  value:
                    code: 200
                    data:
                      Data:
                        EwbDt: '2024-02-22 17:23:00'
                        EwbNo: 171010315489
                        EwbValidTill: '2024-02-23 23:59:00'
                      ErrorDetails: null
                      InfoDtls: null
                      Status: 1
                    timestamp: 1763446641000
                    transaction_id: 9c7edb84-888a-4117-b743-1ab7fd687e45
                4002 EWB already generated:
                  summary: 4002 EWB already generated
                  value:
                    code: 200
                    data:
                      Data: null
                      ErrorDetails:
                        - ErrorCode: '4002'
                          ErrorMessage: EwayBill is already generated for this IRN
                      InfoDtls: null
                      Status: 0
                    timestamp: 1763446641000
                    transaction_id: 21f0d4c6-678b-473c-84f4-3c8849a08f1f
                2302 Status of IRN is not active:
                  summary: 2302 Status of IRN is not active
                  value:
                    code: 200
                    data:
                      Data: null
                      ErrorDetails:
                        - ErrorCode: '2302'
                          ErrorMessage: Status of the IRN is not active
                      InfoDtls: null
                      Status: 0
                    timestamp: 1763446641000
                    transaction_id: a6e68a3e-6282-404b-be0b-abded7e81c69
                4009 EWB cannot be generated for Services:
                  summary: 4009 EWB cannot be generated for Services
                  value:
                    code: 200
                    data:
                      Data: null
                      ErrorDetails:
                        - ErrorCode: '4009'
                          ErrorMessage: >-
                            E Way Bill can be generated provided at least HSN of
                            one item belongs to goods.
                      InfoDtls: null
                      Status: 0
                    timestamp: 1763446641000
                    transaction_id: 7f5fa478-040b-4138-a2b4-2090a8d1173a
                200 Distance auto-calculated:
                  summary: 200 Distance auto-calculated
                  value:
                    code: 200
                    data:
                      Data:
                        EwbDt: '2024-02-22 17:50:00'
                        EwbNo: 101010315529
                        EwbValidTill: '2024-02-23 23:59:00'
                      ErrorDetails: null
                      InfoDtls:
                        - Desc: 'Pin-Pin calc distance: 57KM'
                          InfCd: EWBPPD
                      Status: 1
                    timestamp: 1763446641000
                    transaction_id: 15af04d4-6d42-4161-aa88-07d01046780b
                5002 Invalid distance:
                  summary: 5002 Invalid distance
                  value:
                    code: 200
                    data:
                      Data: null
                      ErrorDetails:
                        - ErrorCode: '5002'
                          ErrorMessage: The field Distance must be between 0 and 4000.
                      InfoDtls: null
                      Status: 0
                    timestamp: 1763446641000
                    transaction_id: 612dabcb-0d33-490b-88c0-a15062385c87
                4038 Distance too high:
                  summary: 4038 Distance too high
                  value:
                    code: 200
                    data:
                      Data: null
                      ErrorDetails:
                        - ErrorCode: '4038'
                          ErrorMessage: The distance between the pincodes given is too high
                      InfoDtls: null
                      Status: 0
                    timestamp: 1763446641000
                    transaction_id: b38aba95-9ac0-4cea-b586-1b429ee2b8b9
                4012 Transport document number missing:
                  summary: 4012 Transport document number missing
                  value:
                    code: 200
                    data:
                      Data: null
                      ErrorDetails:
                        - ErrorCode: '4012'
                          ErrorMessage: >-
                            The transport document number should be passed for
                            transportation modes air and rail
                      InfoDtls: null
                      Status: 0
                    timestamp: 1763446641000
                    transaction_id: 5151daea-1911-45a0-9e4a-b53625c1f088
                4039 Vehicle cannot be regular in ship mode:
                  summary: 4039 Vehicle cannot be regular in ship mode
                  value:
                    code: 200
                    data:
                      Data: null
                      ErrorDetails:
                        - ErrorCode: '4020'
                          ErrorMessage: Invalid vehicle type .
                        - ErrorCode: '4039'
                          ErrorMessage: >-
                            Vehicle type can not be regular when transport mode
                            is ship
                      InfoDtls: null
                      Status: 0
                    timestamp: 1763446641000
                    transaction_id: 32a53c6f-945b-4b0f-a4ba-a7b6c802d647
                4020 Invalid vehicle type:
                  summary: 4020 Invalid vehicle type
                  value:
                    code: 200
                    data:
                      Data: null
                      ErrorDetails:
                        - ErrorCode: '4020'
                          ErrorMessage: Invalid vehicle type .
                      InfoDtls: null
                      Status: 0
                    timestamp: 1763446641000
                    transaction_id: 433b0447-6b99-4549-a815-c9ba37f33850
                200 EWB generated (ship):
                  summary: 200 EWB generated (ship)
                  value:
                    code: 200
                    data:
                      Data:
                        EwbDt: '2024-02-22 17:56:00'
                        EwbNo: 121010315538
                        EwbValidTill: '2024-02-23 23:59:00'
                      ErrorDetails: null
                      InfoDtls: null
                      Status: 1
                    timestamp: 1763446641000
                    transaction_id: 90ca463c-71b1-426f-9c12-cdcd6e1ddcf2
          headers: {}
      deprecated: false
      security: []

````