Read your links and stats programmatically
Two read-only endpoints — your links and their click stats — authenticated with a bearer token. Available on the Pro plan.
Create an accountAuthentication
Send your token as a bearer token on every request:
Authorization: Bearer <token>
Requests without a valid token get a 401. See Errors below.
Base URL
https://linksling.com/api/v1
GET /links
Your links, most recent first, with click counts and health status.
Query parameters
| Name | Type | Description |
|---|---|---|
| per_page | integer | Results per page. Default 50, max 200. |
Request
curl https://linksling.com/api/v1/links \ -H "Authorization: Bearer <token>"
Response 200
{
"current_page": 1,
"data": [
{
"id": 42,
"slug": "jbl-charge-6",
"title": "JBL Charge 6",
"short_url": "https://linksling.com/jbl-charge-6",
"is_active": true,
"status": "healthy",
"clicks": 8412
}
],
"first_page_url": "https://linksling.com/api/v1/links?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "https://linksling.com/api/v1/links?page=1",
"next_page_url": null,
"path": "https://linksling.com/api/v1/links",
"per_page": 50,
"prev_page_url": null,
"to": 1,
"total": 1
}status is "broken" when the link has a destination currently failing health checks, otherwise "healthy".
GET /links/{slug}/stats
Click totals for one link over the trailing 30 days, broken down by country and device. slug is the part of your short URL after the domain.
Request
curl https://linksling.com/api/v1/links/jbl-charge-6/stats \ -H "Authorization: Bearer <token>"
Response 200
{
"slug": "jbl-charge-6",
"title": "JBL Charge 6",
"period_days": 30,
"total_clicks": 812,
"degraded_clicks": 14,
"by_country": [
{ "country": "US", "total": 640 },
{ "country": "unknown", "total": 58 }
],
"by_device": [
{ "device": "mobile", "total": 500 },
{ "device": "desktop", "total": 312 }
]
}degraded_clicks counts clicks served by a backup destination after the primary failed a health check. Returns 404 if the slug doesn't belong to you.
Errors
| Status | Body |
|---|---|
| 401 | {"message": "Missing API token. Send it as: Authorization: Bearer <token>."} |
| 401 | {"message": "Invalid API token."} |
| 404 | Returned from the stats endpoint when the slug doesn't exist or isn't yours. |