Advanced API Integration Guide
This guide covers advanced API integration techniques for developers who want to build on top of QR Monk's platform.
Prerequisites
Before you begin, make sure you have:
- A QR Monk Pro or Enterprise account
- API credentials from your dashboard
- Basic knowledge of REST APIs
- Your preferred programming language environment
Authentication
QR Monk uses OAuth 2.0 for API authentication:
const response = await fetch('https://api.qrmonk.app/v1/auth', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
client_id: 'YOUR_CLIENT_ID',
client_secret: 'YOUR_CLIENT_SECRET',
grant_type: 'client_credentials'
})
});
const { access_token } = await response.json();
Creating QR Codes via API
Once authenticated, you can create QR codes programmatically:
const createQRCode = async (data) => {
const response = await fetch('https://api.qrmonk.app/v1/qrcodes', {
method: 'POST',
headers: {
'Authorization': `Bearer ${access_token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
title: 'My QR Code',
links: data.links,
design: data.design,
analytics: true
})
});
return response.json();
};
Retrieving Analytics
Access detailed analytics for your QR codes:
const getAnalytics = async (qrCodeId, dateRange) => {
const response = await fetch(
`https://api.qrmonk.app/v1/qrcodes/${qrCodeId}/analytics?from=${dateRange.from}&to=${dateRange.to}`,
{
headers: {
'Authorization': `Bearer ${access_token}`,
}
}
);
return response.json();
};
Bulk Operations
Create multiple QR codes in a single request:
const bulkCreate = async (qrCodesData) => {
const response = await fetch('https://api.qrmonk.app/v1/qrcodes/bulk', {
method: 'POST',
headers: {
'Authorization': `Bearer ${access_token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
qrcodes: qrCodesData
})
});
return response.json();
};
Webhooks
Set up webhooks to receive real-time notifications:
const setupWebhook = async (webhookUrl, events) => {
const response = await fetch('https://api.qrmonk.app/v1/webhooks', {
method: 'POST',
headers: {
'Authorization': `Bearer ${access_token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: webhookUrl,
events: events // ['scan', 'update', 'delete']
})
});
return response.json();
};
Rate Limits
API rate limits vary by plan:
- Free: 100 requests/hour
- Pro: 1,000 requests/hour
- Enterprise: Custom limits
Error Handling
Always implement proper error handling:
try {
const qrCode = await createQRCode(data);
console.log('QR Code created:', qrCode);
} catch (error) {
if (error.status === 429) {
console.error('Rate limit exceeded');
} else if (error.status === 401) {
console.error('Authentication failed');
} else {
console.error('API error:', error.message);
}
}
Next Steps
- Explore the complete API documentation
- Join our developer community
- Check out example implementations
For beginners, start with our Getting Started Guide.
