Developer API
QR Code Scanner API
Send an image, get the decoded QR content back as JSON.
- One endpoint · POST
- JPG · PNG · WEBP
- Up to 20 MB
- Bearer API key
Quickstart
- 1Get a key
Buy an API plan, then copy your key in Manage API.
- 2Send an image
POST it as
filewith your key as a Bearer token. - 3Read the result
The decoded content: a URL, text, Wi-Fi or contact payload.
curl -X POST "https://qrscanner.net/api/qr-code-scanner" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "[email protected]"
Authentication
Every request carries your API key as a Bearer token. Keep it on your server — never in a browser or app bundle.
Authorization: Bearer YOUR_API_KEY
Keys start with key_. Rotate or revoke a key in Manage API; the old key stops working at once.
Scan a QR code
https://qrscanner.net/api/qr-code-scanner
Parameters
| Field | Type | Description |
|---|---|---|
file required |
file or string | The image. multipart/form-data — the uploaded file. application/json — a base64 string or a full data: URI (standard or URL-safe base64). JPG, PNG or WEBP, up to your plan’s size limit. |
ext optional |
string | Image extension (png, jpg) — only for a base64 string whose type can’t be detected. |
Examples
curl -X POST "https://qrscanner.net/api/qr-code-scanner" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "[email protected]"
curl -X POST "https://qrscanner.net/api/qr-code-scanner" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"file":"data:image/png;base64,iVBORw0KG..."}'
Base64 instead of a file upload.
import { readFile } from 'node:fs/promises';
const form = new FormData();
form.append('file', new Blob([await readFile('qr-code.png')], { type: 'image/png' }), 'qr-code.png');
const res = await fetch('https://qrscanner.net/api/qr-code-scanner', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.QRSCANNER_API_KEY}` },
body: form,
});
const { success, data, error } = await res.json();
Server-side (Node 18+). Never call the API from a browser: the key would be public.
import os, requests
with open("qr-code.png", "rb") as image:
r = requests.post(
"https://qrscanner.net/api/qr-code-scanner",
headers={"Authorization": f"Bearer {os.environ['QRSCANNER_API_KEY']}"},
files={"file": image},
)
body = r.json()
print(body["data"] if body.get("success") else body.get("error"))
$ch = curl_init('https://qrscanner.net/api/qr-code-scanner');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('QRSCANNER_API_KEY')],
CURLOPT_POSTFIELDS => ['file' => new CURLFile('qr-code.png')],
CURLOPT_RETURNTRANSFER => true,
]);
$body = json_decode(curl_exec($ch), true);
Responses
Always JSON. Check success first.
Success · 200
{ "success": true, "data": "https://example.com", "error": null }
success | true when a QR code was decoded |
data | The decoded content |
error | null on success |
Unreadable image · 200
{ "success": false, "data": "", "error": "Unable to scan the QR code." }
An unreadable image uses 1 credit today.
Errors
Errors never use a credit. Every refusal has an HTTP status and a message.
| Status | Message | Meaning | What to do |
|---|---|---|---|
| 401 | Unauthorized |
No Authorization: Bearer header |
Send your key as a Bearer token |
| 401 | Invalid API token |
The key is wrong, revoked or rotated | Copy the current key from Manage API |
| 402 | Purchase API plan to get more quota |
No credits left this period | Upgrade or renew · credits reset monthly |
| 404 | API not registered |
The API is not set up for this account | Contact support |
| 422 | The file field is required. |
Validation failed; the body is keyed by field: {"file": ["…"]} |
Fix the image; nothing is charged |
| 429 | Too many requests per minute |
Over your plan’s requests per minute | Wait Retry-After seconds, then retry |
| 502 | The scanner service is temporarily unavailable. Please try again later. |
Upstream scanner unreachable | Retry with backoff; nothing is charged |
| 503 | Authentication failed. Please try again later. |
Server-side configuration problem (not your key) | Retry later; nothing is charged |
Refusals from the key and quota checks look like {"error": true, "message": "…"}; validation errors are keyed by field.
Limits & credits
| Plan | Scans / month | Per 1,000 | Price | |
|---|---|---|---|---|
| Starter | 5,000 | $1.80 | $9/mo | Choose |
| GrowthMost popular | 50,000 | $1.18 | $59/mo | Choose |
| Scale | 200,000 | $0.75 | $149/mo | Choose |
Yearly billing on every plan saves 20%. Need more than our largest plan? Contact Us.
Rate limits
Requests are limited per account, per minute — all your keys share one budget. Over the limit you get 429 with a Retry-After header (seconds).
Credits
- 1 successful scan = 1 credit. Credits reset monthly, also on yearly plans.
- Running out returns 402; your next period or an upgrade refills it.
- See credits left and when they reset in Manage API.