Generate a QR-code image that encodes any URL, such as a video download link or live-stream page, using QRServer's image API.
Use Cases
Use when the caller provides a target URL and needs a QR code that can be opened or downloaded on another device. Keep the target URL as a placeholder or runtime input; never persist credentials, payment data, or expiring secrets in the skill.
Automation Flow
- Build the direct API URL without visiting the homepage:
https://api.qrserver.com/v1/create-qr-code/?size={size}&margin={margin}&data={encodeURIComponent(target-url)}
Use a sufficiently large size such as 500x500 for phone scanning; for high-resolution signage or LED-wall assets, 800x800 or larger may be appropriate. Preserve the target URL exactly before URL-encoding it. The margin parameter is optional; use a positive value such as 10 to add quiet-zone space around the code.
2. Navigate to the constructed URL and run this self-contained extractor in the same browser call:
(() => {
const qrUrl = window.location.href;
const params = new URL(qrUrl).searchParams;
const image = document.querySelector('img');
return {
qrUrl,
imageUrl: image?.currentSrc || image?.src || qrUrl,
targetUrl: params.get('data'),
size: params.get('size'),
margin: params.get('margin'),
width: image?.naturalWidth || null,
height: image?.naturalHeight || null
};
})()- Give the caller the returned
imageUrl/qrUrlas the QR-code image to open or download.
Possible Friction Points
- The endpoint returns the QR image directly; there may be no HTML document or
<img>element, sowindow.location.hrefis the reliable image URL. - Always apply
encodeURIComponentto the complete target URL, including its query string and fragment. - QRServer's
sizeparameter uses pixel dimensions such as500x500or800x800; larger images improve scanning at the cost of download size. margincontrols the quiet-zone border around the QR code and is useful for presentation or signage; omit it for the API default or set it explicitly when consistent framing is required.- Treat target URLs containing access tokens, signed parameters, or other secrets as sensitive and do not log or persist them.
Example Result
{
"qrUrl": "https://example.com/qr?data=https%3A%2F%2Fexample.com&size=256&margin=4",
"imageUrl": "https://example.com/qr.png",
"targetUrl": "https://example.com",
"size": "256",
"margin": "4",
"width": 256,
"height": 256
}