URL shortener with an API and webhooks
Short answer: urlf.ly has both. Its JSON API (base URL https://urlf.ly/api/v1) creates, lists, updates and deletes short links and reads click stats. Webhooks notify you when a link is created, changed, deleted or clicked. Both are part of the Premium plan (USD 10 a month or USD 80 a year).
Get an API key
- Sign in and open API keys from your dashboard.
- Name the key and press Create key.
- Copy the full key. It starts with
uf_and is shown once only. urlf.ly keeps only a hash of each key.
Send the key with every request, either as a Bearer token or in an X-Api-Key header. You can hold up to 20 active keys and revoke any of them from the same page. A missing, wrong or revoked key gets a 401. Keep keys on your server: anyone with a key can manage the links of the account that created it, so do not put one in browser code.
curl -H "Authorization: Bearer uf_YOUR_API_KEY" https://urlf.ly/api/v1/links
A request to https://urlf.ly/api/v1 itself needs no key and returns the API name and version, which makes it a handy first check.
Endpoints
| Method and path | What it does |
|---|---|
GET /links |
List your links, newest first |
POST /links |
Create a link |
GET /links/{ref} |
Get one link |
PATCH /links/{ref} |
Change a link |
DELETE /links/{ref} |
Delete a link |
GET /links/{ref}/stats |
Click stats for a link |
{ref} is the link’s numeric id or its short code. Responses are JSON, and times are UTC in YYYY-MM-DD HH:MM:SS format. The full reference is the urlf.ly API documentation.
Create a link in one request
curl -X POST https://urlf.ly/api/v1/links \
-H "Authorization: Bearer uf_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/blog/launch-day", "title": "Launch post"}'
A successful call returns 201 with the new link, including short_url. If you already have an active link to exactly the same URL, that link is returned instead of a new one, even if you send an alias. Optional fields:
| Field | What it does |
|---|---|
alias |
Your own short code, 3 to 32 letters, numbers, _ or - (Premium) |
title |
A label, up to 200 characters |
notes |
Private notes, up to 2,000 characters |
expiry |
A number of days or a future date such as 2026-12-31; 0 means never |
tags |
A list of strings, or one comma-separated string (Premium) |
max_clicks |
Stop the link after this many counted clicks (Premium) |
password |
Ask visitors for this password, 4 to 72 characters (Premium) |
Country routing and cloaking are set in the dashboard; the API does not change them. For what a password does for visitors, see How to password protect a short link.
Update, delete and read stats
Send only the fields you want to change in a PATCH; fields you leave out keep their value, and null clears title, notes or tags. A DELETE returns 204 and the short link stops working.
curl -H "Authorization: Bearer uf_YOUR_API_KEY" \
https://urlf.ly/api/v1/links/launch/stats
The stats response gives clicks_total, unique_visitors and qr_scans for the life of the link, plus last_7_days (one entry per UTC day), top_countries (up to 15) and top_referrers (up to 10) for the same seven days. Known bots are not counted. For what these numbers mean, see How to track clicks on any link.
Errors and limits
- Each key can make 1,000 requests per hour. Past that you get
429with aRetry-Afterheader giving the seconds to wait. - Request bodies are limited to 64 KB.
- Errors return JSON with one
errormessage. The common ones:401bad key,403API not on your plan or switched off,404unknown link,409alias already taken,422invalid field,429rate limit.
Webhooks instead of polling
Add a webhook from your dashboard to be told when a link is created, changed, deleted or clicked. Each account can have up to 5. Our features page lists Zapier, Slack and HubSpot as tools to connect. If you only need to create many links at once from a spreadsheet, you may not need the API at all: the bulk importer takes up to 100 CSV rows at a time (how-to).
Ideas for what to automate
- Create a short link whenever you publish a post from your CMS, and save the
short_urlin the post. - Generate one tracked link per row of a campaign spreadsheet.
- Pull
statsfor your most important links each morning into a report. - Set a short expiry on links created for a promotion, so they end by themselves.
If several people share this work, teams let a group manage the same links.
What to check when you compare URL shortener APIs
- Full link management (create, update and delete), not only create.
- Stats by API: clicks, unique visitors, countries and referrers.
- Webhooks for clicks and changes, so you do not have to poll.
- Published rate limits and error codes.
- Branded domains:
short_urlshould use your own domain when the link does. On urlf.ly it does.
How other services compare on API access
From each service’s own public pricing page, checked on December 2, 2026:
- Short.io includes API access in every plan, including Free, at up to 50 requests a second. See urlf.ly vs Short.io.
- Rebrandly includes API access on every plan: 100 calls a minute on Free, rising to 1,000 a minute on Growth. See urlf.ly vs Rebrandly.
- TinyURL does not list an API on its pricing page. See urlf.ly vs TinyURL.
- Bitly: see the Bitly comparison.
The honest summary: if you need a free API, Short.io and Rebrandly offer one. urlf.ly’s API sits on Premium alongside its other link controls, with a documented limit of 1,000 requests per key per hour.
FAQ
Is the urlf.ly API free?
No. API keys and webhooks are part of Premium (USD 10 a month or USD 80 a year).
Can I use the API from a browser?
It is meant for servers and scripts. Keep your key secret.
Do API links use my custom domain?
Yes. short_url uses your branded domain when the link is on one.
What does the API not do?
It does not set country routing or cloaking, and it does not remove a password; those are done in the dashboard.
Full reference: urlf.ly API documentation. Plans are compared on the pricing page.
Shorten your links and track every click, free.
JOIN NOW