L.nu

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/links

Request 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/links

Query parameters

pagenumberPage number (default: 1)
limitnumberItems 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/stats

Query parameters

daysnumberNumber 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/:id

Returns { "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
formatstringpng (default) or svg
sizenumberWidth in pixels (default: 300, max: 1000)

Rate limits

Free100 requests/day
Pro10,000 requests/day
Business100,000 requests/day

Rate limit headers are included in every response.

Slug length tiers

Custom slug length depends on your plan:

1 characterPremiumReserved — not available for self-service
2 charactersBusinessAvailable on Business plan
3 charactersProAvailable on Pro plan
4+ charactersFreeAvailable on all plans

Errors

{
  "error": "Human-readable error message"
}
400Bad request (invalid URL, invalid slug)
401Unauthorized (missing or invalid API key)
403Forbidden (plan limit reached)
404Not found
409Conflict (slug already taken)
429Rate limit exceeded