# Status Check for Submitted E-Invoice

This API allows you to check the status of your submitted e-invoice to LHDN. It takes the document id as the input and returns the status of the document along with its metadata as part of the response body.

### Request Method

GET

### Request URL

```
{{HOST}}/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-tin           | String    | Cannot be empty                                | Mandatory. TIN 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 TIN 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      | SALES, PURCHASE, SALES\_B2C | Default: SALES |

### Request Body

There will be no request body for this API.

### Sample Request

Request Body

```json
NA
```

### 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    |
| 429              | Too many requests                                  |

### 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>VALID/</p><p>INVALID/</p><p>SUBMITTED/</p><p>NOT\_GENERATED/</p><p>CANCELLED/</p><p>FAILED/</p><p>CONSOLIDATED</p> | <p>Mandatory. Status of Document Processing</p><p><br></p><p>VALID: E-Invoice is generated for the document and is Valid.</p><p>INVALID: E-Invoice has validation errors from LHDN</p><p>SUBMITTED: E-Invoice Generation is in Progress</p><p>NOT\_SUBMITTED: E-Invoice is not submitted for the Document</p> |
| UUID                  | String    | NA                                                                                                                    | Unique document ID in e-Invoice, shared by LHDN for the document                                                                                                                                                                                                                                              |
| LongId                | String    | NA                                                                                                                    | Unique long temporary Id that can be used to query document data anonymously                                                                                                                                                                                                                                  |
| QrCode                | String    | NA                                                                                                                    | QrCode generated by Cleartax using unique longId and UUID.                                                                                                                                                                                                                                                    |
| qrCodePreSignedUrl    | String    | NA                                                                                                                    | URL for QR Code image with link access expiry of 3 days.                                                                                                                                                                                                                                                      |
| InternalId            | String    | NA                                                                                                                    | Internal ID used in submission for the document to LHDN, link document number                                                                                                                                                                                                                                 |
| DateTimeValidated     | DateTime  | NA                                                                                                                    | The date and time when the document passed all validations and moved to the valid state.                                                                                                                                                                                                                      |
| CancelDateTime        | DateTime  | NA                                                                                                                    | Refer to the document cancellation that has been initiated by the taxpayer “issuer” of the document on the system, will be in UTC format                                                                                                                                                                      |
| RejectRequestDateTime | DateTime  | NA                                                                                                                    | Refer to the document rejection request that has been initiated by the taxpayer “receiver” of the document on the system, will be in UTC format                                                                                                                                                               |
| 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    | LHDN, CLEARTAX    | Source of the error.                                                                                             |
| ErrorPath    | String    | NA                | <p>If it is a validation error of a request data, it will point to the request data field.<br>Example below.</p> |

### Sample Response (Success)

HTTP Status Code: 200

Response Body

```json
{
    "ErrorDetails": [],
    "Success": "true",
    "DocumentId": "665f28c2f626dc2cac32abea",
    "Status": "VALID",
    "Uuid": "Y4K7SPNCBE8FAQSCWDEEVHZH10",
    "LongId": "VM9Q54DM9E739A1HWDEEVHZH10tz32Xq1717512387",
    "GovtQrCodeUrl": "https://preprod.myinvois.hasil.gov.my/22ZKQD6WWHJ66P3D8ZYZ6Z3J10/share/ERDBTDJ7BX38RSXZ8ZYZ6Z3J10hGBcLC1722255670",
    "QrCode": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAADMElEQVR4Xu2YW67bMAxEuQPuf5fcAcszdIpEN0D7U4yBWvBNFOm44GsoodF/MyrOla/jwY7xYMd4sGM82DH+N6wiYmYR2dlRGVmZ/GTDjc1TWTWTqGYClZlsuLEKtsZuzOaFlFvJxg0w1gcNwsqYb5y5BzYbWA8+rnTh0R0wkWP/mN0QvIMPR+ot2ISzvo74oayv4x9iO8tQlGV4NpJ52/Rhs0/GZzvVXvhRzPLlow0rBJLScK0r9MLZknS8WFOVU5ZNZ2b2Kk9EY8bozbNIq1Expl4puHr31IE1LYbILp5SUKrtpB8rOh5fKSDJP5L5lLMFW24WUQxFqTrlLJEHVkzmNtoNug1nyRbnoXoDhtHYT/ZnRlCpSZxZH4xY02WQB+WJhENBDpbfVe/ApA3uKhPWlhsh9bw8cGKcGluHBHl2mJJ6pmZMB0dSl03S9x1c0bXPjm1JUpnEl19EHY27sSKKfCYlgIpVpxt2Lya9yPhph7If3fAWn16sKEiWkXGqPLH90rcZoyITfB7YxJ3Gnw8XPFghY0Sjk1ayCW4GN8BK1wEVIhWQvDRrrC5gxIJ6pALwBTkDJcEl6lasSTUxhVSBMpGI6NRmjCxzsSO+Go1oLsiLaXXMJrBUJjHlQx55MaX+glWiMn7d0D9jxJo6pN8Q4j1KKAaYj7L0YPzH4RgvsfBwAP+GvNiMhEM7zSUvCPm2bjdWpHrTjj+FN/Me0Ht4HRhpJraF+QkUnCL8XYAPe7UaeAaLm/RPyTgwPpPwimJ3nUmuyXZM96ekDocnpqoE/tyYBpLB8n3WeoJuxihJTrKRy3yjbHTTWxJujHvU2P3aIaqxgQ3WnBiEcp/0ZnKvAG9hmrFay4MI4wguhW5Wn5KxYNolzSQdd1rHidq1G6MdoxFuw3ndC4izIu3FmICqtcyEuCrChNyPMdvoBlNyriLYfSOGqU0VBq4oxmQ9rsPEi/Hozl57+JJ9Ht5yY9hd9BXCO+kuYWfqfRgdkMY3mkHHhaCTYrgBFkTzqoFkEyeoATPGk9xZ8ATVKLZo6AKMGJYnJrPJJe+Ks/zxYn8cD3aMBzvGgx3jwY7xYMeoX71e3DIZBrOSAAAAAElFTkSuQmCC",
    “qrCodePreSignedUrl”: “https://clr-tax-http.internal.cleartax.co/S7u8NNhG”,
    "InternalId": "TEST-SALES-001",
    "DateTimeValidated": "2024-06-04T14:46:28",
    "CancelDateTime": null,
    "RejectRequestTime": null
}
```

### Sample Response (Error)

HTTP Status Code

200

Response Body

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

### API Validations

1. 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. Each customer is allowed to send a limited number of requests per minute to prevent server overload. If the limit is exceeded, the server will respond with a 429 Too Many Requests status code.
3. 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;
4. Rate Limit: The below rate limits are in line with those applied by LHDN.&#x20;

   **Production - 500 API calls per minute with a burst capacity of 25 API calls**

   **Sandbox - 500 API calls per minute with a burst capacity of 25 API calls**
