> For the complete documentation index, see [llms.txt](https://docs.night-api.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.night-api.com/images/utils/qr-code/generator.md).

# Generator

## Generate a QR Code

<mark style="color:blue;">`GET`</mark> `https://api.night-api.com/images/qrcode`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| authorization<mark style="color:red;">\*</mark> | String | Your API key |

#### Request Body

| Name                                   | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                    |
| -------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| backgroundDimming                      | String  | Color of the dimming mask above the background image.                                                                                                                                                                                                                                                                                                                                                          |
| logoImage                              | String  | <p>Logo image to be displayed at the center of the QR code.</p><p></p><p><em>Accepts a <code>data:</code> string in web browsers or a Buffer in Node.js.</em></p><p></p><p><em><strong>When set to</strong><strong> </strong><strong><code>undefined</code></strong><strong> </strong><strong>or</strong><strong> </strong><strong><code>null</code></strong><strong>, the logo is disabled.</strong></em></p> |
| logoCornerRadius                       | Number  | Corner radius of the logo image in pixels.                                                                                                                                                                                                                                                                                                                                                                     |
| backgroundImage                        | String  | <p>Background image to be used in the QR code.</p><p><em>Accepts a <code>data:</code> string in web browsers or a Buffer in Node.js.</em></p>                                                                                                                                                                                                                                                                  |
| autoColor                              | Boolean | Automatically calculate the *colorDark* value from the QR code's background.                                                                                                                                                                                                                                                                                                                                   |
| colorLight                             | String  | Color of the empty areas on the QR code.                                                                                                                                                                                                                                                                                                                                                                       |
| colorDark                              | String  | Color of the blocks on the QR code.                                                                                                                                                                                                                                                                                                                                                                            |
| size                                   | Number  | Size of the QR code in pixel.                                                                                                                                                                                                                                                                                                                                                                                  |
| text<mark style="color:red;">\*</mark> | String  | Text to be encoded in the QR code.                                                                                                                                                                                                                                                                                                                                                                             |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  status: 200,
  content: {
    type: 'Buffer',
    data: [
      137,  80,  78,  71,  13,  10,  26,  10,   0,   0,   0,  13,
       73,  72,  68,  82,   0,   0,   1, 244,   0,   0,   1, 244,
        8,   6,   0,   0,   0, 203, 214, 223, 138,   0,   0,   0,
        6,  98,  75,  71,  68,   0, 255,   0, 255,   0, 255, 160,
      189, 167, 147,   0,   0,  32,   0,  73,  68,  65,  84, 120,
      156, 236, 221, 121, 120,  85, 245, 157,  63, 240, 247,  57,
      231, 174, 185, 185, 217,  73,  66,  54,  18, 194, 190, 133,
       69, 109,   1, 177, 173,  27,  34,  83,  28, 117, 164, 237,
       60,  51, 173, 117,
      ... 17703 more items
    ]
  }
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "status": 400,
    "content": "Invalid Key"
}
```

{% endtab %}
{% endtabs %}

**List of available parameters to put in the body or in the module function**

* text <mark style="color:red;">**Required**</mark>
* size
* colorDark
* colorLight
* autoColor
* backgroundImage
* backgroundDimming
* logoImage
* logoCornerRadius

```javascript
const axios = require("axios");
const { writeFileSync } = require("fs");

axios.get('https://api.night-api.com/images/qrcode', {
    headers: {
        authorization: "Your API token"
    },
    data: {
        text: "https://night-api.com/"
    }
})
.then(function (res) {
    writeFileSync(`${__dirname}/qrcode.png`, Buffer.from(res.data.content, 'base64'));
    console.log(res.data);
})
```

Or with the module

```javascript
// Return: Promise

const { NightAPI } = require('night-api');
const api = new NightAPI('YOUR_API_KEY');

const qrcode = await api.qrcode.generate({
    text: "https://night-api.com"
})
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.night-api.com/images/utils/qr-code/generator.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
