Skip to main content

QR Code Generation API

Welcome to the QR Code Generation API documentation! This guide will help you get started with generating customized QR codes using various parameters.

Quick Start

To generate a QR code, make a GET request to the following endpoint:

https://fetchqr.org/api?YOUR_TEXT_HERE

Replace YOUR_TEXT_HERE with the content you want to encode in the QR code.

QR Code Parameters

Customize your QR code using the following query parameters. Some parameters are optional, and default values are provided.

Parameter NameDescriptionRequired?Default Value
dataContent of the QR code (can be a URL or any other string)Yes
formatFormat of QR code, either png, jpg, jpeg, pdf, or svgNopng
widthWidth of the QR code image in pixelsNo150
heightHeight of the QR code image in pixelsNo150
marginWhitespace around QR code image in pixelsNo4
colorHex color code of "dark" QR grid cells (e.g., #000000)No#000000 (black)
bg_colorHex color code of the QR code background (e.g., #ffffff)No#ffffff (white)
error_correctionError correction level (L, M, Q, H)NoM
imageURL of the image to show in the center. Must be URL-encoded.No
image_sizeCoefficient of the image size (between 0.0 and 1.0)No0.5
image_marginMargin of the image in pixelsNo0
captionCaption text to display below the QR codeNo
caption_font_familyFont family of the caption textNosans-serif
caption_font_sizeFont size of the caption text in pixelsNo10

Customizing QR Code Appearance

  • Colors: Use color and bg_color to set the QR code's foreground and background colors. The color parameter should be a hex color code (e.g., #000000 for black). For a transparent background, set bg_color to #0000.

  • Size and Margin: Adjust the width, height, and margin parameters to control the QR code's dimensions and whitespace around it.

  • Error Correction: Use error_correction to set the level of error correction. Valid values are L, M, Q, and H, with H offering the highest level of correction.

Adding Images to QR Codes

To include an image in the center of your QR code, use the image parameter. Ensure that the URL is URL-encoded.

Example:

 https://fetchqr.org/api?data=Here's%20my%20textimage=https%3A%2F%2Fexample.com%2Fimage.png

You can adjust the image size using the image_size parameter (between 0.0 and 1.0) or specify exact image_width and image_height.

Adding Captions

Add a caption below the QR code using caption, caption_font_family, and caption_font_size parameters.

Example:

 https://fetchqr.org/api?data=abc123&caption=My%20QR%20Code&caption_font_family=mono&caption_font_size=20

Example Requests

Basic QR Code

Generate a QR code with default settings:

 https://fetchqr.org/api?data=Hello%20World

Customized QR Code with Image and Caption

Generate a QR code with a custom color, an embedded image, and a caption:

   https://fetchqr.org/api?data=Custom%20QR%20Code&color=ff0000&bg_color=0000ff&image=https%3A%2F%2Fexample.com%2Flogo.png&image_size=0.5&caption=Your%20Caption&caption_font_size=16

Troubleshooting

  • Image Issues: Ensure the image URL is accessible and properly URL-encoded.
  • Formatting Problems: Verify that all query parameters are correctly formatted.

For more details, refer to the Docusaurus documentation for further customization options and best practices.

Happy coding!