Use the Alshorty API to shorten URLs, build Link-in-Bio pages, create and publish SmartPages, track analytics, and automate link workflows — all from a single REST API, running on Cloudflare's edge.
Alshorty exposes three core products through this API: a URL Shortener for creating and managing short links with analytics, a Link-in-Bio builder for creating customisable bio pages at alshorty.com/bio/yourname, and SmartPages — a conversion-focused page builder that lives at alshorty.com/p/your-slug. All three are accessible with a single API key.
Base URL
https://alshorty.comAuth header
Authorization: Bearer sk_…Response format
JSON (application/json)All API endpoints require an API key passed in the Authorization header.
curl https://alshorty.com/api/shorten \
-H "Authorization: Bearer sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com"}'Rate limits: 120 requests/min for general endpoints · 20 requests/min for auth endpoints.
Error format: { "error": "ERROR_CODE", "message": "..." }
Create a new short link. Optionally provide a custom alias, category, expiry, and password.
Authorization: Bearer YOUR_API_KEYRequest body
urlstringrequiredThe destination URL to shorten.
domainstringoptionalDomain prefix. Free/anon: always alshorty.com/link. PRO options: alshorty.com/link, alshorty.com/s, alshorty.com/go, alshorty.com/run.
aliasstringoptionalCustom alias (logged-in users only; 5/month free, 100/month PRO). PRO users can also use category/alias format (e.g. books/my-link).
categorystringoptionalCategory slug used as a URL prefix.
expiresAtnumberoptionalUnix timestamp (ms) when the link expires.
passwordstringoptionalOptional password protection for the redirect.
tagsstring[]optionalArray of tag strings for organisation.
Response
{
"ok": true,
"short_url": "https://alshorty.com/link/my-link",
"code": "my-link"
}curl -X POST "https://alshorty.com/api/shorten" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com","alias":""}'Edit request body
Used in the links array of bio create/update payloads.
titlestringrequiredDisplay text for the link button (max 100 chars).
urlstringrequiredDestination URL (must be https://). Empty string for section headers.
iconstringoptionalEmoji icon displayed on the button. Auto-detected from URL if omitted.
activebooleanoptionalWhether the link is visible on the public page (default: true).
is_headerbooleanoptionalIf true, renders as a section divider label instead of a link button.
block_typestringoptionalBlock type: link (default), youtube, spotify, soundcloud, text, contact.
embed_urlstringoptionalEmbed URL for youtube/spotify/soundcloud blocks.
text_contentstringoptionalText content for text blocks (markdown supported).
og_imagestringoptionalOG thumbnail image URL for the link preview.
Used in the blocks array of SmartPage create/update payloads. Every block has a type field and an auto-generated id. Additional fields depend on the block type.
Available block types
heroFull-width hero — headline, subheadline, CTA, background image
headlineLarge heading (H1–H4), alignment, and size control
textParagraph text with optional multi-column layout
imageSingle image with alt text, width, border radius, link
videoYouTube / Vimeo embed with aspect ratio control
buttonsUp to 3 CTA buttons with style, size, and link options
countdownUrgency countdown timer with expiry actions
social_proofCustomer count, star rating, or logo grid
featuresFeature grid with icon, title, and description per item
testimonialsCustomer quotes with name, role, and star rating
faqAccordion FAQ with unlimited Q&A pairs
formLead capture form — PRO only. Up to 10 fields.
embedSpotify, Calendly, Typeform, SoundCloud embed
logoBrand logo image with width and alignment control
dividerVisual separator — line, dots, wave, or space
spacerEmpty vertical space with configurable height
Common fields (all blocks)
idstringoptionalBlock ID. Auto-generated if omitted. Used for CTA click tracking.
typestringrequiredBlock type — one of the types listed above.
Example — hero block
{
"type": "hero",
"headline": "Ship faster with Alshorty",
"subheadline": "The all-in-one link platform.",
"cta_text": "Get Started Free",
"cta_url": "https://alshorty.com/auth",
"cta_style": "fill",
"bg_image": "https://cdn.example.com/hero.jpg",
"text_align": "center",
"min_height": 500,
"badge_text": "🚀 Now in beta"
}Pixels object (PRO only)
fb_pixel_idMeta / Facebook Pixel ID.
ga_idGoogle Analytics 4 Measurement ID (e.g. G-XXXXXXXXXX).
gtm_idGoogle Tag Manager Container ID (e.g. GTM-XXXXXXX).
tiktok_idTikTok Pixel ID.
| HTTP | Error code | Meaning |
|---|---|---|
| 400 | INVALID_URL | The URL is malformed or blocked. |
| 400 | INVALID_ALIAS | Alias contains invalid characters or is too long. |
| 400 | INVALID_BLOCK | A SmartPage block has an unknown type or invalid field value. |
| 401 | UNAUTHORIZED | API key missing or invalid. |
| 403 | LOGIN_REQUIRED | This action requires a logged-in session. |
| 403 | BLOCKED_URL | URL matched phishing/malware filter. |
| 403 | UPGRADE_REQUIRED | Feature requires PRO (custom slug, form blocks, pixels, bio image upload). |
| 403 | CSRF_CHECK_FAILED | Request origin not allowed. Ensure credentials: include is set. |
| 404 | NOT_FOUND | Link, bio page, or SmartPage not found. |
| 404 | BIO_NOT_FOUND | No bio page found for this account or slug. |
| 404 | PAGE_NOT_FOUND | No SmartPage found for this id or slug. |
| 409 | ALIAS_TAKEN | Short link alias already exists. |
| 409 | SLUG_TAKEN | Bio or SmartPage slug is already in use by another account. |
| 409 | BIO_EXISTS | Free plan limit reached — only 1 bio page allowed. |
| 429 | RATE_LIMITED | Too many requests — slow down. |
| 429 | PLAN_LIMIT_EXCEEDED | Monthly link or page creation limit reached for your plan. |
| 429 | ALIAS_LIMIT_EXCEEDED | Monthly custom alias quota reached for your plan. |
💡 Quick tips
Test endpoints using the playground above. Your API key pre-fills all snippets automatically.
All timestamps are Unix milliseconds. All dates in responses are ISO 8601 UTC.
Bio and SmartPage slugs must be lowercase alphanumeric + hyphens. Custom slugs require a PRO plan. SmartPages live at /p/slug, bio pages at /bio/slug.
The POST /api/pages/track endpoint is unauthenticated by design — it is called by public page visitors, not your server.