Short links overview
Create trackable short links and read their click analytics.
A short link maps a generated 12-character id to a destination URL and records every click. Creating one needs a token; following one does not.
curl -X POST https://api.console.buildbase.app/api/links \
-H "Authorization: $BUILDBASE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Launch announcement","url":"https://example.com/launch"}'The response carries a linkId - that is the public handle - and visitUrl,
the short URL ready to share:
{
"_id": "665f1c2e8b3a4d0012a4b5c6",
"name": "Launch announcement",
"url": "https://example.com/launch",
"linkId": "a7Kd92LmQz01",
"visitUrl": "https://api.console.buildbase.app/api/r/a7Kd92LmQz01?url=https://example.com/launch",
"archived": false
}The ?url= part of visitUrl is the destination as it was when the link was
read. The redirect does not follow it - a visitor always goes to the link's
current url - but each click records it, so you can tell which copy of the
link was followed after you change the destination.
Before you start
name and url are both required. linkId is generated for you - a
12-character random string, unique across the organization. You cannot choose
a custom slug. In the console: Content, then Links, Create link
(step by step: create a short link).
Following a link
Two public redirect routes, neither requiring authentication:
| Path | When to use |
|---|---|
/api/r/:linkId | Short form. Resolves the id without an org |
/api/redirect/:orgId/:linkId | Org-scoped, and the faster lookup |
The short form finds the organization through a cached hint, set when the link is created and renewed by every click. The hint lasts an hour; the first click on a link nobody has followed for longer searches for its organization, so it can be slower, and records the hint again for the clicks after it. The org-scoped route skips that step, so prefer it when you already know the org.
What a click records
Each redirect answers the visitor first and writes an analytics row just after, so a click never waits on the write. A destination that is blocked as unsafe is refused before that, and writes no row.
| Field | Contents |
|---|---|
linkId | The followed link's _id (not its public linkId) |
url | The click's ?url= parameter exactly as the visitor sent it, or empty when it had none. Anyone can set it: show it as text, never as a link |
destinationUrl | Where the visitor was sent |
ip | Client IP |
agent | User agent string |
headers | An allowlist of request headers: user-agent, origin, referer, accept-language, x-forwarded-for and the sec-ch-ua hints. Never cookies or Authorization |
info | Parsed device and browser detail |
ipInfo | Geographic lookup from the IP |
Warning
Clicks are recorded with no bot filtering and no deduplication. A link fetched by a crawler, a link preview unfurler, or an email scanner counts the same as a human click.
Treat the numbers as relative - useful for comparing links, not for reporting unique visitors.
Because IP and geographic data are stored per click, short links carry personal
data. Click rows are deleted after 730 days, and the click list
(GET /api/links-analytics) reads back only as far as your plan's
link-analytics retention allows.
Reading analytics
| Method | Path | Returns |
|---|---|---|
GET | /api/links-analytics | Click rows, paginated |
GET | /api/links-analytics/chart | Clicks over time |
GET | /api/links-analytics/counts | Totals |
Filter by link with the standard filter parameter. A click row's linkId is the link's _id from the
create response, not the 12-character public id, so filter by _id:
curl -G https://api.console.buildbase.app/api/links-analytics \
-H "Authorization: $BUILDBASE_TOKEN" \
--data-urlencode 'filter[linkId]=665f1c2e8b3a4d0012a4b5c6' \
--data-urlencode 'sort[createdAt]=-1'filter and sort may also be sent as one JSON object
(filter={"linkId":"..."}, sort={"createdAt":-1}), which is read the same
way. A filter that is not a JSON object, such as text that does not parse,
is a 400. A public linkId in the filter matches no click row, and answers
an empty list.
Managing links
| Method | Path | Purpose |
|---|---|---|
GET | /api/links | List links, paginated |
GET | /api/links/:id | One link |
PATCH | /api/links/:id | Update name, URL, or archive |
DELETE | /api/links/:id | Delete |
Updating url changes where an already-published link points, which is the main
reason to use one.
Archiving keeps the record and its click history, but the link stops
redirecting: its short URL answers 404 until you unarchive it, and then it
works again as before. Use it as the switch for a link you may want back.
Deleting removes the link for good, and existing shares stop resolving the same
way.
Link safety
A short link sends people to a URL on our domain, so a phishing destination behind one borrows BuildBase's reputation and yours. Destinations are checked twice: when you save them and when someone clicks. The same checks cover tracked links in email and push notification clicks.
When you save a link
The destination has to be an http:// or https:// URL with no username or password in it. https://[email protected]/ reads as PayPal and goes to evil.test, so that shape is refused with Remove the username and password from the URL.
A destination that passes is stored exactly as you sent it, and a click is sent to it unchanged (in the redirect's Location: header, or by the "Checking this link" page below), so https://example.com/search?q=a&page=2 keeps its &page=2. A destination that is not a valid URL, such as one with a raw < or a space in it, is refused with a 400; percent-encode those characters (%3C, %20). A link's name is stored as typed too.
If the server has a reputation provider configured (Google Web Risk), the URL is also looked up before it is stored:
| Verdict | What happens |
|---|---|
| Malicious | Refused with This URL is flagged as unsafe and cannot be saved |
| Suspicious (lower-confidence signals) | Saved, and the verdict is recorded |
| Clean, or the provider cannot answer | Saved |
An outage at the provider never stops you saving a link. The same save-time check runs on push notification click targets, webhook endpoints and deploy hooks.
When someone clicks
Each redirect runs these in order:
- Kill switches. If the destination is on the blocked list, the visitor gets a
403page reading "This link has been blocked". The page never shows the destination, so nobody is invited to copy it into the address bar. For a tracked email link, the message itself can be blocked too, which disables every link in it. - Trusted destinations redirect straight through. That is BuildBase's own hosts plus any domains the server operator lists.
- Everything else gets a short "Checking this link" page that asks for a verdict and then moves on by itself. A clean result continues to the destination. A flagged one shows "This link may be unsafe" and does not continue. If the provider cannot answer, the visitor sees the URL and a Continue button, because an outage is not evidence against anyone's link.
With no reputation provider configured, step 3 is skipped and links redirect as they always have. The kill switches in step 1 still apply.
In tracked email, mailto:, tel: and sms: links go straight through, and javascript:, data: and file: links are refused with the blocked page.
Automatic blocks
When a click-time check comes back malicious, the destination is blocked for your whole organization, not just for the one person who clicked. Every short link and tracked link pointing at it stops resolving, including links in emails already delivered: the email cannot be recalled, but the redirect can be refused. If the click came from a tracked email, that message is blocked as well.
Lower-confidence signals never trigger a block; they only warn the reader. No account is suspended automatically either. BuildBase staff get an alert naming the sending address and campaign, and decide what happens next.
A block covers the page, not one exact address: the same host and path with any query string, and with or without a trailing slash. A blocked destination cannot be saved either. Creating a link to it, or pointing an existing link at it, answers 400 with the reason, so a link cannot be moved around a block. A different path on the same host is not covered.
Note
Blocks are managed by BuildBase, not from your console: an org that could lift its own blocks would make them pointless against abuse. If you think a link was blocked by mistake, contact support. A reversal takes effect on the next click, because the blocked page is never cached.
Self-hosting? The reputation check is optional and off until you set GOOGLE_WEB_RISK_API_KEY. URL_SAFETY_TRUSTED_DOMAINS adds domains that skip the check, and URL_SAFETY_LOG_ONLY=true records verdicts without acting on them, which is a way to measure false positives before you enforce.