Docs

API Reference

A comprehensive guide to the Linkbar API. All endpoints require authentication via API key.

A link is a shortened URL that redirects to a long URL. You can create, retrieve, update, and delete links using the API.

GET/links/

Retrieve a list of all links in your organization.

Query Parameters

q
string
Search query to filter by URL or keyword
Request
GET /links/?q=example
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
Response
[
  {
    "id": "abc123",
    "created_at": "2024-01-15T10:30:00.123456Z",
    "organization": "org456",
    "user": {
      "id": "usr789",
      "name": "John Doe",
      "email": "john@example.com",
      "gravatar_url": "https://gravatar.com/avatar/hash.jpg?s=90&d=mp"
    },
    "short_url": "https://lnk.bar/xyz789",
    "pretty_url": "lnk.bar/xyz789",
    "domain": "lnk.bar",
    "keyword": "xyz789",
    "long_url": "https://example.com",
    "tags": ["marketing", "campaign"],
    "click_count": 42
  }
]
POST/links/

Create a new short link.

Request Body

long_url
string
Required. The destination URL (max 2000 chars)
domain
string
Domain name (defaults to lnk.bar)
keyword
string
Custom keyword (max 16 chars, letters/numbers/underscore/hyphen only)
tags
array
Array of tag strings
Request
POST /links/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
Content-Type: application/json

{
  "long_url": "https://example.com/very-long-url",
  "domain": "lnk.bar",
  "keyword": "my-link",
  "tags": ["marketing", "campaign"]
}
Response
{
  "id": "abc123",
  "created_at": "2024-01-15T10:30:00.123456Z",
  "organization": "org456",
  "user": {
    "id": "usr789",
    "name": "John Doe",
    "email": "john@example.com",
    "gravatar_url": "https://gravatar.com/avatar/hash.jpg?s=90&d=mp"
  },
  "short_url": "https://lnk.bar/my-link",
  "pretty_url": "lnk.bar/my-link",
  "domain": "lnk.bar",
  "keyword": "my-link",
  "long_url": "https://example.com/very-long-url",
  "tags": ["marketing", "campaign"],
  "click_count": 0
}
GET/links/{id}/

Retrieve a specific link by its ID.

Path Parameters

id
string
Required. The link ID (hashid)
Request
GET /links/abc123/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
Response
{
  "id": "abc123",
  "created_at": "2024-01-15T10:30:00.123456Z",
  "organization": "org456",
  "user": {
    "id": "usr789",
    "name": "John Doe",
    "email": "john@example.com",
    "gravatar_url": "https://gravatar.com/avatar/hash.jpg?s=90&d=mp"
  },
  "short_url": "https://lnk.bar/my-link",
  "pretty_url": "lnk.bar/my-link",
  "domain": "lnk.bar",
  "keyword": "my-link",
  "long_url": "https://example.com/very-long-url",
  "tags": ["marketing", "campaign"],
  "click_count": 42
}
PUT/links/{id}/

Update an existing link. Note: domain and keyword cannot be changed after creation.

Path Parameters

id
string
Required. The link ID

Request Body

long_url
string
The destination URL
tags
array
Array of tag strings
Request
PUT /links/abc123/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
Content-Type: application/json

{
  "long_url": "https://updated-example.com",
  "tags": ["updated", "marketing"]
}
Response
{
  "id": "abc123",
  "created_at": "2024-01-15T10:30:00.123456Z",
  "organization": "org456",
  "user": {
    "id": "usr789",
    "name": "John Doe",
    "email": "john@example.com",
    "gravatar_url": "https://gravatar.com/avatar/hash.jpg?s=90&d=mp"
  },
  "short_url": "https://lnk.bar/my-link",
  "pretty_url": "lnk.bar/my-link",
  "domain": "lnk.bar",
  "keyword": "my-link",
  "long_url": "https://updated-example.com",
  "tags": ["updated", "marketing"],
  "click_count": 42
}
DELETE/links/{id}/

Delete a link permanently.

Path Parameters

id
string
Required. The link ID
Request
DELETE /links/abc123/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
Response
HTTP/1.1 204 No Content

Domains

List Domains

GET/domains/

Retrieve a list of all domains (both custom and default domains).

Query Parameters

q
string
Search query to filter by domain name
is_custom
boolean
Filter to show only custom domains
Request
GET /domains/?is_custom=true
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
Response
[
  {
    "id": "dom123",
    "name": "custom.example.com",
    "is_custom": true,
    "status": "connected",
    "organization": "org456"
  }
]

Create Domain

POST/domains/

Add a new custom domain to your organization.

Request Body

name
string
Required. The domain name (max 32 chars)
Request
POST /domains/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
Content-Type: application/json

{
  "name": "custom.example.com"
}
Response
{
  "id": "dom123",
  "name": "custom.example.com",
  "is_custom": true,
  "status": "pending",
  "organization": "org456"
}

Get Domain

GET/domains/{id}/

Retrieve a specific domain by its ID.

Path Parameters

id
string
Required. The domain ID
Request
GET /domains/dom123/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
Response
{
  "id": "dom123",
  "name": "custom.example.com",
  "is_custom": true,
  "status": "connected",
  "organization": "org456"
}

Update Domain

PUT/domains/{id}/

Update domain settings.

Path Parameters

id
string
Required. The domain ID

Request Body

name
string
The domain name
Request
PUT /domains/dom123/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
Content-Type: application/json

{
  "name": "updated.example.com"
}
Response
{
  "id": "dom123",
  "name": "updated.example.com",
  "is_custom": true,
  "status": "pending",
  "organization": "org456"
}

Delete Domain

DELETE/domains/{id}/

Remove a custom domain from your organization. Links using this domain will revert to the default domain.

Path Parameters

id
string
Required. The domain ID
Request
DELETE /domains/dom123/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
Response
HTTP/1.1 204 No Content

Serving links since 2021

Made in London, UK 🇬🇧

Linkbar is 100% bootstrapped. We don't have investors to keep happy. We keep you happy.

Linkbar gives 1% of its revenue to help remove COâ‚‚ from the atmosphere.

© 2021–2025 Linkbar