# Get latest E-Waybill status from Government

### Request Method

GET

### Request URL

```
{{HOST}}/einv/v1/ewaybill/sync
```

### Request Headers

| Parameter             | Data Type | Field Validations | Description                          |
| --------------------- | --------- | ----------------- | ------------------------------------ |
| x-cleartax-auth-token | String    | NA                | Mandatory. User auth token.          |
| Gstin                 | String    | NA                | Mandatory. GSTIN number for the user |

### Request Path Params

There are no path parameters for this API.

### Request Query Params

<table><thead><tr><th>Parameter</th><th width="125">Data Type</th><th width="150">Field Validations</th><th>Description</th></tr></thead><tbody><tr><td>ewb_number</td><td>Number</td><td>12 characters</td><td><p>Conditional.</p><p>Required in case of Non - IRN document. </p><p>Optional in case of IRN based EWB(Given the situation where IRN is provided in the query params). </p><p> If EWB is generated on ClearTax then latest status will be fetched from govt. And if EWB is not generated on ClearTax then also the EWB details will be fetched from govt. portal.</p></td></tr><tr><td>irn</td><td>string</td><td>64 characters</td><td>Conditional. Latest status of the E-Way bill will be fetched from the government. If an E-way bill is generated on ClearTax with that IRN otherwise the details will not be fetched.</td></tr></tbody></table>

### Request Body Params

NA

### Response Status Codes

| HTTP Status Code | Description                                                                  |
| ---------------- | ---------------------------------------------------------------------------- |
| 200              | For a successfully processed request (may be a success or validation error). |
| 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                                          |
| -------------------- | ----------------- | -------------------------------------------------------------------- | ---------------------------------------------------- |
| EwbNo                | String            | NA                                                                   | E-Way bill Number.                                   |
| <p><br>EwbStatus</p> | <p><br>String</p> | <p>NA<br></p>                                                        | <p>GENERATED,</p><p>CANCELLED<br></p>                |
| <p><br>EwbDate</p>   | <p><br>String</p> | <p>NA<br></p>                                                        | <p>Date and time of generation of E-Way bill<br></p> |
| UserGstin            | String            | NA                                                                   | Gstin of the User                                    |
| DocumentDate         | String            | NA                                                                   | Invoice Date                                         |
| DocumentType         | String            | NA                                                                   | Document Type                                        |
| DocumentNumber       | Number            | NA                                                                   | Document Number                                      |
| Distance             | Number            | NA                                                                   | Distance                                             |
| ValidUpto            | String            | NA                                                                   | E-Way bill valid up to date and time.                |
| VehicleType          | String            | NA                                                                   | Type of vehicle being used.                          |
| TransactionType      | String            | Enum: Regular, Bill to Ship to, Bill from Dispatch from, Combination | Transaction type.                                    |
| CancelDate           | String            | NA                                                                   | Date and time of cancellation of E-Way bill.         |

### Sample Request and Response

#### Request

There will be no request body for this API.&#x20;

#### Response - Success:

**HTTP Status Code - 200**

```json
{
   "Irn": null,
   "EwbNumber": 171010259385,
   "EwbStatus": "GENERATED",
   "EwbDate": "18/08/2023 07:10:00 PM",
   "GenerateMode": "API",
   "UserGstin": "29AAFCD5862R000",
   "DocumentDate": "12/08/2023",
   "DocumentType": "INV",
   "DocumentNumber": "Sd002",
   "TransporterId": "29AAACW6288M1ZH",
   "TransporterName": "TRANSPORT",
   "Distance": 315,
   "NoValidDays": 2,
   "ValidUpto": "20/08/2023 11:59:00 PM",
   "ExtendedTimes": 0,
   "RejectStatus": "N",
   "VehicleType": "REGULAR",
   "TransactionType": "Combination",
   "SupplyType": "OUTWARD",
   "SubSupplyType": "SUPPLY",
   "FromGstin": "29AAFCD5862R000",
   "FromTrdName": "NIC Industries",
   "FromAddr1": "322  323 THIRUVALLUVAR NAGAR",
   "FromAddr2": "2nd cross, apavu nagar",
   "FromPlace": "Hosur",
   "FromPincode": 635109,
   "FromStateCode": 29,
   "ActFromStateCode": 33,
   "ToGstin": "29AWGPV7107B1Z1",
   "ToTrdName": "XYZ Industries",
   "ToAddr1": "322  323 THIRUVALLUVAR NAGAR NEELI",
   "ToAddr2": null,
   "ToPlace": "COIMBATORE",
   "ToPincode": 641033,
   "ToStateCode": 29,
   "ActToStateCode": 33,
   "OtherValue": 0.000,
   "TotalValue": 100.000,
   "CgstValue": 9.000,
   "SgstValue": 9.000,
   "IgstValue": 0.000,
   "CessValue": 0.000,
   "CessNonAdvolValue": 0.000,
   "TotalInvoiceValue": 118.000,
   "Items": [
       {
           "ProductName": "Rice",
           "ProductDesc": "test",
           "HsnCode": "1001",
           "Quantity": 1.000,
           "QtyUnit": "BAG",
           "CgstRate": 9.000,
           "CgstAmount": null,
           "SgstRate": 9.000,
           "SgstAmount": null,
           "IgstRate": 0.000,
           "IgstAmount": null,
           "CessRate": 0.000,
           "CessAdvol": null,
           "CessNonadvolRate": null,
           "CessNonadvol": 0.000,
           "TaxableAmount": 100.000
       }
   ],
   "MultiVehicleGroups": [
       {
           "GroupNumber": 0,
           "FromPlace": null,
           "FromState": null,
           "ToPlace": null,
           "ToState": null,
           "ReasonCode": null,
           "ReasonRemark": null,
           "TransportMode": null,
           "TotalQuantity": null,
           "UnitOfMeasurement": null,
           "VehicleDetails": [
               {
                   "UpdateMode": "API",
                   "VehicleNumber": "MH45YY2356",
                   "FromPlace": "Bangalore",
                   "FromState": 29,
                   "TripSheetNumber": 0,
                   "UserGSTINTransin": "29AAFCD5862R000",
                   "EnteredDate": "18/08/2023 07:10:00 PM",
                   "TransportDocumentNumber": "TD-2",
                   "TransportDocumentDate": "12/08/2023",
                   "Quantity": null,
                   "TransportMode": "ROAD"
               }
           ]
       }
   ],
   "CancelDate": null,
   "Remarks": null,
   "Alert": null,
   "InfoDetails": null,
   "ErrorList": null
}
```

#### Response - Failure:&#x20;

**HTTP Status Code - 200**

```json
{
   "Irn": null,
   "EwbNumber": null,
   "EwbStatus": null,
   "EwbDate": null,
   "GenerateMode": null,
   "UserGstin": null,
   "DocumentDate": null,
   "DocumentType": null,
   "DocumentNumber": null,
   "TransporterId": null,
   "TransporterName": null,
   "Distance": null,
   "NoValidDays": null,
   "ValidUpto": null,
   "ExtendedTimes": null,
   "RejectStatus": null,
   "VehicleType": null,
   "TransactionType": null,
   "SupplyType": null,
   "SubSupplyType": null,
   "FromGstin": null,
   "FromTrdName": null,
   "FromAddr1": null,
   "FromAddr2": null,
   "FromPlace": null,
   "FromPincode": null,
   "FromStateCode": null,
   "ActFromStateCode": null,
   "ToGstin": null,
   "ToTrdName": null,
   "ToAddr1": null,
   "ToAddr2": null,
   "ToPlace": null,
   "ToPincode": null,
   "ToStateCode": null,
   "ActToStateCode": null,
   "OtherValue": null,
   "TotalValue": null,
   "CgstValue": null,
   "SgstValue": null,
   "IgstValue": null,
   "CessValue": null,
   "CessNonAdvolValue": null,
   "TotalInvoiceValue": null,
   "Items": null,
   "MultiVehicleGroups": null,
   "CancelDate": null,
   "Remarks": null,
   "Alert": null,
   "InfoDetails": null,
   "ErrorList": [
       {
           "ErrorCode": "357",
           "ErrorMessage": "Could not retrieve detail. This E-Way Bill Number doesn't belong to your GSTIN or isn't assigned to you for transport.",
           "ErrorSource": "GOVT"
       }
   ]
}
```

### API Validations

Users can pass one of either E-way bill numbers or IRN to fetch the details. Both cannot be passed in the same payload to get the details

### API Constraints

1. Latest E-way bill details can be fetched from the govt. irrespective of whether the E-Way bill was generated on ClearTax or not with the given E-Way bill number. &#x20;
2. Latest status of the E-Way bill will be fetched from the government, if E-way bill is generated on ClearTax with the given IRN otherwise the details cannot be fetched.
