URL Shortener API

Create short links, generate QR codes, and pull analytics programmatically. A simple REST API with JSON responses.

API Overview

RESTful JSON API

Standard REST conventions with predictable resource URLs. All responses return JSON with consistent error formatting.

API Key Authentication

Generate API keys from your dashboard. Include your key in the Authorization header with every request.

Rate Limiting

60 requests per minute by default. Rate limit headers are included in every response so you can track your remaining quota.

All Features Included

Every feature available in the dashboard is also available via the API. Short links, QR codes, custom slugs, and full analytics.

API Endpoints

Create a Short Link

Send a POST request with the destination URL and an optional custom slug. The API returns the shortened link immediately.

Request
POST /api/links
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY

{
  "url": "https://example.com/my-long-page-url",
  "slug": "my-link"
}
Response
{
  "id": "clx1abc23def456",
  "url": "https://example.com/my-long-page-url",
  "slug": "my-link",
  "shortUrl": "https://lnk.eco/my-link",
  "clicks": 0,
  "createdAt": "2026-03-21T10:00:00.000Z"
}

List Your Links

Retrieve all links associated with your account. Supports pagination with page and limit query parameters.

Request
GET /api/links?page=1&limit=20
Authorization: Bearer YOUR_API_KEY
Response
{
  "links": [
    {
      "id": "clx1abc23def456",
      "url": "https://example.com/my-long-page-url",
      "slug": "my-link",
      "shortUrl": "https://lnk.eco/my-link",
      "clicks": 142,
      "createdAt": "2026-03-21T10:00:00.000Z"
    }
  ],
  "total": 1,
  "page": 1,
  "limit": 20
}

Get Link Analytics

Fetch detailed click analytics for a specific link, including referrers, devices, and geographic data.

Request
GET /api/links/clx1abc23def456
Authorization: Bearer YOUR_API_KEY
Response
{
  "id": "clx1abc23def456",
  "url": "https://example.com/my-long-page-url",
  "slug": "my-link",
  "shortUrl": "https://lnk.eco/my-link",
  "clicks": 142,
  "createdAt": "2026-03-21T10:00:00.000Z",
  "analytics": {
    "clicksToday": 12,
    "clicksThisWeek": 87,
    "topReferrers": ["google.com", "twitter.com", "linkedin.com"],
    "devices": { "desktop": 64, "mobile": 71, "tablet": 7 },
    "countries": { "US": 58, "DE": 34, "GB": 22 }
  }
}

Generate QR Code

Generate a QR code image for any short link. Supports PNG and SVG output formats.

Request
GET /api/qr/my-link?format=png
Authorization: Bearer YOUR_API_KEY
Response
Content-Type: image/png
Content-Disposition: inline; filename="my-link.png"

(binary image data)

Code Examples

Get started in minutes with your preferred language. Copy and paste these examples to create your first short link.

cURL

curl -X POST https://lnk.eco/api/links \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "url": "https://example.com/my-page",
    "slug": "demo"
  }'

JavaScript

const response = await fetch("https://lnk.eco/api/links", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY",
  },
  body: JSON.stringify({
    url: "https://example.com/my-page",
    slug: "demo",
  }),
});

const data = await response.json();
console.log(data.shortUrl); // https://lnk.eco/demo

Python

import requests

response = requests.post(
    "https://lnk.eco/api/links",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"url": "https://example.com/my-page", "slug": "demo"},
)

data = response.json()
print(data["shortUrl"])  # https://lnk.eco/demo

Integration Ideas

The lnk.eco API fits into any workflow. Here are a few ways teams use it.

E-commerce

Generate branded short links for product pages and order confirmations. Track which channels drive the most conversions.

SaaS Platforms

Let your users share short links from within your application. White-label the links with custom slugs for a seamless experience.

Marketing Tools

Shorten campaign URLs automatically and pull click data back into your analytics dashboard. Perfect for email, social, and SMS campaigns.

CRM Systems

Attach short links to contacts and deals. Track which prospects click through and feed engagement data directly into your pipeline.

Frequently Asked Questions

Is API access included in the Pro plan?

Yes. API access is included with every paid plan. You can create and manage short links, generate QR codes, and pull analytics using the same REST endpoints available in the dashboard.

What are the API rate limits?

The default rate limit is 60 requests per minute per API key. If you need higher throughput for bulk operations, contact our team to discuss custom limits.

Do I need a separate API key?

You can generate an API key from your dashboard under Settings. Each key is scoped to your account and can be revoked at any time. We recommend creating separate keys for development and production.

Can I retrieve click analytics through the API?

Yes. The GET /api/links/{id} endpoint returns detailed analytics including total clicks, clicks over time, top referrers, device types, and geographic data.

Is there a sandbox or test environment?

During the 7-day free trial, you have full API access. You can also prefix your slugs with test- to create links that do not count toward your usage quota. These test links are automatically deleted after 24 hours.

Start building with the lnk.eco API

Sign up for a free trial and get API access in under two minutes. No credit card required to start.