API v1

Linktain API

Create locked links and read your stats programmatically. All endpoints return JSON and live under https://linktain.com/api/v1.

Authentication

Every request must carry an API key in the Authorization header. Keys start with lt_ and are created in Dashboard → Settings. The full key is shown exactly once at creation, so store it somewhere safe. Revoked keys stop working immediately.

Authorization: Bearer lt_your_api_key_here

Errors always use the shape { "error": "..." } with a matching HTTP status: 400 invalid input, 401 missing/invalid key, 403 banned account, 404 not found.

Money fields are integer USD mills: 1000 mills = $1.00. A single unlock is typically worth a few mills.

POST

/api/v1/links

Create a locked link. Body fields: title (1–120 chars) and destinationUrl (http/https URL). Returns 201 with the new link, including its shareable short URL.

curl -X POST https://linktain.com/api/v1/links \
  -H "Authorization: Bearer lt_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"title": "My download", "destinationUrl": "https://example.com/file"}'
{
  "id": "cmd7x1abc0001xyz",
  "slug": "x7k2m9a",
  "shortUrl": "https://linktain.com/l/x7k2m9a",
  "title": "My download",
  "destinationUrl": "https://example.com/file",
  "createdAt": "2026-07-27T12:00:00.000Z"
}
GET

/api/v1/links

List all of your links, newest first, with lifetime totals per link: views (gate visits), unlocks and earnedMills.

curl https://linktain.com/api/v1/links \
  -H "Authorization: Bearer lt_your_api_key_here"
{
  "links": [
    {
      "id": "cmd7x1abc0001xyz",
      "slug": "x7k2m9a",
      "shortUrl": "https://linktain.com/l/x7k2m9a",
      "title": "My download",
      "destinationUrl": "https://example.com/file",
      "active": true,
      "views": 1523,
      "unlocks": 1284,
      "earnedMills": 6420,
      "createdAt": "2026-07-27T12:00:00.000Z"
    }
  ]
}
GET

/api/v1/links/:id/stats

Detailed stats for one of your links. Returns 404 if the link does not exist or belongs to another account. paidUnlocks counts unlocks that earned money (unique visitor per 24h); last14d is a zero-filled daily series (UTC dates, oldest first).

curl https://linktain.com/api/v1/links/cmd7x1abc0001xyz/stats \
  -H "Authorization: Bearer lt_your_api_key_here"
{
  "views": 1523,
  "unlocks": 1284,
  "paidUnlocks": 1180,
  "earnedMills": 6420,
  "last14d": [
    { "date": "2026-07-14", "views": 96, "unlocks": 80 },
    { "date": "2026-07-15", "views": 112, "unlocks": 95 }
  ]
}

Ready to build?

Create an API key in Dashboard → Settings and make your first request.

Get an API key