How to Create QR Codes via the CodeQR API: Complete Guide
Learn how to use the CodeQR API to programmatically create QR codes and integrate this feature into your applications.

Learn how to use the CodeQR API to programmatically create QR codes and integrate this feature into your applications.

Como Criar QR Codes via API da CodeQR: Guia Completo
The CodeQR API is a RESTful interface that allows you to create, manage, and track QR codes programmatically. With it, you can:
To get started, you need a valid API key:

Learn more about how to get your API key.
All requests must include your API key in the authorization header:
Authorization: Bearer codeqr_xxxxxxxx
In addition to your API key, you need your project's project slug. This parameter is required for all requests:
How to find your project slug:
All requests must be made to:
https://api.codeqr.io
Important: All requests must include the projectSlug parameter in the query string.
The minimum required parameter is the destination URL:
curl --request POST \
--url https://api.codeqr.io/qrcodes?projectSlug=acme \
--header 'Authorization: Bearer codeqr_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"type": "url",
"url": "https://codeqr.io/blog",
}'
Scan to access

API Response:
{
"id": "cmf6yawg30001pqrwjhd1bdxe",
"domain": "expol.ink",
"key": "iympEuajxgeP-qr",
"archived": false,
"expiresAt": null,
"expiredUrl": null,
"password": null,
"externalId": null,
"trackConversion": false,
"proxy": false,
"title": null,
"description": null,
"image": "https://res.cloudinary.com/dhnaggn4g/image/upload/v1757085378/expol.ink/iympEuajxgeP-qr.png",
"utm_source": null,
"utm_medium": null,
"utm_campaign": null,
"utm_term": null,
"utm_content": null,
"rewrite": false,
"doIndex": false,
"flexible": false,
"filled": true,
"ios": null,
"android": null,
"geo": null,
"static": false,
"type": "url",
"contentStatic": null,
"text": null,
"email": null,
"wifi": null,
"url": "https://codeqr.io/blog",
"phone": null,
"vcard": null,
"crypto": null,
"sms": null,
"facetime": null,
"latlog": null,
"pix": null,
"logo": null,
"bgColor": "#FFFFFF",
"fgColor": "#000000",
"size": 1024,
"level": "H",
"showLogo": true,
"src": "https://res.cloudinary.com/dhnaggn4g/image/upload/v1741477675/logos/clwazhjsm00002nx4heuc6vge.png",
"height": 153,
"width": 153,
"excavate": true,
"pattern": "default",
"shape": "none",
"frame": "none",
"frameColor": "#000000",
"frameText": null,
"userId": "cmbsr6sky0000ljvvbzz5qjkj",
"projectId": "clwazhjsm00002nx4heuc6vge",
"preRedirection": false,
"pageId": null,
"pageUrl": null,
"isFormMandatory": false,
"publicStats": false,
"scans": 0,
"lastClicked": null,
"leads": 0,
"sales": 0,
"saleAmount": 0,
"createdAt": "2025-09-05T14:49:17.761Z",
"updatedAt": "2025-09-05T15:16:21.270Z",
"tagId": null,
"comments": "",
"notificationToken": null,
"tags": [],
"shortLink": "https://expol.ink/iympEuajxgeP-qr",
"webhookIds": []
}The API response contains several useful fields you can use in your application:
image - QR code image URL
shortLink - Shortened link
id - Unique identifier
key - Custom slug
scans - Scan counter
createdAt - Creation date
💡 Tip: The image field is especially important—it contains the direct URL to the QR code image that you can use in your application, website, or print materials.
const response = await fetch("https://api.codeqr.io/qrcodes?projectSlug=acme", {
method: "POST",
headers: {
Authorization: "Bearer codeqr_your_api_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
type: "url",
url: "https://codeqr.io/blog",
}),
});
const qrCode = await response.json();
console.log("QR Code criado:", qrCode.shortLink);
console.log("Imagem do QR Code:", qrCode.image);
You can fully customize the appearance of your QR code:
curl --request POST \
--url https://api.codeqr.io/qrcodes?projectSlug=acme \
--header 'Authorization: Bearer codeqr_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"type": "url",
"url": "https://codeqr.io/blog",
"static": false,
"bgColor": "#fff5b1",
"fgColor": "#0017e5",
"showLogo": true,
"pattern": "diamond",
"shape": "square",
"frame": "none"
}'
Result

bgColor (string) - The QR code background color
fgColor (string) - The QR code foreground color
size (number) - The QR code size
level (string) - The QR code error correction level
showLogo (boolean) - Whether the logo should be displayed in the QR code
src (string | null) - The QR code image URL
height (number) - The height of the QR code
width (number) - The width of the QR code
excavate (boolean) - Whether the QR code should have excavated areas
pattern (string) - The shape pattern of the QR code modules
shape (string) - The shape design around the QR code
curl --request POST \
--url https://api.codeqr.io/qrcodes?projectSlug=acme \
--header 'Authorization: Bearer codeqr_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://codeqr.io/blog",
"key": "meu-qr-personalizado",
"title": "QR Code do Produto",
"description": "QR code para página do produto",
"externalId": "PROD-001",
"tagIds": ["tag1", "tag2"]
}'
curl --request POST \
--url https://api.codeqr.io/qrcodes \
--header 'Authorization: Bearer codeqr_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"type": "url",
"url": "https://codeqr.io/blog",
}'
curl --request POST \
--url https://api.codeqr.io/qrcodes?projectSlug=acme \
--header 'Authorization: Bearer codeqr_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"type": "text",
"text": "Olá! Este é um QR code de texto."
}'
curl --request POST \
--url https://api.codeqr.io/qrcodes?projectSlug=acme \
--header 'Authorization: Bearer codeqr_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"type": "email",
"email": {
"to": "contact@codeqr.io",
"subject": "Assunto do email",
"body": "Corpo do email"
}
}'
curl --request POST \
--url https://api.codeqr.io/qrcodes \
--header 'Authorization: Bearer codeqr_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"type": "wifi",
"wifi": {
"ssid": "NomeDaRede",
"password": "senha123",
"security": "WPA"
}
}'
curl --request POST \
--url https://api.codeqr.io/qrcodes?projectSlug=acme \
--header 'Authorization: Bearer codeqr_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"type": "phone",
"phone": "+5511999999999"
}'
curl --request POST \
--url https://api.codeqr.io/qrcodes?projectSlug=acme \
--header 'Authorization: Bearer codeqr_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"type": "latlog",
"latlog": {
"latitude": -23.5505,
"longitude": -46.6333
}
}'
Protect your QR codes with password and expiration date:
curl --request POST \
--url https://api.codeqr.io/qrcodes?projectSlug=acme \
--header 'Authorization: Bearer codeqr_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"type": "url",
"url": "https://codeqr.io/blog",
"password": "password123",
"expiresAt": "2025-12-05T17:10:00.000Z",
}'
Redirect users to different URLs based on device:
curl --request POST \
--url https://api.codeqr.io/qrcodes?projectSlug=acme \
--header 'Authorization: Bearer codeqr_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://codeqr.io/blog",
"ios": "https://apps.apple.com/us/app/qr-code-generator-and-reader/id1623860555",
"android": "https://play.google.com/store/apps/details?id=com.losenvo.codeqrlink"
}'
Customize the user experience based on location:
curl --request POST \
--url https://api.codeqr.io/qrcodes?projectSlug=acme \
--header 'Authorization: Bearer codeqr_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"type": "url",
"url": "https://codeqr.io/blog",
"geo": {
"BR": "https://exemplo.com/brasil",
"US": "https://exemplo.com/usa",
"GB": "https://exemplo.com/uk"
}
}'
Track the performance of your QR codes:
curl --request POST \
--url https://api.codeqr.io/qrcodes?projectSlug=acme \
--header 'Authorization: Bearer codeqr_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"type": "url",
"url": "https://exemplo.com",
"utm_source": "marketing",
"utm_medium": "qr_code",
"utm_campaign": "promocao_2025",
"utm_term": "produto",
"utm_content": "banner"
}'
bad_request (400) - Malformed request
unauthorized (401) - Invalid API key
forbidden (403) - No permission
not_found (404) - Resource not found
conflict (409) - Conflict (e.g., duplicate key)
rate_limit_exceeded (429) - Rate limit exceeded
internal_server_error (500) - Internal server error
Now that you know how to create QR codes via the API, explore these advanced features:
The CodeQR API offers a complete and flexible solution for programmatically creating QR codes. With this guide, you have learned:
Now you are ready to integrate QR code creation into your applications and take full advantage of the CodeQR platform!
Was this article helpful? Share it with your team and explore more resources in the CodeQR documentation.