1st Services Logo
Services & APIs

URL Shortener API

Enterprise URL shortening, custom branded domains, deep linking, click analytics, and QR code generation.

URL Shortener API

The 1st Services URL Shortener is a high-throughput, Anycast-routed link shortening service capable of handling millions of redirects with sub-millisecond latency.


Key Features

  • Branded Custom Domains: Connect domains like go.yourbrand.com with automated SSL.
  • Custom Slugs & Aliases: Create memorable paths (e.g. 1st.link/summer-sale).
  • Expiration & Passcodes: Set automatic link expiry dates or protect links with passcodes.
  • Deep Linking & Device Targeting: Redirect iOS, Android, and Desktop users to different target URLs.
  • Comprehensive Analytics: Track referrers, geographic countries/cities, devices, and UTM campaigns.
  • Dynamic QR Codes: Generate customizable SVG and PNG QR codes on-the-fly.

Endpoint

POST https://api.1st-services.com/v1/shortener/links

Request Parameters

ParameterTypeRequiredDescription
urlstringYesTarget destination URL.
domainstringNoCustom domain (defaults to 1st.link).
slugstringNoCustom slug alias. If omitted, a random 6-character slug is generated.
titlestringNoInternal label or campaign title.
expires_atISO stringNoExpiration timestamp.
passcodestringNoOptional password protection.
utm_sourcestringNoAutomatically append UTM campaign source.

Example cURL Request

cURL
curl -X POST https://api.1st-services.com/v1/shortener/links \
  -H "Authorization: Bearer $FIRST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/products/pro-developer-suite?ref=campaign",
    "domain": "1st.link",
    "slug": "dev-suite",
    "title": "Developer Suite Promo",
    "expires_at": "2026-12-31T23:59:59Z"
  }'

Response

{
  "status": "success",
  "data": {
    "id": "link_8492019",
    "short_url": "https://1st.link/dev-suite",
    "destination_url": "https://example.com/products/pro-developer-suite?ref=campaign",
    "domain": "1st.link",
    "slug": "dev-suite",
    "qr_code_url": "https://api.1st-services.com/v1/shortener/links/link_8492019/qr.svg",
    "clicks_count": 0,
    "created_at": "2026-08-24T14:10:00Z"
  }
}

Retrieve real-time visitor statistics:

GET https://api.1st-services.com/v1/shortener/links/:id/analytics?timeframe=30d

Response Example

{
  "status": "success",
  "data": {
    "total_clicks": 14250,
    "unique_visitors": 11840,
    "referrers": [
      { "source": "twitter.com", "clicks": 6200 },
      { "source": "linkedin.com", "clicks": 4100 },
      { "source": "direct", "clicks": 3950 }
    ],
    "countries": [
      { "country_code": "US", "name": "United States", "clicks": 5800 },
      { "country_code": "DE", "name": "Germany", "clicks": 3100 },
      { "country_code": "GB", "name": "United Kingdom", "clicks": 2400 }
    ],
    "devices": {
      "mobile": 8200,
      "desktop": 5600,
      "tablet": 450
    }
  }
}

3. Generate Dynamic QR Code

Fetch an SVG or PNG QR code directly from the API:

GET /v1/shortener/links/:id/qr.svg?color=0284c7&bg=ffffff&size=512 HTTP/1.1
Host: api.1st-services.com
Authorization: Bearer fst_live_key
Copyright © 2026