FREE

เอกสารอ้างอิง API

สร้าง QR codes ผ่าน HTTP ไม่ต้องใช้คีย์ API หรือการรับรองตัวตน

เอนด์พอยต์

GEThttps://qrwing.com/api/qr

ส่งคืนรูปภาพโดยตรง พารามิเตอร์ทั้งหมดถูกส่งเป็นอาร์กิวเมนต์สตริงคำถาม CORS เปิดอยู่ — สามารถเรียกเอนด์พอยต์ได้จากต้นทางใดก็ได้

เริ่มต้นอย่างรวดเร็ว

# URL QR as PNG (default) https://qrwing.com/api/qr?type=url&url=https://qrwing.com # Blue SVG with dots style https://qrwing.com/api/qr?type=url&url=https://qrwing.com&format=svg&fg=1d4ed8&style=dots # WiFi QR https://qrwing.com/api/qr?type=wifi&ssid=HomeNetwork&password=mypassword&encryption=WPA
# curl curl -o qr.png "https://qrwing.com/api/qr?type=url&url=https://qrwing.com" # HTML img tag <img src="https://qrwing.com/api/qr?type=url&url=https://qrwing.com" alt="QR Code" />

พารามิเตอร์

พารามิเตอร์ประเภทค่าเริ่มต้นคำอธิบาย
type requiredstringQR code type. See supported types below.
format optionalsvg | png | webppngOutput image format.
size optionalinteger300Output size in pixels (50–2000).
margin optionalinteger4Quiet zone in modules (0–20).
ec optionalL | M | Q | HMError correction level. Higher = more redundancy.
fg optionalhex000000Foreground (dot) color as 6-digit hex (no #).
bg optionalhexffffffBackground color as 6-digit hex (no #).
transparent optionalbooleanfalseTransparent background (SVG/WebP/PNG).
style optionalsquare | dots | roundedsquareDot style.

ประเภท QR Code

ส่ง type= ด้วยค่าหนึ่งค่าด้านล่าง แต่ละประเภทต้องการพารามิเตอร์เนื้อหาของตัวเอง

urlURL
urlFull URL including https://
textข้อความ
textPlain text content
emailอีเมล
emailEmail address
subjectEmail subject (optional)
bodyEmail body (optional)
phoneโทรศัพท์
phonePhone number with country code
smsSMS
phonePhone number
messagePre-filled message (optional)
wifiWiFi
ssidNetwork name (SSID)
passwordWiFi password
encryptionWPA | WEP | nopass
hiddentrue if network is hidden
vcardvCard
nameFull name (required)
orgOrganization
phonePhone number
emailEmail address
urlWebsite URL
addressStreet address
locationตำแหน่ง
latLatitude
lngLongitude
querySearch query instead of coordinates
whatsappWhatsApp
phonePhone number with country code (no +)
messagePre-filled message (optional)
telegramTelegram
usernameTelegram username (without @)
messagePre-filled message (optional)
calendarกิจกรรม
titleEvent title (required)
startStart datetime ISO 8601
endEnd datetime ISO 8601
locationEvent location
descriptionEvent description
allDaytrue for all-day events
youtubeYouTube
urlYouTube video, channel, or playlist URL
twitterTwitter / X
usernameTwitter/X username (without @)
facebookFacebook
urlFacebook page or profile URL
linkedinLinkedIn
urlLinkedIn profile or page URL
instagramInstagram
usernameInstagram username (without @)
bitcoinBitcoin
addressBitcoin address (required)
amountAmount in BTC (optional)
labelPayment label (optional)
messagePayment message (optional)
zoomZoom
urlFull Zoom meeting URL (preferred)
meetingIdMeeting ID (if no URL)
passwordMeeting password (optional)
appstoreApp Store
iosUrlApple App Store URL
androidUrlGoogle Play Store URL
paypalPayPal
usernamePayPal.me username
amountRequest amount (optional)
currencyCurrency code (optional)

ตัวอย่างจริง

คลิกที่ URL เพื่อเปิดในเบราว์เซอร์ของคุณและดู QR code ที่สร้าง

การตอบสนอง

เมื่อสำเร็จ API จะส่งคืนข้อมูลไบนารีของรูปภาพพร้อมหัวข้อ Content-Type ที่เหมาะสม:

รูปแบบชนิดเนื้อหา
pngimage/png
svgimage/svg+xml
webpimage/webp

เมื่อเกิดข้อผิดพลาด API จะส่งคืน JSON พร้อมสถานะ 400 หรือ 500:

{"error": "Missing required parameter: type"}

การแคชและขีดจำกัดอัตรา

การตอบสนองรวม Cache-Control: public, max-age=86400 ดังนั้นรูปภาพจะถูกแคชเป็นเวลา 24 ชั่วโมงโดยเบราว์เซอร์และ CDN

API ฟรีและไม่ต้องมีการรับรองตัวตน เราขอให้คุณหลีกเลี่ยงการขอข้อมูลอัตโนมัติมากเกินไป สำหรับการสร้างจำนวนมาก (>1,000 QR codes/วัน) โปรด ติดต่อเรา

ตัวอย่างการรวมระบบ

HTML

<img src="https://qrwing.com/api/qr?type=url&url=https://qrwing.com&size=200" alt="QR Code" width="200" height="200" />

JavaScript (fetch)

const url = new URL("https://qrwing.com/api/qr"); url.searchParams.set("type", "url"); url.searchParams.set("url", "https://qrwing.com"); url.searchParams.set("format", "svg"); url.searchParams.set("fg", "1d4ed8"); const response = await fetch(url); const svgText = await response.text(); document.getElementById("qr").innerHTML = svgText;

Python

import requests response = requests.get( "https://qrwing.com/api/qr", params={ "type": "url", "url": "https://qrwing.com", "format": "png", "size": 400, "style": "dots", "fg": "7c3aed", } ) with open("qr.png", "wb") as f: f.write(response.content)

PHP

$params = http_build_query([ 'type' => 'url', 'url' => 'https://qrwing.com', 'format' => 'png', 'size' => 300, ]); $img = file_get_contents("https://qrwing.com/api/qr?" . $params); file_put_contents('qr.png', $img);