QRCodeForge

API Documentation

Programmatically generate QR codes with ease.

Introduction
The QRCodeForge API provides a simple GET endpoint to generate QR codes on the fly. You can create standard QR codes or embed a custom image in the center. The API is designed to be straightforward, requiring no authentication.
Endpoint

The API has a single endpoint for all QR code generation:

GET /api/generate-qr

The base URL for the API endpoint is your application's domain.

Query Parameters
Customize your QR code by passing the following query parameters in the URL.
ParameterTypeRequiredDescription
urlstring
Yes
The URL or text data to be encoded in the QR code. Must be URL-encoded.
imageUrlstring
No
A direct, public URL to an image (PNG, JPEG) to embed in the center of the QR code. Must be URL-encoded.
Usage Examples
Here’s how you can use the API with cURL and JavaScript.

1. Generate a Simple QR Code

This example generates a QR code for "https://example.com".

cURL

curl -o qrcode.png "https://your-app-url.com/api/generate-qr?url=https%3A%2F%2Fexample.com"

JavaScript (Fetch API)

fetch('https://your-app-url.com/api/generate-qr?url=https%3A%2F%2Fexample.com')
  .then(response => response.blob())
  .then(blob => {
    const url = URL.createObjectURL(blob);
    // Use this URL in an <img> tag or download it
    console.log(url);
  });

2. Generate a QR Code with an Embedded Image

This example embeds the Firebase logo into the QR code.

cURL

curl -o qrcode_with_logo.png "https://your-app-url.com/api/generate-qr?url=https%3A%2F%2Fexample.com&imageUrl=https%3A%2F%2Fraw.githubusercontent.com%2Ffirebase%2Ffirebase-tools%2Fmaster%2Fstatic%2Ffirebase-logo.png"

JavaScript (Fetch API)

fetch('https://your-app-url.com/api/generate-qr?url=https%3A%2F%2Fexample.com&imageUrl=https%3A%2F%2Fraw.githubusercontent.com%2Ffirebase%2Ffirebase-tools%2Fmaster%2Fstatic%2Ffirebase-logo.png')
  .then(response => response.blob())
  .then(blob => {
    const url = URL.createObjectURL(blob);
    // Use this URL in an <img> tag or download it
    console.log(url);
  });
Responses

Success Response

  • Code: 200 OK
  • Content-Type: image/png
  • Body: The binary data of the generated QR code image.

Error Responses

Status CodeDescription
400 Bad RequestA required parameter like `url` is missing, or the `imageUrl` could not be fetched or processed.
500 Internal Server ErrorAn unexpected error occurred during QR code generation.