URL Shortener REST API
The StackBloom URL Shortener exposes a REST API so you can create, manage, and analyze short links directly from your own applications, scripts, or automation workflows — without touching the dashboard at all.
Step 1: Get your API key from the dashboard
Navigate to your URL Shortener dashboard and open Settings > API Keys. Click Generate New Key, give it a descriptive name (e.g., "Production App" or "Zapier Integration"), and copy the key immediately — it will only be shown once.
- Each workspace can have multiple API keys with independent rate limits
- You can revoke any key at any time from the API Keys settings page
- Keys are scoped to the workspace they are created in — they cannot access other workspaces
- Store your key in an environment variable, never hard-code it in source files
Step 2: Authenticate requests with a Bearer token header
Include your API key as a Bearer token in the Authorization header of every request. All API endpoints require authentication — unauthenticated requests receive a401 Unauthorized response.
- Header format:
Authorization: Bearer YOUR_API_KEY - All requests must use HTTPS — HTTP requests are rejected
- Set
Content-Type: application/jsonfor POST and PUT requests with a body - The base URL for all API endpoints is
https://stackbloom.io/api/links
Step 3: Create a short link via POST /api/links
Send a POST request to /api/links with a JSON body containing the destination URL and any optional parameters. The response includes the generated short URL and a link ID you can use for future operations.
url(required) — the full destination URL to redirect toslug(optional) — a custom path such asmy-campaign; auto-generated if omittedtags(optional) — an array of strings to categorize the linkexpiresAt(optional) — an ISO 8601 datetime after which the link stops redirecting
Step 4: Retrieve link analytics via GET /api/links/:id/analytics
Send a GET request to /api/links/:id/analytics, replacing :idwith the link's ID returned when it was created. The response contains click totals and breakdowns by country, device, browser, and referrer.
- Pass
?from=2026-01-01&to=2026-01-31query params to scope the date range - The
totalClicksfield counts all redirects;uniqueClicksdeduplicates by IP - Breakdown arrays are sorted by count descending so the top entry is always first
- Use this endpoint on a schedule to push link stats into your own data warehouse
Step 5: Manage links with PUT and DELETE endpoints
Update any link property by sending a PUT request to /api/links/:id with only the fields you want to change. To permanently remove a link and stop all redirects, send a DELETE request to the same path.
- PUT supports partial updates — only include the fields you are changing
- You can change the destination URL of an existing short link without affecting its slug
- Deleting a link is irreversible; visitors to the short URL will receive a 404
- Successful DELETE requests return
204 No Contentwith an empty body
💡 Tip: Rate limiting is 1,000 requests per hour per API key on the Pro plan. If you need higher limits for bulk operations, batch your link creations using thePOST /api/links/bulk endpoint, which accepts up to 100 links per request and counts as a single API call against your rate limit quota.