battiiinnovate
← Notes
How it works6 min read

What actually happens when you click a short link

Between the tap and the page there are about six steps and, on a good day, 38 milliseconds. Here is every one of them.

Priya Raman·Engineering

A short link looks like nothing: six characters after a domain. What sits behind those six characters is a lookup, a safety decision and a redirect, and it is worth understanding because the details determine whether your link still works in two years.

The six characters

When you shorten a URL we generate a six-character code from a 56-character alphabet. We deliberately leave out the characters that get misread aloud or in print: no lowercase l, no capital I or O, no zero. That gives roughly 30 billion combinations, which is enough that codes never need reusing, and it means a code read off a poster into a phone usually survives the journey.

The code is not derived from your destination. It is random. That matters for a reason people rarely think about: if codes were sequential, anyone could walk the whole namespace and enumerate every link every customer had ever created.

The redirect itself

A click resolves like this:

  1. 01DNS resolves btti.uk to the nearest edge location. For UK traffic that is a London or Manchester point of presence.
  2. 02The edge looks the code up in a replicated key-value store. This is the step that has to be fast, and it is why the store sits at the edge rather than behind a single origin database.
  3. 03The link's status is checked: active, disabled by an abuse report, or expired.
  4. 04A click event is recorded: timestamp, country, referrer, device class. Not a full IP, for reasons covered below.
  5. 05The response is issued as an HTTP 301 or 302 to the destination.
  6. 06The browser follows it. Total time at the median is about 38ms from the UK.
301 or 302, and why it matters to you

A 301 is a permanent redirect and browsers cache it aggressively, which means if you later change the destination, some visitors will keep going to the old one. We issue 302s by default so that editing a destination takes effect immediately, everywhere.

Why the destination stays editable

The code and the destination are stored separately, and the code is the stable half. That is the entire point of putting a short link on something you cannot reprint: a leaflet, a piece of packaging, a conference banner. The campaign page moves, you update the destination, and the QR code someone photographed in March still lands correctly in November.

The link does not know or care what it points at. It only knows it points somewhere, and that somewhere is a value you own.

Creating one from your own code

The API is one POST and one bearer token. There is no SDK to install and no session to manage:

curl -X POST https://api.btti.uk/v1/links \
  -H "Authorization: Bearer $BTTI_TOKEN" \
  -d '{"url":"https://example.com/spring-sale","slug":"spring"}'

→ {"short":"https://btti.uk/spring","clicks":0}

Bulk endpoints take up to 10,000 links per call, which is the usual shape of the problem when a helpdesk or a print run needs codes generated all at once.

Shorten your first link now.

No account needed to try it. Sign up when you want your links kept.