Generate Codes Programmatically via API
A single HTTP GET call — integrate QR & barcode generation directly into Excel, Google Sheets, any ERP system or custom application. All you need is your API key and your data.
🚀 Quick Start
Response: transparent PNG image stream — use directly in <img src="...">, save to disk, or embed in Excel.
🔑 Authentication
Add api_key to every request. Get your key from the Dashboard under Developer API (requires Unlimited plan).
📋 Parameters
| Parameter | Default | Description |
|---|---|---|
api_key * |
required | Your secret API key — required in every request. |
data * |
required | The URL, text, or barcode value to encode. |
type |
qr | qr or barcode |
color |
000000 | Foreground HEX color without # (e.g. 1a1aff) |
transparent |
1 | 1 = transparent background (default), 0 = solid |
bg_color |
ffffff | Background HEX color — only used when transparent=0 |
width |
qr:10 / bc:2 | QR: module size in px (2–40) · Barcode: bar-unit width (1–8) |
height |
80 | Barcode height in px (20–400). Ignored for QR. |
output |
json | image = direct PNG stream · json = JSON with base64 |
💻 Integration Examples
cURL / Terminal
-o qrcode.png
PHP
<?php
$url = "https://ultdtc.com/api?" . http_build_query([
"api_key" => "YOUR_KEY",
"data" => "https://example.com",
"type" => "qr",
"transparent" => 1,
"output" => "image",
]);
file_put_contents("qrcode.png", file_get_contents($url));
?>
Python (requests)
import requests
resp = requests.get("https://ultdtc.com/api", params={
"api_key": "YOUR_KEY",
"data": "https://example.com",
"type": "qr",
"transparent": 1,
"output": "image",
})
with open("qrcode.png", "wb") as f:
f.write(resp.content)
print("Done!")
JavaScript (fetch)
// Get base64 PNG via JSON output
const params = new URLSearchParams({
api_key: "YOUR_KEY",
data: "https://example.com",
type: "qr",
transparent: 1,
output: "json"
});
const res = await fetch("https://ultdtc.com/api?" + params);
const json = await res.json();
document.getElementById("qr-img").src = json.image_base64;
📊 Excel Integration — Auto-Generate Barcodes & QR Codes
You can auto-generate thousands of QR codes or barcodes directly from Excel in two steps: put your data in column A, call the API with each value.
Step 1: Sheet Layout
| A | B | C |
|---|---|---|
| Data / URL | API URL | Image (=IMAGE) |
| https://example.com | =CONCAT("https://ultdtc.com/api?api_key=KEY&data=",ENCODEURL(A2),"&type=qr&transparent=1&output=image") | =IMAGE(B2) |
| Product-SKU-1234 | =CONCAT("https://ultdtc.com/api?api_key=KEY&data=",ENCODEURL(A3),"&type=barcode&output=image") | =IMAGE(B3) |
* =IMAGE() is available in Excel 365 and Google Sheets. In Google Sheets: =IMAGE(B2)
Step 2: VBA Macro to Auto-Download Images
Open the VBA editor (Alt+F11), create a new module, and paste this code:
Sub GenerateQRCodes()
Dim ws As Worksheet
Dim apiKey As String
Dim baseUrl As String
Dim lastRow As Long
Dim i As Long
Dim qrUrl As String
Dim savePath As String
apiKey = "YOUR_API_KEY_HERE"
baseUrl = "https://ultdtc.com/api"
ws = ActiveSheet
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
savePath = ThisWorkbook.Path & "\qr_codes\"
' Create folder if it does not exist
If Dir(savePath, vbDirectory) = "" Then MkDir savePath
For i = 2 To lastRow
Dim data As String
data = ws.Cells(i, 1).Value
If Trim(data) = "" Then GoTo NextRow
qrUrl = baseUrl & "?api_key=" & apiKey _
& "&data=" & WorksheetFunction.EncodeURL(data) _
& "&type=qr&transparent=1&output=image"
Dim xhr As Object
Set xhr = CreateObject("MSXML2.XMLHTTP")
xhr.Open "GET", qrUrl, False
xhr.send
Dim fileName As String
fileName = savePath & "qr_" & i & ".png"
Dim stream As Object
Set stream = CreateObject("ADODB.Stream")
stream.Type = 1 ' Binary
stream.Open
stream.Write xhr.responseBody
stream.SaveToFile fileName, 2
stream.Close
ws.Cells(i, 3).Value = fileName ' Store path in col C
NextRow:
Next i
MsgBox "Done! " & (lastRow - 1) & " QR codes saved to " & savePath
End Sub
📦 JSON Response (output=json)
{
"success": true,
"type": "qr",
"transparent": true,
"caller_ip": "203.0.113.5",
"image_base64": "data:image/png;base64,iVBORw0KGgo...",
"daily_requests_remaining": 87
}
When daily_requests_remaining reaches 0, the API returns HTTP 429.
🔒 IP Allowlist
From your Dashboard you can restrict your API key to specific IP addresses (e.g. your server or office network). If no IPs are added, all IPs are accepted. Manage IPs →