Links
A link is a destination URL with a short code and its settings. These endpoints create, find, change and delete links.
The link object
Every link endpoint returns this object. Fields you never set come back as null, false, 0 or [].
| Field | Type | Description |
|---|---|---|
id | string | Unique id (UUID). Use it in paths. |
code | string | The short code, for example spring-sale. |
url | string | The destination, with any UTM parameters already added. |
short_url | string | The full short link, on lny.me or your custom domain. |
custom_alias | string | null | The alias you chose, if any. |
created_at | string | When the link was made (ISO 8601). |
expires_at | string | null | When the link stops redirecting. |
activates_at | string | null | When the link starts redirecting. |
clicks | integer | Lifetime clicks. |
max_clicks | integer | null | Click cap. The link stops after this many clicks. |
clicks_remaining | integer | null | Clicks left under the cap. |
last_click_at | string | null | Time of the latest click. |
tags | string[] | Lowercase tags. |
campaign_id | string | null | The campaign this link belongs to. |
domain_id | string | null | The custom domain this link uses. |
domain_host | string | null | That domain's host, for example go.example.com. |
utm | object | null | UTM values: source, medium, campaign, term, content. |
preview | object | null | Page metadata LinkLane fetched: title, description, og_image, favicon, fetched_at. |
has_password | boolean | true if visitors must enter a password. The password itself is never returned. |
routing | object | null | Smart routing rule. See Smart routing. |
fallback_url | string | null | Where to send visitors when the destination is down. |
snapshot_url | string | null | Wayback Machine copy used as a last-resort fallback. |
snapshot_taken_at | string | null | When the snapshot was saved. |
og_overrides | object | null | Custom social preview: title, description, image. |
geo_block | object | null | { "mode": "deny" | "allow", "countries": ["US"] } |
bot_protection | string | null | "block" or "challenge". |
pixels | object | null | Retargeting pixel ids: facebook, google, pinterest, tiktok. |
overlay | object | null | CTA banner shown before the redirect. See CTA overlays. |
track_conversions | boolean | true if LinkLane adds a click id (ll_cid) to the destination. |
conversions | integer | Conversions recorded for this link. |
conversion_value | number | Sum of their values. |
public_stats | boolean | true if the public stats page is on. |
share_token | string | null | Token for the public stats page. |
archived | boolean | Archived links still redirect but are hidden from the default list. |
favorite | boolean | Starred in the app. |
owner_id | string | null | The user who owns the link. |
Create a link
Creates a short link. Only url is required. Every new link counts toward your monthly link limit.
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The destination. Must start with http:// or https://. |
custom_alias | string | No | Your own code: 3–32 letters, numbers, - or _. Returns 409 if taken. Without it, LinkLane picks a random 7-character code. |
domain_id | string | No | Serve the link on a verified custom domain. Get ids from GET /api/domains. |
tags | string[] | No | Up to 10 tags, each 1–32 characters. Stored lowercase; spaces become -. |
utm | object | No | source, medium, campaign, term, content. Added to the destination as utm_* parameters. |
expires_in_days | integer | No | The link stops redirecting after this many days. |
campaign_id | string | No | Add the link to a campaign. Pro and above. |
password | string | No | Visitors must enter it first. Up to 128 characters. Pro and above. |
max_clicks | integer | No | Stop after this many clicks (1–1,000,000). Pro and above. |
activates_at | string | No | ISO 8601 time when the link starts working. Pro and above. |
routing | object | No | Send visitors to different URLs. Pro and above; appstore routing needs Growth. See Smart routing. |
fallback_url | string | No | Used when the destination is down. Pro and above. |
geo_block | object | No | mode ("deny" or "allow") and countries (two-letter codes). Pro and above. |
bot_protection | string | No | "block" or "challenge". Pro and above. |
og_overrides | object | No | Social preview: title (≤120), description (≤300), image (URL). Pro and above. |
track_conversions | boolean | No | Add a click id so you can record conversions. Pro and above. |
pixels | object | No | Pixel ids: facebook, google, pinterest, tiktok. Growth and above. |
overlay | object | No | CTA banner: headline, message, button_text, button_url, theme, countdown. Growth and above. |
A setting your plan doesn't include returns 402 with the feature name. See Errors.
Example
- cURL
- JavaScript
- Python
curl -X POST https://api.linklane.io/api/links \
-H "Authorization: Bearer $LINKLANE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://shop.example.com/spring",
"custom_alias": "spring-sale",
"tags": ["email", "q2"],
"utm": { "source": "newsletter", "medium": "email" }
}'
const res = await fetch("https://api.linklane.io/api/links", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.LINKLANE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
url: "https://shop.example.com/spring",
custom_alias: "spring-sale",
tags: ["email", "q2"],
utm: { source: "newsletter", medium: "email" },
}),
});
const link = await res.json();
console.log(link.short_url);
import os
import requests
res = requests.post(
"https://api.linklane.io/api/links",
headers={"Authorization": f"Bearer {os.environ['LINKLANE_API_KEY']}"},
json={
"url": "https://shop.example.com/spring",
"custom_alias": "spring-sale",
"tags": ["email", "q2"],
"utm": {"source": "newsletter", "medium": "email"},
},
)
res.raise_for_status()
print(res.json()["short_url"])
{
"id": "6f1c2b9e-1d4a-4c39-9a51-0c7e8b2d4f10",
"code": "spring-sale",
"url": "https://shop.example.com/spring?utm_source=newsletter&utm_medium=email",
"short_url": "https://lny.me/spring-sale",
"custom_alias": "spring-sale",
"created_at": "2026-11-30T10:02:11.204000+00:00",
"expires_at": null,
"clicks": 0,
"tags": ["email", "q2"],
"utm": { "source": "newsletter", "medium": "email" },
"campaign_id": null,
"has_password": false,
"track_conversions": false,
"archived": false,
"claim_token": null
}
The landing page can create a link with no auth. Those links have no owner, are limited to 10 an hour per IP, and come back with a one-time claim_token that moves the link into an account at sign-up. With an API key, claim_token is always null.
List links
Returns links in your workspace, newest first, as a JSON array. Archived links are left out unless you ask for them.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
q | string | No | Search the short code and the destination URL. |
tag | string | No | Only links with this tag. |
campaign_id | string | No | Only links in this campaign. |
domain_id | string | No | Only links on this custom domain. |
status | string | No | active, expired, archived or all. Default: every link that isn't archived. |
favorite | boolean | No | true for starred links only. |
sort | string | No | recent (default), clicks or alpha. |
limit | integer | No | 1–500. Default 500. |
cursor | string | No | Paging token from the X-Next-Cursor response header. |
Paging
When more links exist, the response has an X-Next-Cursor header. Send its value as cursor to get the next page. No header means you have them all.
- cURL
- JavaScript
- Python
# -i prints the headers, so you can see X-Next-Cursor
curl -i "https://api.linklane.io/api/links?tag=email&sort=clicks&limit=100" \
-H "Authorization: Bearer $LINKLANE_API_KEY"
async function allLinks(params = {}) {
const links = [];
let cursor;
do {
const query = new URLSearchParams({ ...params, limit: "500", ...(cursor && { cursor }) });
const res = await fetch(`https://api.linklane.io/api/links?${query}`, {
headers: { Authorization: `Bearer ${process.env.LINKLANE_API_KEY}` },
});
links.push(...(await res.json()));
cursor = res.headers.get("X-Next-Cursor");
} while (cursor);
return links;
}
const emailLinks = await allLinks({ tag: "email" });
import os
import requests
def all_links(**params):
links, cursor = [], None
while True:
query = {**params, "limit": 500, **({"cursor": cursor} if cursor else {})}
res = requests.get(
"https://api.linklane.io/api/links",
params=query,
headers={"Authorization": f"Bearer {os.environ['LINKLANE_API_KEY']}"},
)
res.raise_for_status()
links += res.json()
cursor = res.headers.get("X-Next-Cursor")
if not cursor:
return links
email_links = all_links(tag="email")
[
{
"id": "6f1c2b9e-1d4a-4c39-9a51-0c7e8b2d4f10",
"code": "spring-sale",
"short_url": "https://lny.me/spring-sale",
"url": "https://shop.example.com/spring?utm_source=newsletter&utm_medium=email",
"clicks": 1284,
"tags": ["email", "q2"],
"last_click_at": "2026-11-30T09:58:40.117000+00:00"
}
]
Count links
Counts links that match a filter. Takes the same filters as List links: q, tag, campaign_id, domain_id, status and favorite.
curl "https://api.linklane.io/api/links/count?status=expired" \
-H "Authorization: Bearer $LINKLANE_API_KEY"
{ "count": 12 }
Get a link
Returns one link object. Returns 404 if the link isn't in your workspace.
curl https://api.linklane.io/api/links/6f1c2b9e-1d4a-4c39-9a51-0c7e8b2d4f10 \
-H "Authorization: Bearer $LINKLANE_API_KEY"
Update a link
Changes only the fields you send. Takes every create parameter except that expires_in_days counts from now. It returns the updated link.
To remove a setting, send its clear flag set to true. Sending null does nothing.
| Name | Type | Required | Description |
|---|---|---|---|
clear_expiration | boolean | No | Remove the expiry. |
clear_utm | boolean | No | Remove UTM values and strip utm_* from the destination. |
clear_campaign | boolean | No | Take the link out of its campaign. |
clear_password | boolean | No | Remove the password. |
clear_max_clicks | boolean | No | Remove the click cap. |
clear_activation | boolean | No | Remove the start time. |
clear_tags | boolean | No | Remove all tags. |
clear_routing | boolean | No | Remove the routing rule. |
clear_fallback | boolean | No | Remove the fallback URL. |
clear_og_overrides | boolean | No | Remove the custom social preview. |
clear_geo_block | boolean | No | Remove geo-blocking. |
clear_bot_protection | boolean | No | Turn off bot protection. |
clear_pixels | boolean | No | Remove retargeting pixels. |
clear_overlay | boolean | No | Remove the CTA banner. |
public_stats | boolean | No | Turn the public stats page on or off. Pro and above. |
archived | boolean | No | Archive or unarchive. All plans. |
favorite | boolean | No | Star or unstar. All plans. |
If you change url and send no utm, the link keeps its UTM values on the new destination.
Changing custom_alias changes the short code. The old short URL stops working, so printed QR codes and shared links that use it break.
- cURL
- JavaScript
- Python
curl -X PATCH https://api.linklane.io/api/links/6f1c2b9e-1d4a-4c39-9a51-0c7e8b2d4f10 \
-H "Authorization: Bearer $LINKLANE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "url": "https://shop.example.com/summer", "clear_password": true }'
const id = "6f1c2b9e-1d4a-4c39-9a51-0c7e8b2d4f10";
const res = await fetch(`https://api.linklane.io/api/links/${id}`, {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.LINKLANE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ url: "https://shop.example.com/summer", clear_password: true }),
});
const link = await res.json();
import os
import requests
link_id = "6f1c2b9e-1d4a-4c39-9a51-0c7e8b2d4f10"
res = requests.patch(
f"https://api.linklane.io/api/links/{link_id}",
headers={"Authorization": f"Bearer {os.environ['LINKLANE_API_KEY']}"},
json={"url": "https://shop.example.com/summer", "clear_password": True},
)
link = res.json()
{
"id": "6f1c2b9e-1d4a-4c39-9a51-0c7e8b2d4f10",
"code": "spring-sale",
"url": "https://shop.example.com/summer?utm_source=newsletter&utm_medium=email",
"has_password": false
}
Delete a link
Deletes the link and all of its click events. This can't be undone. To hide a link but keep its data, set archived: true instead.
curl -X DELETE https://api.linklane.io/api/links/6f1c2b9e-1d4a-4c39-9a51-0c7e8b2d4f10 \
-H "Authorization: Bearer $LINKLANE_API_KEY"
{ "ok": true }
Dashboard-only link endpoints
The app uses these. They need a dashboard session, not an API key.
Adds a click goal: kind (clicks_total or clicks_unique), threshold (1–10,000,000) and an optional notify_email. Up to 5 goals per link. GET on the same path lists them, and DELETE /api/links/{link_id}/goals/{goal_id} removes one.
Lists your tags with how many links use each: [{ "name": "email", "count": 14 }].
Fetches the destination's title, description and image again.
Saves a Wayback Machine copy of the destination. LinkLane serves it if the destination goes down. Returns 502 if the Wayback Machine doesn't answer.