Short links
The product's core resource. A short link maps a public path
(janedoe/mydeal) to a destination URL, with health tracking, scheduling,
routing, and analytics attached. Affiliate links are the same primitive with
extra behaviour — see affiliate links.
Every path below is relative to https://lsg.bio/api/v1 and needs the scope
shown. The full field table lives on the endpoints page; this
page is the guided tour.
The five routes
| Method | Path | Scope |
|---|---|---|
GET | /links | links:read |
POST | /links | links:write |
GET | /links/{id} | links:read |
PATCH | /links/{id} | links:write |
DELETE | /links/{id} | links:delete |
{id} is the link's UUID — the id field, not its path.
# List — newest first, 25 per page
curl "https://lsg.bio/api/v1/links" \
-H "Authorization: Bearer lsgbio_YOUR_TOKEN"
# Create
curl https://lsg.bio/api/v1/links \
-H "Authorization: Bearer lsgbio_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"destination_url": "https://example.com/spring-promo",
"custom_slug": "spring",
"title": "Spring promo",
"tags": ["newsletter"]
}'
# Read one
curl https://lsg.bio/api/v1/links/6cb5cd5b-a2c8-4238-b548-b25991bc0559 \
-H "Authorization: Bearer lsgbio_YOUR_TOKEN"
# Pause it
curl -X PATCH https://lsg.bio/api/v1/links/6cb5cd5b-a2c8-4238-b548-b25991bc0559 \
-H "Authorization: Bearer lsgbio_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"is_active": false}'
# Delete it (204, no body)
curl -i -X DELETE https://lsg.bio/api/v1/links/6cb5cd5b-a2c8-4238-b548-b25991bc0559 \
-H "Authorization: Bearer lsgbio_YOUR_TOKEN"
POST answers 201 with { "link": {...}, "slug_was_taken": false }.
When custom_slug is taken, a {slug}-{4char} path is assigned instead and
slug_was_taken is true — read the result rather than assuming the path.
PATCH has no PUT: every field is optional and absent means unchanged.
Deletion is permanent and takes the link's analytics with it; repeating a
delete answers 404, which is the truth.
Listing: filtering, sorting, pagination
curl "https://lsg.bio/api/v1/links?page_size=50&query=promo&sort=clicks&health=broken&tag=newsletter&spark_days=30" \
-H "Authorization: Bearer lsgbio_YOUR_TOKEN"
| Parameter | Values | Default |
|---|---|---|
page_size | Positive integer; values above 100 are served as 100 | 25 |
page_token | The next_page_token from the previous page | — |
query | Substring match over path, title, and destination | — |
kind | short, affiliate | all |
sort | newest, oldest, clicks, path | newest |
active | true, false | all |
health | healthy, broken, unknown | all |
tag | Only links carrying this tag | — |
spark_days | Days of history inlined as spark; 0 means the 7-day default, clamped to the plan's analytics window and an absolute ceiling of 365 | 7 |
Unrecognized values are rejected with 400 / validation_failed rather than
quietly ignored. total_count ignores pagination — it is the whole result
set. Paginate until next_page_token is absent.
spark is the per-row click series, oldest first and dense (a quiet day is a
0, not a gap), drawn from the same window the dashboard's trend column
uses. It is returned by list only, never by read.
Rate limits
Link routes share the per-token budget documented in
rate limits: 120 requests per minute by default, ×10 on
Business, with the applied limit echoed back in X-RateLimit-Limit. List
efficiently — one filtered list call instead of fifty detail calls.
POST /links adds one narrower budget: 30 link creations per minute per
account, so minting extra tokens does not raise it. Send an
Idempotency-Key and a retry replays the original 201 instead of creating a
duplicate — see safe retries.
Beyond CRUD
- Link health —
healthvalues,health_reason, rechecking. - Scheduling & click caps —
starts_at,expires_at,max_clicks,clicks_remaining. - Geo & A/B routing — country/city rules and variants.
- Webhooks — lifecycle events over RPC (no REST route).
- Import & export — CSV bulk management over the dashboard session.
- Retargeting pixels — the five providers.