# Generate QR Code (Phase I)

{% hint style="warning" %}
**A new version is available!**

This API is valid only for Phase I requirements of ZATCA. In case you are implementing for Phase II, use the latest [Generate E-Invoice API](/cleartax-docs/e-invoicing-ksa-api/e-invoicing-ksa-api-reference/generating-e-invoice/generate-e-invoice.md) built for Phase II.
{% endhint %}

You can generate the QR code by sending the **POST** request to Generate QR Code API.

#### Request URL

```
https://api-demo.cleartax.com/middle-east/ksa/einvoicing/v1/b2c/qrcode/generate
```

#### Request Headers

```
x-cleartax-auth-token: {{USER_AUTH_TOKEN}}
Content-Type: application/json
owner_id: {{OWNER_ID}}
vat: {{VAT}}
```

<table><thead><tr><th>Parameter</th><th width="150">Data Type</th><th>Field Validations</th><th>Description</th></tr></thead><tbody><tr><td>Accept</td><td>String</td><td>Cannot be empty</td><td>Mandatory. This will always be <br>"application/json".</td></tr><tr><td>gstin</td><td>String</td><td>Cannot be empty</td><td>GSTIN for which you are generating IRN.</td></tr><tr><td>branch</td><td>String</td><td>Should be a valid branch from the user account</td><td>Optional. Branch name (store name) added in the user account which maps to a VAT or Group VAT of the entity.</td></tr><tr><td>X-Cleartax-Auth-Token</td><td>String</td><td>Cannot be empty</td><td>Mandatory. The auth token generated from ClearTax user id and password. <a href="https://docs.cleartax.in/cleartax-for-developers/e-invoicing-api/e-invoicing-api-reference/authentication-token">Know how</a>.   </td></tr><tr><td>Content-Type</td><td>String</td><td>Cannot be empty</td><td>Mandatory. This will always be <br>"application/json".</td></tr></tbody></table>

#### Request Parameters

| Param Name       | Type    | Validation | Description |
| ---------------- | ------- | ---------- | ----------- |
| InvoiceTotalAmt  | Numeric |            |             |
| SellerName       | String  |            |             |
| TimeStampInvoice |         |            |             |
| VatNumber        | Numeric |            |             |
| VatTotalAmt      | Numeric |            |             |

#### Request Payload

```json
{
    "InvoiceTotalAmt": "200",
    "SellerName":"test1" ,
    "TimeStampInvoice": "2021-11-12 20:30:30",
    "VatNumber": 300459803800003,
    "VatTotalAmt": 100
}
```

#### Sample Response

{% code title="Valid Response (200)" %}

```json
{
    "Id": null,
    "QrCode": "iVBORw0KGgoAAAANSUhEUgAAAcIAAAHCAQAAAABUY/ToAAACX0lEQVR4Xu2YUW7jMAxEBfQAOZKvniP5AAVczZCy7FQNu/u32DcfjCTO49dAFtKOv9SzvZ78VpCVICtBVoKsBFkJshJkJchKkJUgK0FW+kfJvaW2/SO2w/IZq9FXV4KEDE0yT0z2cp2RZzcfJGQCV7IpWt3Q4/Z8qDQpVvdpkJDvSR/n6logIaOUpFZ2tUf3zwIJWZLWMLRovERw+iAhw3chFTdp22cEbyUFuYIgbxrB688pbwV5dRckZOgklT49xHvSWjzEY4bf5ZnND/m/pQ8Scir81p4uX15uzDfVMI+VN5CQ3kTvU64sMS1naK4GQUKuyF09/6k0MtcRuc70uTsFCflC9uPwyzCSNksOymmQkCvSm/b9tjpL3G+QkD+Svp4UvCM/hWOQ9JDVX0ZIyJ/IyJf8Aem2Utw8KMpMJCTkgoz0HSN4EbeEorE5m5CQb0nnS6vz3vKvdSiWPoOEfEPq3tJ37nRdytsbDBLS0Objscoyuoe+jH1k+iEhl+ThzKk0J20U+TOWKpCQK3JAhy+v7YQcvEifgrdIHyRkSC5FK3GlT2UqtpsHQUIuSG8crd34fD/panMOD2fzNENChnmQ0ZNVBrvORN5y+C19kJCv2m0dRXj6tdpOGyRk6Jq+kNOn59QsJsddphmQkCsyT249Z+6aw+xENxeQkKFuyJAdjptctqo848RdSMjfkN6OkuQxH+IWZJxBLshYSeencFrUhYT8ibR6z5Rc3ka5z5AgIUOTtL8ryXZ1ea7IZfog1YX8c0FWgqwEWQmyEmQlyEqQlSArQVaCrARZ6b8hvwCUlsiVqwdaxAAAAABJRU5ErkJggg==",
    "RawQrCode": "AQV0ZXN0MQIPMzAwNTIwOTUyNjAwMDAzAxMyMDIxLTExLTE3IDEyOjM2OjAwBAMyMDAFAzEwMA=="
}
```

{% endcode %}


---

# 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://docs.cleartax.in/cleartax-docs/e-invoicing-ksa-api/e-invoicing-ksa-api-reference/generating-e-invoice/generate-qr-code-phase-i.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.
