# E-Invoice & E-WayBills: Generate E-Waybill

This API is used to generate e-waybill for outward and inward supplies where IRN is not required.

## URL

```
POST https://cloud.octagst.com/api/octa/einvoice/generateewaybill?gstin={value}
```

## Query Parameters

| Name    | Description                     | Type      | Value |
| ------- | ------------------------------- | --------- | ----- |
| `gstin` | It specifies GSTIN of requester | Mandatory |

## Request

### Structure

| Parameter         | Data Type     | Type      | Description                                                                                                                                                                                                                                                                       |
| ----------------- | ------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| supplyType        | String(1)     | Mandatory | Supply Type<br/> `O`:Outward Supply<br/> `I`: Inward Supply                                                                                                                                                                                                                       |
| subSupplyType     | String(2)     | Mandatory | Sub Supply Type<br/>`1`: Supply<br/>`2`: Import<br/>`3`: Export <br/>`4`: Job Work <br/>`5`: For Own Use <br/>`6`: Job Work Returns <br/>`7`: Sales Return <br/>`8`: Others <br/>`9`: SKD/CKD <br/>`10`: Line Sales <br/>`11`: Recipient Not Known <br/>`12`: Exhibition or Fairs |
| subSypplyDesc     | String(20)    | Optional  | Sub Supply Description if selected “Others” in subSupplyType                                                                                                                                                                                                                      |
| docType           | String(3)     | Mandatory | Document Type<br/>`INV`: Invoice<br/>`BIL`: Bill of Supply<br/>`BOE`: Bill of Entry<br/> `CHL`: Delivery Challan<br/> `OTH`: Others                                                                                                                                               |
| docNo             | String(16)    | Mandatory | Document No<br/>`A-Z`, `0-9`, `/`, `-`                                                                                                                                                                                                                                            |
| docDate           | String(10)    | Mandatory | Document Date<br/>`DD/MM/YYYY`                                                                                                                                                                                                                                                    |
| fromGstin         | String(15)    | Mandatory | GSTIN of the supplier/consignor                                                                                                                                                                                                                                                   |
| fromTrdName       | String(100)   | Optional  | Legal/Trade Name of supplier/consignor                                                                                                                                                                                                                                            |
| fromAddr1         | String(120)   | Optional  | Address of supplier/consignor - Line 1                                                                                                                                                                                                                                            |
| fromAddr2         | String(120)   | Optional  | Address of supplier/consignor - Line 2                                                                                                                                                                                                                                            |
| fromPlace         | String(50)    | Optional  | Place of supplier/consignor (City/Town/Village)                                                                                                                                                                                                                                   |
| fromPincode       | Number(6)     | Mandatory | Pincode of supplier/consignor                                                                                                                                                                                                                                                     |
| fromStateCode     | Number(2)     | Mandatory | State code of supplier/consignor                                                                                                                                                                                                                                                  |
| actFromStateCode  | Number(2)     | Mandatory | Dispatch from State code of supply                                                                                                                                                                                                                                                |
| toGstin           | String(15)    | Mandatory | GSTIN of the recipient/consignee                                                                                                                                                                                                                                                  |
| toTrdName         | String(100)   | Optional  | Legal/Trade Name of recipient/consignee                                                                                                                                                                                                                                           |
| shipToGstin       | String(15)    | Optional  | GSTIN of Ship To Party                                                                                                                                                                                                                                                            |
| shipToTrdName     | String(100)   | Optional  | Legal/Trade Name of Ship To Party                                                                                                                                                                                                                                                 |
| toAddr1           | String(120)   | Optional  | Address of recipient/consignee - Line 1                                                                                                                                                                                                                                           |
| toAddr2           | String(120)   | Optional  | Address of recipient/consignee - Line 2                                                                                                                                                                                                                                           |
| toPlace           | String(50)    | Optional  | Place of recipient/consignee (City/Town/Village)                                                                                                                                                                                                                                  |
| toPincode         | Number(6)     | Mandatory | Pincode of recipient/consignee                                                                                                                                                                                                                                                    |
| toStateCode       | Number(2)     | Mandatory | State code of recipient/consignee                                                                                                                                                                                                                                                 |
| actToStateCode    | Number(2)     | Mandatory | ShipTo state code of supply                                                                                                                                                                                                                                                       |
| transactionType   | Number(1)     | Mandatory | Document Type<br/>`1`: Regular<br/>`2`: Bill To - Ship To<br/> `3`: Bill From - Dispatch From<br/> `4`: Combinationn of 2 and 3                                                                                                                                                   |
| totalValue        | Number(18,2)  | Optional  | Total taxable value.                                                                                                                                                                                                                                                              |
| otherValue        | Number(18,2)  | Optional  | Other charges                                                                                                                                                                                                                                                                     |
| totInvValue       | Number(18,2)  | Optional  | Total document value                                                                                                                                                                                                                                                              |
| igstValue         | Number(18,2)  | Optional  | Total IGST Amount                                                                                                                                                                                                                                                                 |
| cgstValue         | Number(18,2)  | Optional  | Total CGST Amount                                                                                                                                                                                                                                                                 |
| sgstValue         | Number(18,2)  | Optional  | Total SGST Amount                                                                                                                                                                                                                                                                 |
| cessValue         | Number(18, 2) | Optional  | Total Cess Amount                                                                                                                                                                                                                                                                 |
| cessNonAdvolValue | Number(18,2)  | Optional  | Total Cess Non Advol Amount                                                                                                                                                                                                                                                       |
| transporterId     | String(15)    | Optional  | Transporter Id                                                                                                                                                                                                                                                                    |
| transporterName   | String(100)   | Optional  | Transport Name                                                                                                                                                                                                                                                                    |
| transMode         | String(1)     | Optional  | Transport Mode<br/>`1`: Road<br/>`2`: Rail<br/>`3`: Air<br/>`4`: Ship                                                                                                                                                                                                             |
| transDistance     | Number(4)     | Mandatory | Distance                                                                                                                                                                                                                                                                          |
| transDocNo        | String(15)    | Optional  | Transporter Doc No                                                                                                                                                                                                                                                                |
| transDocDate      | String(10)    | Optional  | Transporter Doc Date<br/>`DD/MM/YYYY`                                                                                                                                                                                                                                             |
| vehicleNo         | String(15)    | Optional  | Vehicle No                                                                                                                                                                                                                                                                        |
| vehicleType       | String(1)     | Optional  | Vehicle Type<br/>`R`: Regular<br/>`O`: Over-Dimensional Cargo (ODC)                                                                                                                                                                                                               |
| **itemList**      | Item[]        | Mandatory | This object contains list of line items.                                                                                                                                                                                                                                          |
| **Item**          | Object        | Mandatory | This object contains details of line item                                                                                                                                                                                                                                         |
| productName       | String(100)   | Optional  | Product name                                                                                                                                                                                                                                                                      |
| productDesc       | String(100)   | Optional  | Product/Item description                                                                                                                                                                                                                                                          |
| hsnCode           | String(8)     | Mandatory | HSN Code                                                                                                                                                                                                                                                                          |
| quantity          | Number(8,2)   | Optional  | Quantity                                                                                                                                                                                                                                                                          |
| qtyUnit           | String(3)     | Optional  | UQC                                                                                                                                                                                                                                                                               |
| taxableAmount     | Number(18,2)  | Mandatory | Item Taxable Value                                                                                                                                                                                                                                                                |
| igstRate          | Number(6,3)   | Optional  | IGST Rate                                                                                                                                                                                                                                                                         |
| cgstRate          | Number(6,3)   | Optional  | CGST Rate                                                                                                                                                                                                                                                                         |
| sgstRate          | Number(6,3)   | Optional  | SGST Rate                                                                                                                                                                                                                                                                         |
| cessRate          | Number(6,3)   | Optional  | Cess Rate                                                                                                                                                                                                                                                                         |
| cessNonadvol      | Number(6,3)   | Optional  | Cess Rate- Nonadvol                                                                                                                                                                                                                                                               |

Please visit NIC eWayBill portal to know about field validations and get masters defined for State Codes, supply type, document types, UQC,
HSN, etc.

[Validations on NIC Portal →](https://docs.ewaybillgst.gov.in/apidocs/version1.03/generate-eway-bill.html#validations)

[State Codes on NIC Portal →](https://docs.ewaybillgst.gov.in/apidocs/state-code.html)

[Master Codes on NIC Portal →](https://docs.ewaybillgst.gov.in/apidocs/master-codes-list.html)

[Supply-Doc Type Mapping on NIC Portal →](https://docs.ewaybillgst.gov.in/apidocs/sub-docType-mapping.html)

### Sample

Request payload should contain the JSON encoded invoice data:

```json
{
  "supplyType": "O",
  "subSupplyType": "1",
  "subSupplyDesc": null,
  "docType": "INV",
  "docNo": "7001-8",
  "docDate": "15/12/2020",
  "fromGstin": "29AKLPM8755F1Z2",
  "fromTrdName": "Galaxy Mobile World Limited",
  "fromAddr1": "2ND CROSS NO 59  19  A",
  "fromAddr2": "GROUND FLOOR OSBORNE ROAD",
  "fromPlace": "Bangalore",
  "fromPincode": 560090,
  "actFromStateCode": 29,
  "fromStateCode": 29,
  "toGstin": "27EHFPS5910D2Z0",
  "toTrdName": "ABC India Limited",
  "toAddr1": "Shree Nilaya",
  "toAddr2": "Dasarahosahalli",
  "toPlace": "Thane",
  "toPincode": 560090,
  "actToStateCode": 27,
  "toStateCode": 27,
  "transactionType": 0,
  "otherValue": 0,
  "totalValue": 5000,
  "igstValue": 900,
  "cgstValue": 0,
  "sgstValue": 0,
  "cessValue": 0,
  "cessNonAdvolValue": 0,
  "totInvValue": 5900,
  "transporterId": "29AASFB9647G1ZU",
  "transporterName": null,
  "transDocNo": null,
  "transMode": "1",
  "transDistance": 1300,
  "transDocDate": null,
  "vehicleNo": "KA271C4869",
  "vehicleType": "R",
  "itemList": [
    {
      "productName": "Delta G10B",
      "productDesc": "Delta 4G Phone with 2M Camera",
      "hsnCode": 851712,
      "quantity": 1,
      "qtyUnit": "NOS",
      "taxableAmount": 5000,
      "igstRate": 18,
      "cgstRate": 0,
      "sgstRate": 0,
      "cessRate": 0,
      "cessNonadvol": 0
    }
  ]
}
```

## Response

Response payload will contain the success status along with eWayBill information.

### Structure

| Parameter    | Data Type | Description                                                                   |
| ------------ | --------- | ----------------------------------------------------------------------------- |
| Success      | Boolean   | `true` in case of success                                                     |
| EwbStatus    | String    | EWB Status<br/>`ACT`: Active<br/>`CNL`: Cancelled                             |
| EwbNo        | String    | e-waybill Number(present only if e-waybill is generated along with e-invoice) |
| EwbTime      | String    | e-waybill generation Date & time<br/>`DD/MM/YYYY HH:MM:SS`                    |
| EwbValidTill | String    | e-waybill validity Date & time <br/>`DD/MM/YYYY HH:MM:SS`                     |
| Errors       | Error[]   | List of errors, will be present only when Success is `false`                  |

#### Error

| Parameter | Data Type | Description   |
| --------- | --------- | ------------- |
| Code      | String    | Error Code    |
| Message   | String    | Error message |

### Sample – Success

```json
{
  "Success": true,
  "EwbStatus": "ACT",
  "EwbNo": "191008688443",
  "EwbTime": "27/11/2020 17:23:45",
  "EwbValidTill": "29/11/2020 17:23:45"
}
```

### Sample – Failure

If the API request fails for some reasons, the response payload will contain the failure status and a list of errors.

```json
{
  "Success": false,
  "Errors": [
    {
      "Code": "ERR_CODE_1",
      "Message": "ERR MESSAGE 1"
    },
    {
      "Code": "ERR_CODE_n",
      "Message": "ERR MESSAGE n"
    }
  ]
}
```