Make QR codes from Python: three ways

In Python the quickest route is a library: pip install qrcode (or segno) and save a PNG or SVG in three lines, offline and free. If you'd rather call an HTTP API, goQR.me's api.qrserver.com returns QR images from a URL with no key. Our QR Code and Barcode Generator API returns crisp SVG QR codes plus Code 128 and EAN-13 barcodes for $0.002 per code.

Try it free QR Code and Barcode Generator API — SVG, $0.002 · $0.002 / call

Way 1: the qrcode library

segno is a pure-Python alternative with no image dependency for SVG output: segno.make("https://iamai.markets").save("qr.svg", scale=8).

pip install "qrcode[pil]"

import qrcode
img = qrcode.make("https://iamai.markets")
img.save("qr.png")

Way 2: a free URL API

goQR.me documents a free endpoint with no key. It returns PNG, GIF, JPEG, SVG or EPS, up to 1000 by 1000 pixels for bitmaps, and asks you to contact them past about 10,000 requests a day.

import requests

r = requests.get("https://api.qrserver.com/v1/create-qr-code/",
                 params={"data": "https://iamai.markets", "size": "300x300"}, timeout=10)
open("qr.png", "wb").write(r.content)

Way 3: our API, when you also need barcodes

One endpoint makes QR codes (any language, encoded as UTF-8, error correction L, M, Q or H), Code 128 barcodes (up to 80 plain characters) and EAN-13 product barcodes (send 12 digits and the check digit is added). Output is always black-on-white SVG, as text and as a data URL you can drop into an img tag. It's $0.002 per code over x402, USDC on Base.

# pay_session: a requests session wrapped by your x402 v2 client
API = "https://iamai.markets/api/x402/services/QEEtUnGNH3SB"
res = pay_session.post(API, json={"type": "qr", "data": "https://iamai.markets"}).json()["result"]
open("qr.svg", "w").write(res["svg"])

ean = pay_session.post(API, json={"type": "ean13", "data": "590123412345"}).json()["result"]
print(ean["data"])  # 5901234123457, check digit added

Which one to choose

NeedBest fit
A few QR codes in a scriptqrcode or segno, free and offline
QR images in HTML emails with no backendA URL API like api.qrserver.com
EAN-13 or Code 128 labels toosegno has no 1D barcodes; python-barcode or our API
An AI agent with no Python environmentOur API, paid per code
A logo in the middle, colours, PNGA library or a design tool; our API is plain SVG only

The product

Questions

How much text fits in one QR code?

Our API accepts up to about 2,300 characters per code. Shorter is better: dense codes are harder to scan from print.

Do API-made QR codes expire?

No. These are static codes; the data is inside the image, so they work as long as the link inside works.

Can I make a QR code without code?

Yes. Our free QR Code Maker runs in the browser for links, text and Wi-Fi.

Related

Updated 2026-12-02