# Status Check for Submitted E-Invoice

You can use this API to check the final status of the submitted E-Invoice.

### Request Method

GET

### Request URL

```
{{HOST}}/be/einvoice/v1/documents/{document_id}/status
```

### Request Headers

| Parameter             | Data Type | Field Validations                              | Description                                                                                     |
| --------------------- | --------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| x-cleartax-auth-token | String    | Cannot be empty                                | Mandatory. User auth token.                                                                     |
| x-clear-vat           | String    | Cannot be empty                                | Mandatory. VAT of the entity                                                                    |
| x-clear-branch        | String    | Should be a valid branch from the user account | Optional. Branch name (store name) added in the user account which maps to a VAT of the entity. |
| x-request-id          | UUID      | Should be unique for every request             | Optional. Unique request ID.                                                                    |
| Content-Type          | String    | application/json                               | application/json                                                                                |

### Request Path Params

| Parameter    | Data Type | Field Validations             | Description |
| ------------ | --------- | ----------------------------- | ----------- |
| document\_id | String    | Should be a valid document id | Mandatory   |

### Request Query Params

| Parameter     | Data Type | Field Validations                  | Description    |
| ------------- | --------- | ---------------------------------- | -------------- |
| einvoice-type | ENUM      | Currently, only SALES is supported | Default: SALES |

### Request Body

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

### Response Status Codes

| HTTP Status Code | Description                                                 |
| ---------------- | ----------------------------------------------------------- |
| 200              | For a successful status check                               |
| 400              | For any kind of invalid payload issues                      |
| 401              | If the user is not authenticated for the operation          |
| 403              | If the user is not authorized for the operation             |
| 404              | If the requested document is not present in Clear database. |

### Response Schema

| Parameter    | Data Type | Field Validations                                                                             | Description                                                                                                                                             |
| ------------ | --------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Success      | Boolean   | true/false                                                                                    | Identifies whether the request processing was successful or not                                                                                         |
| DocumentId   | String    | NA                                                                                            | DocumentId generated by ClearTax uniquely identifies the document.                                                                                      |
| Status       | String    | <p>Pending,</p><p>Failed,</p><p>Submitted to exchange network, Delivered to buyer network</p> | <p>Mandatory. Status of Document Processing</p><p><br></p><p>Pending,</p><p>Failed,</p><p>Submitted to exchange network, Delivered to buyer network</p> |
| ErrorDetails | Array     | NA                                                                                            | Optional. List of error objects.                                                                                                                        |

#### Error Details Object

| Parameter    | Data Type | Field Validations | Description                                                                                                      |
| ------------ | --------- | ----------------- | ---------------------------------------------------------------------------------------------------------------- |
| ErrorCode    | String    | Cannot be null    | A code to identify the error. Error codes are published below.                                                   |
| ErrorMessage | String    | Cannot be null    | Human readable error message.                                                                                    |
| ErrorSource  | String    | CLEARTAX          | Source of the error.                                                                                             |
| ErrorPath    | String    | -                 | <p>If it is a validation error of a request data, it will point to the request data field.<br>Example below.</p> |

### Sample Request & Response

#### Request&#x20;

NA

#### Response - Success:

HTTP Status Code: 200  OK

```json
{
    "Success": "true",
    "DocumentId": "686d022e418c8b4e000a1feb",
    "Status": "Delivered to buyer network",
    "ErrorDetails": null
}
```

#### Response - Error:&#x20;

HTTP Status Code: 404

```json
{
    "ErrorDetails": [
        {
            "ErrorCode": "300102",
            "ErrorMessage": "You don't have any data present for the selected Document Details",
            "ErrorSource": "CLEARTAX",
            "Path": null
        }
    ]
}
```

### API Validations

A valid document with {document\_id} in path params should be present.

### API Constraints

1. This API needs to be authenticated with a valid user authentication token. If the auth token is not present or is invalid, the API will return HTTP Status Code 401.
2. If the auth token is valid, but the user does not have the authorization to generate e-invoice for a document, then the API will return HTTP Status Code 403. The user, whose auth token is used, should have an Admin role for the particular TIN used in the request.&#x20;
