Alshorty API

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.

Three products, one API

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.

What can you build with the Alshorty API?

  • Automated link shortening in CI/CD pipelines or marketing tools
  • Programmatically update your Link-in-Bio page when you publish new content
  • Create and publish SmartPages from a CMS or headless workflow
  • Push block content to a SmartPage automatically — product launches, event pages, campaign landers
  • Custom dashboards pulling click and conversion analytics for links, bio pages, and SmartPages
  • Bulk URL processing for campaigns, newsletters, or affiliate workflows
  • Sync bio page links automatically from a content calendar

Base URL

https://alshorty.com

Auth header

Authorization: Bearer sk_…

Response format

JSON (application/json)

How do I authenticate with the Alshorty API?

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": "..." }

URL Shortener

Create a new short link. Optionally provide a custom alias, category, expiry, and password.

Requires Authorization: Bearer YOUR_API_KEY

Request body

urlstringrequired

The destination URL to shorten.

domainstringoptional

Domain prefix. Free/anon: always alshorty.com/link. PRO options: alshorty.com/link, alshorty.com/s, alshorty.com/go, alshorty.com/run.

aliasstringoptional

Custom alias (logged-in users only; 5/month free, 100/month PRO). PRO users can also use category/alias format (e.g. books/my-link).

categorystringoptional

Category slug used as a URL prefix.

expiresAtnumberoptional

Unix timestamp (ms) when the link expires.

passwordstringoptional

Optional password protection for the redirect.

tagsstring[]optional

Array 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

Link-in-Bio

BioLink object schema

Used in the links array of bio create/update payloads.

titlestringrequired

Display text for the link button (max 100 chars).

urlstringrequired

Destination URL (must be https://). Empty string for section headers.

iconstringoptional

Emoji icon displayed on the button. Auto-detected from URL if omitted.

activebooleanoptional

Whether the link is visible on the public page (default: true).

is_headerbooleanoptional

If true, renders as a section divider label instead of a link button.

block_typestringoptional

Block type: link (default), youtube, spotify, soundcloud, text, contact.

embed_urlstringoptional

Embed URL for youtube/spotify/soundcloud blocks.

text_contentstringoptional

Text content for text blocks (markdown supported).

og_imagestringoptional

OG thumbnail image URL for the link preview.

SmartPages

Block object schema

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

hero

Full-width hero — headline, subheadline, CTA, background image

headline

Large heading (H1–H4), alignment, and size control

text

Paragraph text with optional multi-column layout

image

Single image with alt text, width, border radius, link

video

YouTube / Vimeo embed with aspect ratio control

buttons

Up to 3 CTA buttons with style, size, and link options

countdown

Urgency countdown timer with expiry actions

social_proof

Customer count, star rating, or logo grid

features

Feature grid with icon, title, and description per item

testimonials

Customer quotes with name, role, and star rating

faq

Accordion FAQ with unlimited Q&A pairs

form

Lead capture form — PRO only. Up to 10 fields.

embed

Spotify, Calendly, Typeform, SoundCloud embed

logo

Brand logo image with width and alignment control

divider

Visual separator — line, dots, wave, or space

spacer

Empty vertical space with configurable height

Common fields (all blocks)

idstringoptional

Block ID. Auto-generated if omitted. Used for CTA click tracking.

typestringrequired

Block 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_id

Meta / Facebook Pixel ID.

ga_id

Google Analytics 4 Measurement ID (e.g. G-XXXXXXXXXX).

gtm_id

Google Tag Manager Container ID (e.g. GTM-XXXXXXX).

tiktok_id

TikTok Pixel ID.

Analytics

API Keys

Error codes

HTTPError codeMeaning
400INVALID_URLThe URL is malformed or blocked.
400INVALID_ALIASAlias contains invalid characters or is too long.
400INVALID_BLOCKA SmartPage block has an unknown type or invalid field value.
401UNAUTHORIZEDAPI key missing or invalid.
403LOGIN_REQUIREDThis action requires a logged-in session.
403BLOCKED_URLURL matched phishing/malware filter.
403UPGRADE_REQUIREDFeature requires PRO (custom slug, form blocks, pixels, bio image upload).
403CSRF_CHECK_FAILEDRequest origin not allowed. Ensure credentials: include is set.
404NOT_FOUNDLink, bio page, or SmartPage not found.
404BIO_NOT_FOUNDNo bio page found for this account or slug.
404PAGE_NOT_FOUNDNo SmartPage found for this id or slug.
409ALIAS_TAKENShort link alias already exists.
409SLUG_TAKENBio or SmartPage slug is already in use by another account.
409BIO_EXISTSFree plan limit reached — only 1 bio page allowed.
429RATE_LIMITEDToo many requests — slow down.
429PLAN_LIMIT_EXCEEDEDMonthly link or page creation limit reached for your plan.
429ALIAS_LIMIT_EXCEEDEDMonthly custom alias quota reached for your plan.

Sign in to manage keys

Create and revoke API keys from your dashboard.

Sign in

💡 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.