LinQR API Documentation
Powerful REST API for programmatic link shortening and QR code generation
The LinQR API provides a simple REST interface for creating short links, generating QR codes, and managing your links programmatically.
1. Get API Key
Create an API key from your dashboard to authenticate requests.
2. Make Requests
Send HTTP requests with your API key in the Authorization header.
3. Track Analytics
Monitor your link performance through the dashboard or API.
Base URL
https://your-domain.com/api/v1
All API requests must be authenticated using an API key in the Authorization header.
Header Format
Authorization: Bearer YOUR_API_KEY
Example Request
curl -X GET \
-H "Authorization: Bearer lqr_1234567890abcdef..." \
-H "Content-Type: application/json" \
https://your-domain.com/api/v1/links
API Key Security
Keep your API keys secure and never commit them to version control. Use environment variables in production.
API requests are rate-limited per API key to ensure fair usage and system stability.
General Rate Limits
- • 1000 requests per hour per API key
- • 100 requests per minute per API key
- • Limits reset every hour
Link Creation Limits
- • 10 links per minute per API key
- • 200 links per hour per API key
- • Separate from general rate limits
Response Headers
- •
X-RateLimit-Limit
- Current limit for this operation - •
X-RateLimit-Remaining
- Requests left in window - •
X-RateLimit-Reset
- Unix timestamp of reset
while other endpoints show hourly limits (1000).
Rate Limit Exceeded Response
Link Creation (10/minute exceeded):
{
"error": "Rate limit exceeded",
"code": "RATE_LIMIT_EXCEEDED",
"retryAfter": 60,
"operation": "create_link"
}
General API (1000/hour exceeded):
{
"error": "Rate limit exceeded",
"code": "RATE_LIMIT_EXCEEDED",
"retryAfter": 3600,
"operation": "general"
}
/api/v1/links
Retrieve all links created by the authenticated user
Parameters
Name | Type | Required | Description |
---|---|---|---|
limit | integer | Optional | Maximum number of links to return (1-100, default: 50) |
Example Response
{
"links": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"slug": "abc123",
"originalUrl": "https://example.com",
"title": "Example Website",
"shortUrl": "https://your-domain.com/abc123",
"createdAt": "2024-01-15T10:30:00Z",
"stats": {
"totalScans": 42,
"clicks": 28,
"qrScans": 14
}
}
],
"total": 1,
"hasMore": false
}
The API uses standard HTTP status codes and returns detailed error messages in JSON format.
Error Response Format
{
"error": "Error message description",
"code": "ERROR_CODE"
}
Common Status Codes
400
Bad Request401
Unauthorized403
Forbidden404
Not Found429
Rate Limited500
Server ErrorCreate a Link
const apiKey = 'lqr_your_api_key_here';
const apiUrl = 'https://your-domain.com/api/v1';
async function createLink(originalUrl, customSlug, title) {
const response = await fetch(`${apiUrl}/links`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
originalUrl,
customSlug,
title
})
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
return response.json();
}
// Usage
createLink('https://example.com', 'my-link', 'Example Site')
.then(link => console.log('Created:', link))
.catch(error => console.error('Error:', error));