๐Ÿ”Generator

Generate a QR Code

GET https://api.night-api.com/images/qrcode

Headers

NameTypeDescription

authorization*

String

Your API key

Request Body

NameTypeDescription

backgroundDimming

String

Color of the dimming mask above the background image.

logoImage

String

Logo image to be displayed at the center of the QR code.

Accepts a data: string in web browsers or a Buffer in Node.js.

When set to undefined or null, the logo is disabled.

logoCornerRadius

Number

Corner radius of the logo image in pixels.

backgroundImage

String

Background image to be used in the QR code.

Accepts a data: string in web browsers or a Buffer in Node.js.

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*

String

Text to be encoded in the QR code.

{
  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
    ]
  }
}

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

  • text Required

  • size

  • colorDark

  • colorLight

  • autoColor

  • backgroundImage

  • backgroundDimming

  • logoImage

  • logoCornerRadius

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

// 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"
})

Last updated