Free URL Shortener API for Developers
Need to shorten URLs programmatically? Whether you're building a marketing dashboard, creating trackable links for campaigns, or adding link shortening to your SaaS product — you need a URL shortener API that's fast, flexible, and developer-friendly.
Most URL shortener APIs lock analytics behind $29-99/month plans. We built a free URL shortener API that gives you 50 credits with no signup, supports custom slugs, click analytics with referrer tracking, bulk shortening (50 URLs at once), tags, and link expiration.
Try it right now
Get an API key and shorten your first URL in under 30 seconds. No signup, no credit card.
Get Free API KeyQuick Start: 3 Steps
1. Get a free API key
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/api/keys/create
{
"key": "su_abc123...",
"credits": 100,
"note": "100 free credits. Top up with USDC on Base.",
"check_balance": "GET /api/keys/balance with Authorization: Bearer YOUR_KEY"
}
2. Shorten a URL
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/api/shorten \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/very/long/path?utm_source=newsletter&utm_medium=email"}'
{
"slug": "Mm7iaj",
"shortUrl": "https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/Mm7iaj",
"url": "https://example.com/very/long/path?utm_source=newsletter&utm_medium=email",
"tags": [],
"expiresAt": null,
"created": "2026-03-03T19:47:22.843Z"
}
3. Track clicks
Check analytics for any shortened URL — see total clicks, daily breakdown, top referrers, and user agents:
curl https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/api/urls/Mm7iaj/stats
{
"slug": "Mm7iaj",
"totalClicks": 142,
"clicksByDay": [
{"date": "2026-03-03", "clicks": 89},
{"date": "2026-03-02", "clicks": 53}
],
"topReferrers": [
{"referrer": "twitter.com", "clicks": 67},
{"referrer": "linkedin.com", "clicks": 41}
],
"topUserAgents": [
{"ua": "Chrome/125", "clicks": 98},
{"ua": "Safari/17", "clicks": 44}
]
}
Features
Custom Slugs
Choose your own short URL slug (2-32 chars). Create branded, memorable links like /my-promo or /launch2026.
Click Analytics
Track total clicks, daily/hourly breakdown, top referrers, and user agents. Know exactly where your traffic comes from.
Bulk Shortening
Shorten up to 50 URLs in a single API call. Perfect for batch processing marketing campaigns or migration scripts.
Tags & Metadata
Organize links with tags and custom metadata. Filter and group links by campaign, channel, or any label you choose.
Link Expiration
Set links to auto-expire after a specified duration. Great for time-limited promotions, temporary sharing, or security.
Update & Delete
Change the destination URL of any link or delete it entirely. Full CRUD control over all your shortened links.
API Reference
| Endpoint | Method | Description |
|---|---|---|
/api/shorten | POST | Shorten a URL (optional: custom slug, tags, expiration, metadata) |
/api/shorten/bulk | POST | Shorten up to 50 URLs in one call |
/api/urls | GET | List all your shortened URLs |
/api/urls/:slug | GET | Get URL info (destination, tags, created date) |
/api/urls/:slug/clicks | GET | Get click history with timestamps |
/api/urls/:slug/stats | GET | Get analytics: clicks by day/hour, referrers, user agents |
/api/urls/:slug | PUT | Update the destination URL |
/api/urls/:slug | DELETE | Delete a shortened URL |
/:slug | GET | Redirect to the original URL (the short link itself) |
Shorten Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The URL to shorten (must be valid) |
slug | string | No | Custom slug (2-32 alphanumeric, hyphens, underscores) |
tags | array | No | Array of tag strings for organization |
expiresIn | string | No | Expiration duration (e.g., "24h", "7d", "30d") |
metadata | object | No | Custom key-value metadata |
Code Examples
# Shorten a URL (free tier, no key needed)
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/api/shorten \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/long-path"}'
# Custom slug + tags
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/api/shorten \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/promo", "slug": "spring-sale", "tags": ["marketing", "q1"]}'
# Bulk shorten (requires API key)
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/api/shorten/bulk \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"urls": ["https://google.com", "https://github.com", "https://reddit.com"]}'
# Get click analytics
curl https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/api/urls/spring-sale/stats
# Update destination URL
curl -X PUT https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/api/urls/spring-sale \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/summer-sale"}'
# Delete a link
curl -X DELETE https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/api/urls/spring-sale \
-H "Authorization: Bearer YOUR_KEY"
import requests
API = "https://agent-gateway-kappa.vercel.app/v1/agent-shorturl"
# Step 1: Get free API key
key_resp = requests.post(f"{API}/api/keys/create")
api_key = key_resp.json()["key"]
print(f"API Key: {api_key}")
headers = {"Authorization": f"Bearer {api_key}"}
# Step 2: Shorten a URL with custom slug
resp = requests.post(
f"{API}/api/shorten",
headers=headers,
json={
"url": "https://example.com/my-long-blog-post-title",
"slug": "my-blog",
"tags": ["blog", "content"]
}
)
short = resp.json()
print(f"Short URL: {short['shortUrl']}")
# Step 3: Check analytics later
stats = requests.get(
f"{API}/api/urls/my-blog/stats",
headers=headers
)
data = stats.json()
print(f"Total clicks: {data['totalClicks']}")
for ref in data.get("topReferrers", []):
print(f" {ref['referrer']}: {ref['clicks']} clicks")
# Bulk shorten for a campaign
campaign_urls = [
"https://example.com/product-a",
"https://example.com/product-b",
"https://example.com/product-c",
"https://example.com/pricing",
"https://example.com/signup",
]
bulk_resp = requests.post(
f"{API}/api/shorten/bulk",
headers=headers,
json={"urls": campaign_urls}
)
for link in bulk_resp.json().get("results", []):
print(f"{link['url']} -> {link['shortUrl']}")
const API = 'https://agent-gateway-kappa.vercel.app/v1/agent-shorturl';
async function shortenLinks() {
// Step 1: Get free API key
const keyResp = await fetch(`${API}/api/keys/create`, { method: 'POST' });
const { key } = await keyResp.json();
console.log(`API Key: ${key}`);
const headers = {
'Authorization': `Bearer ${key}`,
'Content-Type': 'application/json'
};
// Step 2: Shorten with custom slug
const resp = await fetch(`${API}/api/shorten`, {
method: 'POST',
headers,
body: JSON.stringify({
url: 'https://example.com/long-path',
slug: 'demo',
tags: ['test']
})
});
const link = await resp.json();
console.log(`Short URL: ${link.shortUrl}`);
// Step 3: Get analytics
const stats = await fetch(`${API}/api/urls/demo/stats`, { headers });
const data = await stats.json();
console.log(`Clicks: ${data.totalClicks}`);
data.topReferrers?.forEach(r =>
console.log(` ${r.referrer}: ${r.clicks}`)
);
}
shortenLinks();
Use Cases
Marketing Campaign Tracking
Create unique short links for each marketing channel — email, social media, ads, influencers — and track which channels drive the most clicks. Use tags to group links by campaign and metadata to store attribution data.
# Create channel-specific links for a product launch
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/api/shorten \
-H "Content-Type: application/json" \
-d '{"url": "https://myapp.com/launch", "slug": "launch-twitter", "tags": ["launch", "twitter"]}'
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/api/shorten \
-H "Content-Type: application/json" \
-d '{"url": "https://myapp.com/launch", "slug": "launch-email", "tags": ["launch", "email"]}'
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/api/shorten \
-H "Content-Type: application/json" \
-d '{"url": "https://myapp.com/launch", "slug": "launch-reddit", "tags": ["launch", "reddit"]}'
SaaS In-App Link Shortening
Add link shortening directly to your application. Let users create shareable links for dashboards, reports, or documents. The API handles generation, tracking, and expiration — you just display the results.
AI Agent Tool Use
Give your AI agent the ability to create and manage short links. When your agent generates a report, schedules a meeting, or shares a resource — it can create a trackable short link automatically.
# AI agent creates a short link for a generated report
curl -X POST https://agent-gateway-kappa.vercel.app/v1/agent-shorturl/api/shorten \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://app.com/reports/q1-2026.pdf", "slug": "q1-report", "expiresIn": "30d", "metadata": {"generated_by": "ai-agent", "report_type": "quarterly"}}'
Temporary & Expiring Links
Share links that automatically expire. Perfect for time-limited promotions, one-time download links, or temporary access to resources. Set expiration with the expiresIn parameter.
Comparison: URL Shortener APIs in 2026
| Feature | Agent Short URL | Bitly | Rebrandly | TinyURL | Short.io |
|---|---|---|---|---|---|
| Free tier | 100 links | 10 links/mo | 25 links/mo | Unlimited* | 1,000 links |
| Signup required | No | Yes | Yes | No | Yes |
| Custom slugs | Yes (free) | Paid only | Yes | No | Yes |
| Click analytics | Yes (free) | Limited free | Yes | No | Yes |
| Bulk shortening | 50 per call | CSV upload | API only | No | API only |
| Link expiration | Yes | Paid only | No | No | Yes |
| Tags / metadata | Yes | Yes | Yes | No | Yes |
| Referrer tracking | Yes | Yes | Yes | No | Yes |
| Paid plans from | $0.001/link | $8/mo | $13/mo | $9.99/mo | $19/mo |
| API style | REST | REST | REST | REST | REST |
* TinyURL offers unlimited free shortening but with no analytics, no custom slugs, and no API management. Agent Short URL provides the full feature set — custom slugs, analytics, bulk operations, expiration — with no signup and a generous free tier.
Build a Link Analytics Dashboard
Here's a complete Python script that creates campaign links and generates a daily click report:
import requests
from datetime import datetime
API = "https://agent-gateway-kappa.vercel.app/v1/agent-shorturl"
# Setup: get API key (save for reuse)
def get_key():
resp = requests.post(f"{API}/api/keys/create")
return resp.json()["key"]
# Create campaign links
def create_campaign(api_key, base_url, campaign_name, channels):
headers = {"Authorization": f"Bearer {api_key}"}
links = []
for channel in channels:
slug = f"{campaign_name}-{channel}"
resp = requests.post(
f"{API}/api/shorten",
headers=headers,
json={
"url": f"{base_url}?utm_source={channel}&utm_campaign={campaign_name}",
"slug": slug,
"tags": [campaign_name, channel]
}
)
links.append(resp.json())
print(f"[{channel}] {resp.json()['shortUrl']}")
return links
# Generate click report
def report(api_key, slugs):
headers = {"Authorization": f"Bearer {api_key}"}
print(f"\n--- Click Report ({datetime.now().strftime('%Y-%m-%d')}) ---")
total = 0
for slug in slugs:
stats = requests.get(f"{API}/api/urls/{slug}/stats", headers=headers).json()
clicks = stats.get("totalClicks", 0)
total += clicks
print(f" {slug}: {clicks} clicks")
for ref in stats.get("topReferrers", [])[:3]:
print(f" <- {ref['referrer']}: {ref['clicks']}")
print(f" Total: {total} clicks")
# Usage
key = get_key()
channels = ["twitter", "linkedin", "email", "reddit"]
links = create_campaign(key, "https://myapp.com/launch", "spring26", channels)
slugs = [l["slug"] for l in links]
report(key, slugs)
Start shortening URLs now
100 free links with click analytics. No signup, no credit card, no rate limits on the free tier.
Get Free API KeyFrequently Asked Questions
How many free links do I get?
100 links with each API key. No signup or credit card required. Paid credits cost $0.001 per link (1,000 credits per USDC). Single URL shortening works even without an API key on the free tier.
Do I need to sign up or create an account?
No. Call POST /api/keys/create to get an API key instantly. No email, no OAuth, no registration form. You can start shortening URLs immediately without even creating a key.
Can I use custom slugs?
Yes, custom slugs are free. Use 2-32 alphanumeric characters, hyphens, or underscores. If your chosen slug is already taken, you'll get a 409 conflict response. Random 6-character slugs are generated if you don't specify one.
How does click tracking work?
Every time someone visits a shortened URL, the API records the click with timestamp, referrer, and user agent. You can query analytics via /api/urls/:slug/stats to see clicks by day, by hour, top referrers, and top user agents.
Do links expire?
Links are permanent by default. You can optionally set expiration with the expiresIn parameter (e.g., "24h", "7d", "30d"). Expired links return a 410 Gone status.
Can I update the destination URL?
Yes. Use PUT /api/urls/:slug to change the destination URL without changing the short link itself. This is useful for A/B testing or updating promotion links.
Is there a rate limit?
Free tier: 30 requests per minute. With an API key and credits: 120 requests per minute. Bulk shortening counts as one request for up to 50 URLs.
More Developer Tools
- Free Webhook Testing Tool — capture and inspect HTTP requests
- Free Screenshot API — capture website screenshots programmatically
- Free Web Scraping API — extract content from any URL
- Free Code Execution API — run Python, JavaScript, Bash online
- Free IP Geolocation API — locate any IP address
- Explore all 39+ APIs in the Clawdia catalog