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.
Retrieve a list of all links in your organization.
q
GET /links/?q=example
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
[
{
"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
}
]
Create a new short link.
long_url
domain
keyword
tags
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"]
}
{
"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
}
Retrieve a specific link by its ID.
id
GET /links/abc123/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
{
"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
}
Update an existing link. Note: domain and keyword cannot be changed after creation.
id
long_url
tags
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"]
}
{
"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 a link permanently.
id
DELETE /links/abc123/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
HTTP/1.1 204 No Content
Retrieve a list of all domains (both custom and default domains).
q
is_custom
GET /domains/?is_custom=true
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
[
{
"id": "dom123",
"name": "custom.example.com",
"is_custom": true,
"status": "connected",
"organization": "org456"
}
]
Add a new custom domain to your organization.
name
POST /domains/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
Content-Type: application/json
{
"name": "custom.example.com"
}
{
"id": "dom123",
"name": "custom.example.com",
"is_custom": true,
"status": "pending",
"organization": "org456"
}
Retrieve a specific domain by its ID.
id
GET /domains/dom123/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
{
"id": "dom123",
"name": "custom.example.com",
"is_custom": true,
"status": "connected",
"organization": "org456"
}
Update domain settings.
id
name
PUT /domains/dom123/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
Content-Type: application/json
{
"name": "updated.example.com"
}
{
"id": "dom123",
"name": "updated.example.com",
"is_custom": true,
"status": "pending",
"organization": "org456"
}
Remove a custom domain from your organization. Links using this domain will revert to the default domain.
id
DELETE /domains/dom123/
Host: api.linkbar.co
X-API-Key: YOUR_API_KEY
HTTP/1.1 204 No Content