FreeQR API Documentation


The FreeQR API allows you to generate customizable QR codes with a variety of options including size, foreground color, and background color. This documentation will guide you through using the API, detailing the available parameters, and providing examples for generating QR codes with specific customizations.


Endpoint

https://freeqr.com/api/v1/

Parameters

  • size (required)
    • Description: Specifies the dimensions of the QR code.
    • Format: widthxheight (e.g., 150x150, 1000x1000 Max)
    • Example: size=300x300

  • color (required)
    • Description: Specifies the foreground color of the QR code.
    • Format: Hex color code without # (e.g., ff0000 for red)
    • Example: color=ff0000

  • bgcolor (optional)
    • Description: Specifies the background color of the QR code. If not provided, the QR code will have a transparent background.
    • Format: Hex color code without # (e.g., ffffff for white)
    • Example: bgcolor=ffffff

  • data (required)
    • Description: Specifies the data to be encoded in the QR code.
    • Format: Any string that needs to be encoded (e.g., Hello World, https://example.com)
    • Example: data=Hello+World

Example URLs

  • Generating a QR code with a transparent background:

    This will generate a 300x300 QR code with red foreground color and a transparent background encoding the data "Hello".

  • https://freeqr.com/api/v1/?size=300x300&color=ff0000&data=Hello

  • Generating a QR code with a white background:

    This will generate a 300x300 QR code with red foreground color and a white background encoding the data "Hello".

  • https://freeqr.com/api/v1/?size=300x300&color=ff0000&bgcolor=ffffff&data=Hello

Usage Instructions

  1. Constructing the URL:
    • Start with the base endpoint: https://freeqr.com/api/v1/
    • Add the required parameters (size, color, data) and optional parameter (bgcolor) as query parameters.
    • Ensure all parameters are correctly formatted and separated by &.

  2. URL Encoding:
    • Ensure that any special characters in the data parameter are URL encoded. For example, spaces should be encoded as + or %20.

  3. Testing the API:
    • Open a web browser or use a tool like curl or Postman to test the API by entering the constructed URL.

Examples

  • Simple QR Code with Red Foreground:

    This will generate a QR code with a red foreground and a transparent background.

    https://freeqr.com/api/v1/?size=300x300&color=ff0000&data=Simple+QR+Code

  • QR Code with Custom Background Color:

    This will generate a QR code with a blue foreground and a light gray background.

    https://freeqr.com/api/v1/?size=400x400&color=0000ff&bgcolor=cccccc&data=Custom+Background

  • QR Code Encoding a URL:

    This will generate a QR code with a green foreground and a transparent background encoding the URL https://example.com.

    https://freeqr.com/api/v1/?size=500x500&color=00ff00&data=https://example.com

Customization

  • Changing the Foreground Color:
    • Modify the color parameter to any valid hex color code.
    • Example: color=ff00ff for magenta.

  • Changing the Background Color:
    • Add or modify the bgcolor parameter to any valid hex color code.
    • Example: bgcolor=000000 for black.

  • Adjusting the Size:
    • Modify the size parameter to the desired dimensions.
    • Example: size=600x600 for a larger QR code.

Error Handling

  • Missing Parameters:

    If any of the required parameters (size, color, data) are missing, the API will return a plain text error message indicating the missing parameters.

    Missing required parameters. Please provide size, color, and data.

  • Invalid Size Format:

    If the size parameter does not follow the widthxheight format, the API will return a plain text error message.

    Invalid size format. Expected format: widthxheight (e.g., 150x150)

Conclusion

The FreeQR API is a simple and flexible tool for generating QR codes with customizable options. By adjusting the URL parameters, you can create QR codes with different sizes, foreground colors, and optional background colors to suit your needs.

Feel free to experiment with different combinations of parameters to generate QR codes that best fit your requirements. If you encounter any issues or have any questions, please refer to the error messages for guidance on correcting the input parameters.