CodePrints

Overview

The CodePrints API lets you generate QR codes programmatically from any language that can make HTTP requests. Send a POST request with JSON, receive a base64-encoded image back — no API key required.

No API Key
Free & open access
JSON API
REST + JSON responses
PNG & SVG
Base64 or raw binary

Base URL

https://www.codeprints.site/api/v1

All endpoints are relative to this base URL. Always use HTTPS in production.


Rate Limits

60 requests / minute per IP address

When the limit is exceeded the API returns HTTP 429. Check these response headers:

X-RateLimit-Limit: 60 X-RateLimit-Remaining: 42 Retry-After: 30

Error Handling

All error responses share the same JSON shape:

{ "success": false, "message": "Human-readable error description", "errors": { "field_name": ["Validation error detail"] } }
CodeMeaning
200Success
422Validation error — check the errors field
429Rate limit exceeded
500Server error

GET

/qr/types

Returns all supported QR code types and their required / optional fields.

Request
GET https://www.codeprints.site/api/v1/qr/types Accept: application/json
Response
{ "success": true, "data": [ { "type": "url", "label": "URL / Website", "description": "Encodes a website URL.", "fields": [ { "name": "url", "type": "string", "required": true, "description": "The full URL" } ] }, // ... more types ] }

POST

/qr/generate

Generate a QR code image. Returns it as a base64-encoded data URI.

Headers
Content-Type: application/json Accept: application/json X-API-Key: your_api_key_here
Don't have a key yet? Get your free API key →
Body Parameters
ParameterTypeRequiredDescription
typestringrequiredQR type: url text wifi email phone sms whatsapp vcard
urlstringif urlWebsite URL
textstringif textPlain text (max 2000 chars)
ssidstringif wifiWiFi network name
passwordstringoptionalWiFi password
encryptionstringoptionalWPA WEP none (default: WPA)
emailstringif emailRecipient email address
email_subjectstringoptionalEmail subject line
email_bodystringoptionalEmail body text
phonestringif phonePhone number
sms_numberstringif smsSMS recipient number
sms_messagestringoptionalPre-filled SMS text
whatsapp_numberstringif whatsappWhatsApp number (digits only)
whatsapp_messagestringoptionalPre-filled message
vcard_first_namestringif vcardContact first name
vcard_last_namestringoptionalContact last name
vcard_organizationstringoptionalCompany name
vcard_phonestringoptionalContact phone
vcard_emailstringoptionalContact email
formatstringoptionalpng (default) or svg
sizeintegeroptional200 300 (default) 500
marginintegeroptional0–10 (default: 1)
foreground_colorstringoptionalHex color e.g. #000000
background_colorstringoptionalHex color e.g. #ffffff
Success Response
{ "success": true, "data": { "image": "data:image/png;base64,iVBORw0KGgo...", // ready for <img src="..."> "base64": "iVBORw0KGgo...", // raw base64 string "mime_type": "image/png", "format": "png", "size": 300, "payload": "https://example.com", // encoded content "type": "url" }, "meta": { "generated_at": "2024-01-15T12:00:00+00:00", "version": "v1" } }

Example: URL QR Code

JavaScript (fetch)
const res = await fetch('https://www.codeprints.site/api/v1/qr/generate', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-API-Key': 'your_key' }, body: JSON.stringify({ type: 'url', url: 'https://example.com', format: 'png', size: 300 }) }); const data = await res.json(); document.querySelector('img').src = data.data.image;
cURL
curl -X POST https://www.codeprints.site/api/v1/qr/generate \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{"type":"url","url":"https://example.com","size":300}'
Python
import requests, base64 res = requests.post('https://www.codeprints.site/api/v1/qr/generate', json={ 'type': 'url', 'url': 'https://example.com', 'size': 300 }) data = res.json()['data'] with open('qrcode.png', 'wb') as f: f.write(base64.b64decode(data['base64']))
PHP
$response = file_get_contents('https://www.codeprints.site/api/v1/qr/generate', false, stream_context_create(['http' => [ 'method' => 'POST', 'header' => "Content-Type: application/json\r\nAccept: application/json", 'content' => json_encode(['type'=>'url', 'url'=>'https://example.com']) ]]) ); $data = json_decode($response, true)['data']; file_put_contents('qrcode.png', base64_decode($data['base64']));

Example: WiFi QR Code

{ "type": "wifi", "ssid": "MyHomeNetwork", "password": "secretpassword", "encryption": "WPA", "hidden": false, "size": 300, "format": "png" }

Example: vCard QR Code

{ "type": "vcard", "vcard_first_name": "John", "vcard_last_name": "Doe", "vcard_organization": "Acme Inc.", "vcard_title": "Software Engineer", "vcard_phone": "+1234567890", "vcard_email": "john@acme.com", "vcard_website": "https://acme.com", "size": 300, "foreground_color": "#1e293b" }

Interactive Tester


API Response

                                    
Calling API…