2026-11-22 · Guide
A URL shortener API with click analytics — custom aliases, expiry and QR codes
Need short links inside your app — for SMS, QR codes or campaign tracking — without running your own redirect server? The URL Shortener & Link Analytics API redirects from Cloudflare's edge in milliseconds and records analytics for you.
Create a link
import requests
HOST = "url-shortener-link-analytics-api1.p.rapidapi.com"
H = {"x-rapidapi-host": HOST, "x-rapidapi-key": "YOUR_RAPIDAPI_KEY"}
r = requests.post(f"https://{HOST}/shorten", headers=H, json={
"url": "https://example.com/black-friday?utm_source=sms",
"alias": "bf26", # optional custom code
"expires_in_hours": 168, # optional
"max_clicks": 10000, # optional
}).json()
print(r["short_url"], r["qr_code"])
Analytics
s = requests.get(f"https://{HOST}/stats", headers=H, params={"code": "bf26", "days": 7}).json()
print(s["period_clicks"], s["countries"][:3], s["devices"], s["referrers"][:3])
Daily clicks, countries, referrers, devices, browsers and operating systems. No IP addresses are stored.
Manage
/update— change the destination, extend or remove expiry, disable or re-enable/links— all links you created/bulk— up to 50 links in one call/expand?url=https://bit.ly/...— resolve any short link to its final destination with the full redirect chain
Every destination is checked against malware and phishing intelligence before a link is created.
Try it free. URL Shortener & Link Analytics API has a free plan on RapidAPI — every endpoint included.
Get your free key