# Generate Einvoice API

**NOTE**: This API expects the user to pass the seller address information as part of input payload. Incase you want us to add the information registered in our server during the onboarding you can follow the page with the input type indicated with "VAT IN URL".&#x20;

The E-invoice endpoint is **async** in fashion i.e you will not get the fully generated invoice in the API response. Once the invoice is passed to us, we will add the document in our worker queue and process then via consumer threads. The reason to do this in a such a way is because of the ZATCA governance mandate to ensure no duplicate ICV and PIH are to be present. In order to obtain the signed invoice you will need to either poll the "Get Invoice Process Status" API or register a callback URL in our system through which we will send the invoice back to your system.

The process of registering a callback is a manual process where you have to contact use and provide the following information

* Domain Name
* Headers to be used (authentication, content-type)
* Suggested API timeout

The response format of the callback API is mentioned in the [Responses](https://masters-india-1.gitbook.io/ksa-e-invoicing-api/generate-einvoice-api/responses) section.

{% content-ref url="generate-einvoice-api/ubl2.1-xml" %}
[ubl2.1-xml](https://masters-india-1.gitbook.io/ksa-e-invoicing-api/generate-einvoice-api/ubl2.1-xml)
{% endcontent-ref %}

{% content-ref url="generate-einvoice-api/ubl2.1-xml-vat-in-url" %}
[ubl2.1-xml-vat-in-url](https://masters-india-1.gitbook.io/ksa-e-invoicing-api/generate-einvoice-api/ubl2.1-xml-vat-in-url)
{% endcontent-ref %}

{% content-ref url="generate-einvoice-api/json" %}
[json](https://masters-india-1.gitbook.io/ksa-e-invoicing-api/generate-einvoice-api/json)
{% endcontent-ref %}

{% content-ref url="generate-einvoice-api/json-vat-in-url" %}
[json-vat-in-url](https://masters-india-1.gitbook.io/ksa-e-invoicing-api/generate-einvoice-api/json-vat-in-url)
{% endcontent-ref %}

{% content-ref url="generate-einvoice-api/responses" %}
[responses](https://masters-india-1.gitbook.io/ksa-e-invoicing-api/generate-einvoice-api/responses)
{% endcontent-ref %}

{% embed url="<https://www.mastersindia.co/contact-us/?products=KSA%20E-Invoice%20APIs>" %}


---

# 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.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.
