# Responses

## 200 (OK)

If the Invoice has been successfully inserted in our system. Then you will received the following response

### Schema

| Parameter          | Value                                          | Description                                                                                                                                                 |
| ------------------ | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| success            | True/False                                     | Indicates where the process was successful or not                                                                                                           |
| message            | "Invoice is being processed/Any other message" |                                                                                                                                                             |
| error\_code        | 0                                              | Will be 0 if "success" is True and some other value if "success" is False. Please share the error code to us incase there is a problem with the integration |
| data               | {}                                             | dictionary which contains some of the invoice metadata                                                                                                      |
| data.invoice\_id   | 1                                              | Invoice ID                                                                                                                                                  |
| data.invoice\_uuid | 484fde54-9439-453a-ae33-86b637c43c38           | Invoice UUID                                                                                                                                                |

### Sample Response

```json
{
    "success": true,
    "message": "Invoice is being processed",
    "error_code": 0,
    "data": {
        "invoice_id": "20230619-45017",
        "invoice_uuid": "4284d025-0ca2-43a8-8ae8-ad2d44f4e6a2"
    }
}
```

## 400 Bad Request

If the application has some issues with the pre-processing of the document we will return 400. This could be the following

* Basic issues in the JSON inputs provided
* Issues in constructing the final UBL2.1 document
* Incorrect values in the generated UBL2.1 document
* If the onboarding was incomplete/not done for the taxpayer

## 401 (Permission Error)

If the mandatory headers are not passed then a 401 response will be returned. Additionally if the APIKey used in the system has expired then you will receive a 401 response. Format of the response is not consistent but you can fetch them from the status code and either inform us to renew the APIKey and try again.

## 500 Server Error

If there was an unexpected crash in the system you will receive a server error. If this error is seen please share the response to us and we will investigate from our end and see what the problem could be.

## 503 Service Unavailable

If the server is down and we are unable to process the document then this error would be returned. Normally this should never happen apart from scheduled maintenance phases, but they do happen please let us know.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://masters-india-1.gitbook.io/ksa-e-invoicing-api/generate-einvoice-api/responses.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
