Developer API Documentation
The QRForge Pro REST API allows you to generate QR codes programmatically from your own applications.
Authentication
To use the API, you must include your API Key in the request header X-API-KEY or as a query parameter api_key.
X-API-KEY: your_api_key_here
Endpoint: Generate QR Code
POST /api/generate.php
Request Parameters
| Parameter | Type | Description |
|---|---|---|
| type | string | url | text | email | phone | wifi | vcard |
| data | string | The content to encode in the QR code. |
| size | integer | QR size in pixels (default: 300). |
| color | string | Hex color code for the QR (default: #000000). |
| bgcolor | string | Hex color code for the background (default: #ffffff). |
| format | string | png | svg | jpg (default: png). |
Example Request (JSON)
{
"type": "url",
"data": "https://example.com",
"size": 300,
"color": "#4f46e5",
"format": "png"
}
Example Response
{
"status": "success",
"qr_url": "https://yourdomain.com/uploads/qr_64a1b2c3d4.png",
"type": "url",
"data": "https://example.com"
}
Example Code
<?php
$url = 'https://yourdomain.com/api/generate.php';
$data = [
'type' => 'url',
'data' => 'https://example.com',
'size' => 300
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-KEY: your_api_key_here',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
$result = json_decode($response, true);
echo $result['qr_url'];
?>