# Generate/Regenerate Consolidated EWB

You can generate a consolidated EWB by sending a **`POST`** request to E-Invoicing API with the following request headers.

### Request Method

POST

### Request URL

```
{{HOST}}/einv/v1/consolidate-ewaybill/generate?action={{action}}
```

### Request Headers

<table><thead><tr><th width="190.33331298828125">Parameter</th><th>Data Type</th><th>Field Validations</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. <a href="https://docs.cleartax.in/cleartax-for-developers/e-invoicing-api/e-invoicing-api-reference/authentication-token">Know how.</a></td></tr><tr><td>gstin</td><td>Header</td><td>String</td><td>Mandatory. GSTIN number for the user</td></tr></tbody></table>

### Request Path Params

There are no path parameters for this API.

### Request Query Params

<table><thead><tr><th>Parameter</th><th width="185.6666259765625">Data Type</th><th>Field Validations</th><th>Description</th></tr></thead><tbody><tr><td>action</td><td>String</td><td>NA</td><td>Mandatory = GENERATE_CONSOLIDATED_EWB/REGENERATE_CONSOLIDATED_EWB</td></tr></tbody></table>

### Request Body

| Parameter  | Data Type | Field Validations                                                         | Description                            |
| ---------- | --------- | ------------------------------------------------------------------------- | -------------------------------------- |
| VehNo      | Number    | 15 Digits                                                                 | Conditional. Vehicle Number            |
| FromPlace  | String    | 12 Characters                                                             | Mandatory. From Place                  |
| FromState  | Number    | 2 Digits                                                                  | Mandatory. From State Code             |
| TransDocNo | String    | 15 Characters                                                             | Conditional. Transport Document Number |
| TransDocDt | String    | dd/mm/yyyy                                                                | Optional. Transport Document Date      |
| TransMode  | Enum      | <p>[ROAD</p><p>RAIL</p><p>AIR</p><p>SHIP</p><p>IN_TRANSIT]</p><p><br></p> | Mandatory. Transport Mode              |
| EwbNumbers | List      | NA                                                                        | Mandatory,Consolidate E-Way Bills      |

### 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 authorised for the operation.                             |
| 500              | If there are any unhandled exceptions on the Clear side.                     |

### Response Schema

| Parameter             | Data Type | Field Validations | Description                                      |
| --------------------- | --------- | ----------------- | ------------------------------------------------ |
| ConsolidatedEwbNumber | Number    | 12 Digits         | Consolidated E-Way Bill number                   |
| EwbNumbers            | List      | NA                | List of EWB which has been consolidated          |
| ConsolidateEwbDate    | String    | NA                | Date and time at which the EWB was consolidated. |

#### Errors Object

| Parameter      | Data Type | Field Validations | Description                                                                |
| -------------- | --------- | ----------------- | -------------------------------------------------------------------------- |
| error\_code    | Number    | NA                | Error Code. If there is no error, then this field will not be present.     |
| error\_message | String    | NA                | Error message. If there is no error, then this field will not be present.  |
| error\_source  | String    | NA                | Error Source. If there is no error, then this field will not be present.   |

### Sample Request and Response

#### Request

```json
{
    "VehNo": "KA12AB123",
    "FromPlace": "BANGALORE SOUTH",
    "FromState": 29,
    "TransDocNo": "1234",
    "TransDocDt": "12/10/2017",
    "TransMode": "AIR",
    "EwbNumbers": [
        181009088610,
        171009088617
    ]
}
```

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

**HTTP Status Code - 200**

```json
{
    "ConsolidatedEwbNumber": "1810000387",
    "EwbNumbers": [
        "111000609282",
        "181000609270"
    ],
    "ConsolidateEwbDate": "15/12/2017 10:27:00 AM"
}
```

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

**HTTP Status Code - 200**

```json
{
    "errors": {
        "error_code": "7001",
        "error_message": "Invalid Vehicle Number, Vehicle number length should be between 7 and 15 ",
        "error_source": "CLEARTAX"
    }
}
```

### API Validations

Currently there are no known validations for this API.

### API Constraints

1. EWB can be added to the CEWB if the generator of CEWB is a generator or the assigned transporter of the e-way bill.
2. EWB can be added to the CEWB only if the e-way bill is active and within the validity, that is, EWB is not cancelled or not expired.
