# E-Invoice & E-WayBills: Cancel IRN

This API is used to cancel IRN.

## URL

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

## Query Parameters

| Name    | Description                  |
| ------- | ---------------------------- |
| `gstin` | It specifies GSTIN of seller |

## Request

### Structure

| Parameter | Data Type   | Type      | Description                                                   |
| --------- | ----------- | --------- | ------------------------------------------------------------- |
| Irn       | String(64)  | Mandatory | Invoice reference number                                      |
| CnlRsn    | String(1)   | Mandatory | Cancel reason<br/> `1`: Duplicate<br/>`2`: Data entry mistake |
| CnlRem    | String(100) | Mandatory | Cancel remarks                                                |

### Sample

```json
{
  "Irn": "34e60bdd02a8bdee4be4a4bc8d510ae0b8cc248b02009e5b875aced4fda57c76",
  "CnlRsn": "2",
  "CnlRem": "Wrong HSN codes reported"
}
```

## Response

### Structure

| Parameter  | Data Type | Description                                     |
| ---------- | --------- | ----------------------------------------------- |
| Success    | Boolean   | `true` in case of success                       |
| Irn        | String    | Invoice reference number which is cancelled     |
| CancelTime | String    | IRN cancellation time<br/>`DD/MM/YYYY HH:MM:SS` |

### Sample – Success

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

```json
{
  "Success": true,
  "Irn": "a5c12dca80e743321740b001fd70953e8738d109865d28ba4013750f2046f229",
  "CancelTime": "29/11/2020 09:34:11"
}
```

### Sample – Failure

If API request fails for some reason, 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"
    }
  ]
}
```