تخطي إلى المحتوى
GET AI agent ready /v1/short-url/{slug}/stats

Short URL Stats API - GET /short-url/{slug}/stats

REST-convention read endpoint. Pass the short-URL slug in the path and receive the click counter, original URL, and creation timestamp. Clicks increment in real time as redirects happen through /v1/short-url/r/{slug}. Returns 404 NOT_FOUND when the slug does not exist.

Parameters

stringrequired

Slug of the short URL (auto-generated 6-char code or a custom slug supplied at creation).

Code examples

curl -X POST https://api.botoi.com/v1/short-url/{slug}/stats \
  -H "Content-Type: application/json" \
  -d '{"slug":"getting-started"}'

When to use this API

Dashboard widgets for link performance

Render a "Top links this week" card in your admin panel by GETting stats for each slug. GET makes the response cacheable at your browser or CDN with a short max-age.

Bot-driven click reports

Schedule a daily job that hits GET /v1/short-url/{slug}/stats for every campaign slug and posts a summary in Slack. The per-slug path makes it trivial to parallelize.

Threshold-based alerts

Poll the endpoint and fire an alert the first time clicks crosses 1,000 for a promo link. Use the created_at field to compute the time-to-threshold for marketing reports.

Frequently asked questions

Why the /{slug}/stats path shape?
It reads as "stats for this slug" and matches REST conventions for a sub-resource of the short-URL root. It also plays well with CDN cache keys and analytics tooling that groups URLs by path template.
How real-time are click counts?
Each redirect through /v1/short-url/r/{slug} increments the counter immediately. Cloudflare KV is eventually consistent, so there can be a sub-second window before a fresh GET reflects the latest click.
Does GET count as a click?
No. Only the redirect endpoint increments clicks. Calling /stats as often as you like does not pollute the counter.
What happens when the slug is unknown?
You get a 404 with code NOT_FOUND. Verify the slug spelling or check that the short link was not deleted from storage.

Get your API key

Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.