> For the complete documentation index, see [llms.txt](https://masters-india-1.gitbook.io/ksa-e-invoicing-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://masters-india-1.gitbook.io/ksa-e-invoicing-api/generate-einvoice-api/ubl2.1-xml.md).

# UBL2.1 XML

We accept the UBL2.1 XML compliant directly as the input for the generate einvoice API. The xml input needs to be base64 encoded. Here are some attached documents for your reference

* [Standard Invoice](https://bmjft4cif2ly.compat.objectstorage.me-jeddah-1.oraclecloud.com/offline-utility/sample_invoices/xml/Standard_Invoice.xml)
* [Standard Credit Note](https://bmjft4cif2ly.compat.objectstorage.me-jeddah-1.oraclecloud.com/offline-utility/sample_invoices/xml/Standard_Credit_note.xml)
* [Standard Debit Note](https://bmjft4cif2ly.compat.objectstorage.me-jeddah-1.oraclecloud.com/offline-utility/sample_invoices/xml/Standard_Debit_note.xml)
* [Simplified Invoice](https://bmjft4cif2ly.compat.objectstorage.me-jeddah-1.oraclecloud.com/offline-utility/sample_invoices/xml/Simplified_Invoice.xml)
* [Simplified Credit Note](https://bmjft4cif2ly.compat.objectstorage.me-jeddah-1.oraclecloud.com/offline-utility/sample_invoices/xml/Simplified_Credit_note.xml)
* [Simplified Debit Note](https://bmjft4cif2ly.compat.objectstorage.me-jeddah-1.oraclecloud.com/offline-utility/sample_invoices/xml/Simplified_Debit_note.xml)

As part of our responsibilities we will enrich the following elements within the document before sending it to ZATCA

* ProfileID
* UUID
* IssueDate
* IssueTime
* Previous Invoice Hash
* Invoice Counter Value
* Signature (Simplified Document Only)
* QR Code (Simplified Document Only)
* UBL Extensions (Simplified Document Only)

If you want to do a quick test without registering your company within our website you can try out the following [ENV](https://dev-ksa-bk-pagero.mastersindia-einv.com/docs#/Sample%20JSON2UBL%20API/test_ubl_input_api_v1_test_ubl_input__post). Basic test can be done here to see if your document is compliant or not.

## Request Method

POST

## Request Path

```
{{API_URL}}/api/v2/ksa_einvoice/online_service/generate_einvoice/
```

## Request Headers

<table><thead><tr><th>Parameter</th><th width="184">Value</th><th>Description</th></tr></thead><tbody><tr><td>Productid</td><td>einvoicing_global</td><td>Keep as is</td></tr><tr><td>Authorization/MiplApiKey</td><td>api_key/auth token</td><td>Value and header type is mentioned in the Authentication Page</td></tr></tbody></table>

## Request Body

| Parameter | Value | Description                 |
| --------- | ----- | --------------------------- |
| invoice   | ""    | Base64 Encoded XML document |

The response for the API can be found [here](/ksa-e-invoicing-api/generate-einvoice-api/responses.md).
