Skip to content
POST AI agent ready /v1/short-url/create

URL Shortener API - Create Short Links with Click Tracking

Submit a URL and receive a shortened link with an auto-generated or custom slug. Short links redirect via 302 and track click counts. Custom slugs support letters, numbers, hyphens, and underscores. If a slug is already taken, the API returns an error so you can retry with a different one.

Parameters

stringrequired

The target URL to shorten. Must be a valid http or https URL.

string

An optional custom slug for the short URL. Letters, numbers, hyphens, and underscores only.

Code examples

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

When to use this API

Generate trackable short links for marketing campaigns

Create a custom-slug short link for each campaign (e.g., /launch-2026). Use the stats endpoint to track clicks and measure engagement without external analytics tools.

Build a link shortener feature into your SaaS product

Let your users create branded short links from within your app. The API handles slug generation, collision detection, and redirect tracking so you don't need to build that infrastructure.

Frequently asked questions

Do short links expire?
Short links created through the API do not have a built-in expiration. They persist in storage until manually removed or the underlying storage is cleared.
What happens if my custom slug is already taken?
The API returns a SLUG_TAKEN error. You can retry with a different slug or omit the custom_slug field to get an auto-generated 6-character slug.
What characters are allowed in custom slugs?
Letters (A-Z, a-z), numbers (0-9), hyphens (-), and underscores (_). Any other characters cause an INVALID_SLUG error.
Are click counts tracked automatically?
Yes. Every time someone visits the short URL, the click counter increments. Use the /v1/short-url/stats endpoint to retrieve the current count.
What type of redirect does the short URL use?
The short URL returns a 302 (temporary) redirect. This means search engines will not transfer link equity to the target URL, and you can change the destination later if needed.

Get your API key

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