# QR Code Generator

## /generate-qrcode

This endpoint accepts a GET request with query parameters including the `url`, `color`, and `pattern`. It generates a QR code based on the provided URL or text, with the specified color and pattern options if provided. If the `color` parameter is provided, it returns the QR code as a PNG image with the specified color. Otherwise, it returns the QR code as a base64-encoded string. If there is an error during the generation process, it returns a 500 error with a corresponding message.

### Query Parameters

| Parameter | Type   | Description                                                                |
| --------- | ------ | -------------------------------------------------------------------------- |
| url       | string | The URL or text to encode into the QR code.                                |
| color     | string | The color of the dark modules in the QR code (optional, default is black). |
| pattern   | number | The QR code pattern (optional).                                            |

### Response

* If `color` parameter is provided, the endpoint returns a PNG image of the generated QR code with the specified color.
* If `color` parameter is not provided, the endpoint returns a base64-encoded string representation of the generated QR code.

### Example

#### Request

GET /generate-qrcode?url=<https://example.com\\&color=%235DE2E7\\&pattern=3>

#### Response

If successful, the response will be a PNG image of the generated QR code with the specified color and pattern.

<figure><img src="/files/K2klsGPECrqlIoBhFUnm" alt=""><figcaption></figcaption></figure>

### Error Handling

* If an error occurs during QR code generation, the endpoint will return a 500 Internal Server Error response with an error message.

{% hint style="info" %}
Please note that the `url` parameter is required, while `color` and `pattern` are optional. If `color` is not specified, default color values will be used. The `pattern` parameter allows you to choose the mask pattern used in the QR code generation process.
{% endhint %}


---

# 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.ziomark.xyz/get-endpoints/qr-code-generator.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.
