Create Your First Link
This guide walks through creating a short link, checking its analytics, and generating a QR code — all via the API.
-
Create the link
Terminal window curl -X POST https://xqr.co/api/v1/links \-H "Authorization: Bearer $XQR_API_KEY" \-H "Content-Type: application/json" \-d '{"url": "https://example.com/landing", "custom_slug": "launch"}'const res = await fetch("https://xqr.co/api/v1/links", {method: "POST",headers: {Authorization: `Bearer ${process.env.XQR_API_KEY}`,"Content-Type": "application/json",},body: JSON.stringify({url: "https://example.com/landing",custom_slug: "launch",}),});const { data: link } = await res.json(); -
Share the link
Your link is live at
https://xqr.co/launch. Share it in emails, social media, or print materials. -
Generate a QR code
Terminal window curl "https://xqr.co/api/v1/links/${LINK_ID}/qr?format=png&size=20" \-H "Authorization: Bearer $XQR_API_KEY" \-o qr-code.png -
Check analytics
Terminal window curl "https://xqr.co/api/v1/analytics/links/${LINK_ID}/stats" \-H "Authorization: Bearer $XQR_API_KEY"Response shows total scans, country breakdown, device types, and daily scan counts.
Was this page helpful?
Thanks for your feedback!