← Back to blog

Free QR Code API: Generate QR Codes with curl, Python & JavaScript

Published July 7, 2026 · Updated August 4, 2026 · Eric · 5 min read

No code: open the free QR code generator, enter a URL or text, download the PNG. Developers and agents: use the QR code API below—no API key to start.

Looking for a free QR code API, QR code generator API, or a simple api qr code endpoint that works in headless agents? Agent Media Tools exposes POST /api/qrcode. Send text or a URL; get JSON with a PNG data URL you can display or save.

API overview

PropertyValue
EndpointPOST /api/qrcode
BodyJSON: text (required), size (optional, max 1000)
Response{"dataUrl":"data:image/png;base64,...","text":"..."}
AuthNo API key for basic free tier
Limits10/day anonymous · 25/day free account
Browser tool/tool/qr-code

curl — one-liner QR code API

💡 Windows users: Run from Git Bash or WSL.

curl -X POST https://agentmediatools.com/api/qrcode \
  -H "Content-Type: application/json" \
  -d '{"text":"https://agentmediatools.com","size":512}' \
  | python3 -c 'import sys,json,base64; d=json.load(sys.stdin)["dataUrl"].split(",",1)[1]; open("qr.png","wb").write(base64.b64decode(d))'

The endpoint returns {"dataUrl":"data:image/png;base64,..."}. The pipe decodes that into qr.png.

WiFi QR code

curl -X POST https://agentmediatools.com/api/qrcode \
  -H "Content-Type: application/json" \
  -d '{"text":"WIFI:S:MyNetwork;T:WPA;P:secret;;","size":512}'

Python

import base64
import requests

r = requests.post(
    "https://agentmediatools.com/api/qrcode",
    json={"text": "https://yoursite.com/promo", "size": 512},
)
r.raise_for_status()
data_url = r.json()["dataUrl"]
png = base64.b64decode(data_url.split(",", 1)[1])
with open("qr.png", "wb") as f:
    f.write(png)

JavaScript (browser or Node)

const res = await fetch("https://agentmediatools.com/api/qrcode", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ text: "Hello from JS!", size: 512 }),
});
const { dataUrl } = await res.json();
// document.querySelector("img").src = dataUrl;
console.log(dataUrl.slice(0, 40) + "...");

AI agent use cases

Agent prompt template

Generate a QR code with POST https://agentmediatools.com/api/qrcode
Body JSON: {"text": "YOUR_URL_OR_TEXT", "size": 512}
Response: JSON with PNG data URL in "dataUrl". Decode base64 after the comma and save as PNG.

MCP clients can use the generate_qrcode tool when the Agent Media Tools MCP server is connected.

Why an API instead of a local library?

FAQ

Is this a free QR code API?

Yes for basic use (daily free limits). No credit card required to start. See pricing for higher limits.

QR code API vs browser generator?

Same product. Humans use /tool/qr-code; agents and apps call POST /api/qrcode.

Max text length?

Up to 2,000 characters in the text field; size is capped at 1,000 pixels.

Interactive: free QR code API

Enter a URL or text—no API key. Get a PNG via the same endpoint agents use.

Full QR tool → · OpenAPI · Agent integration · Pro for higher limits

Related


agentmediatools.com — free tools for humans and AI agents

Related: Generate QR codes → · Pastebin → · Share text with the Pastebin API →