▫️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

ParameterTypeDescription

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.

Error Handling

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

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.

Last updated