API Documentation
Everything you need to create and manage short links programmatically.
Authentication
All API requests require an API key. Find yours in Settings. Include it in the Authorization header:
Authorization: Bearer lnu_your_api_key_here
Base URL
https://l.nu/api/v1
Create a short link
POST
/api/v1/linksRequest body
{
"url": "https://example.com/very-long-url",
"slug": "my-custom-slug" // optional
}Response
{
"id": "clx1234...",
"slug": "my-custom-slug",
"url": "https://example.com/very-long-url",
"shortUrl": "https://l.nu/my-custom-slug",
"createdAt": "2026-04-08T12:00:00.000Z"
}List your links
GET
/api/v1/linksQuery parameters
| page | number | Page number (default: 1) |
| limit | number | Items per page (default: 20, max: 100) |
Response
{
"data": [
{
"id": "clx1234...",
"slug": "abc123",
"url": "https://example.com",
"shortUrl": "https://l.nu/abc123",
"clicks": 42,
"active": true,
"createdAt": "2026-04-08T12:00:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 1,
"pages": 1
}
}Get link statistics
GET
/api/v1/links/:id/statsQuery parameters
| days | number | Number of days to look back (default: 30) |
Response
{
"totalClicks": 142,
"byDay": { "2026-04-07": 12, "2026-04-08": 24 },
"byCountry": { "US": 80, "SE": 30, "DE": 20 },
"byBrowser": { "Chrome": 90, "Safari": 30 },
"byDevice": { "desktop": 100, "mobile": 42 },
"byOs": { "Windows": 60, "macOS": 40 },
"byReferer": { "twitter.com": 50, "direct": 80 }
}Update a link
PATCH
/api/v1/links/:id{
"url": "https://new-destination.com",
"active": false
}Delete a link
DELETE
/api/v1/links/:idReturns { "success": true }
QR Codes
Every link has an auto-generated QR code:
GET https://l.nu/api/qr/:slug GET https://l.nu/api/qr/:slug?format=svg GET https://l.nu/api/qr/:slug?size=500
| format | string | png (default) or svg |
| size | number | Width in pixels (default: 300, max: 1000) |
Rate limits
| Free | 100 requests/day |
| Pro | 10,000 requests/day |
| Business | 100,000 requests/day |
Rate limit headers are included in every response.
Slug length tiers
Custom slug length depends on your plan:
| 1 character | Premium | Reserved — not available for self-service |
| 2 characters | Business | Available on Business plan |
| 3 characters | Pro | Available on Pro plan |
| 4+ characters | Free | Available on all plans |
Errors
{
"error": "Human-readable error message"
}| 400 | Bad request (invalid URL, invalid slug) |
| 401 | Unauthorized (missing or invalid API key) |
| 403 | Forbidden (plan limit reached) |
| 404 | Not found |
| 409 | Conflict (slug already taken) |
| 429 | Rate limit exceeded |