API
One base URL, bearer auth, form or JSON bodies. Create a token in your dashboard.
Create a link
POST https://u4.nz/api/links
Authorization: Bearer $U4_TOKEN
url required http(s) destination
slug optional custom slug; omit for a generated one
expires optional days until the link stops resolving
curl -X POST https://u4.nz/api/links \
-H "Authorization: Bearer $U4_TOKEN" \
-d url="https://example.com/launch" -d slug=launch -d expires=30
{
"slug": "launch",
"short": "https://u4.nz/launch",
"url": "https://example.com/launch",
"expires_at": 1794412800000,
"clicks": 0
}
List your links
curl https://u4.nz/api/links -H "Authorization: Bearer $U4_TOKEN"
Click stats
curl https://u4.nz/api/links/launch/stats -H "Authorization: Bearer $U4_TOKEN"
{
"slug": "launch",
"clicks": 412,
"window_days": 30,
"by_day": [{"day":"2026-09-14","n":37}],
"by_country": [{"k":"NZ","n":121}],
"by_referer": [{"k":"news.ycombinator.com","n":88}],
"by_device": [{"k":"mobile","n":240}]
}
Delete a link
curl -X DELETE https://u4.nz/api/links/launch -H "Authorization: Bearer $U4_TOKEN"
Errors and limits
Errors are {"error":"..."} with a
meaningful status: 400 bad URL or slug,
401 bad token, 404 no such link,
409 slug taken, 429 rate limited.
Anonymous creation from the home page is limited per IP. Authenticated creation is limited per token. Redirects are not limited.