API Documentation

The Xpolink REST API lets you create, manage, and track branded short links programmatically. Available on all plans.

Authentication

All API requests require an API key passed in the Authorization header:

Authorization: Bearer xpo_your_api_key_here

Generate an API key from your dashboard under Settings → API Keys. Keys start with xpo_ and cannot be viewed again after creation — store them securely.

Base URL

https://xpolink.app/api/v1

All endpoints below are relative to this base URL.

Error Handling

Errors return a JSON object with an error field:

{
  "error": "Monthly link limit reached (50)"
}

Common status codes:

  • 400 — invalid request (missing fields, bad URL)
  • 401 — missing or invalid API key
  • 403 — plan limit reached or feature not available
  • 404 — resource not found
  • 429 — rate limited

Create a link

POST/links

Request body:

urlrequired
string
The destination URL to shorten. Must be http:// or https://.
shortCode
string
Custom slug. Alphanumeric, hyphens, and underscores. Auto-generated if omitted.
domain
string
Domain hostname to create the link on. Uses your first verified domain if omitted.
title
string
Friendly name for the link.

Example:

curl -X POST https://xpolink.app/api/v1/links \
  -H "Authorization: Bearer xpo_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/my-long-url",
    "shortCode": "promo",
    "title": "Spring promo"
  }'

Response:

{
  "id": "abc123",
  "shortCode": "promo",
  "longUrl": "https://example.com/my-long-url",
  "title": "Spring promo",
  "domainHostname": "go.yourbrand.com",
  "clickCount": 0,
  "isActive": true,
  "createdAt": "2026-04-12T00:00:00.000Z"
}

List links

GET/links

Query parameters:

page
number
Page number (default 1)
search
string
Search by short code, URL, or title

Get link details

GET/links/:id

Update a link

PATCH/links/:id
longUrl
string
New destination URL (Pro+ plans only)
title
string
New title
isActive
boolean
Enable or disable the link
redirectType
number
Redirect type: 301 (permanent) or 302 (temporary)

Delete a link

DELETE/links/:id

Get link analytics

GET/links/:id/stats

Returns clicks over time, top countries, referrers, device/browser/OS breakdowns, and cities. The depth of data depends on your plan.

Export clicks (CSV)

GET/links/:id/export

Downloads raw click events as a CSV file. Business plan only.

List captured emails

GET/links/:id/emails

Returns emails collected via the email gate feature. Paginated.

Export captured emails (CSV)

GET/links/:id/emails/export

Bulk import

POST/links/import

Import up to 500 links at once. Accepts a JSON array of link objects with the same fields as the create endpoint.

Domains

List domains

GET/domains

Add a domain

POST/domains
hostnamerequired
string
The domain hostname (e.g. go.yourbrand.com)

Verify a domain

POST/domains/:id/verify

Delete a domain

DELETE/domains/:id

API Keys

List API keys

GET/api-keys

Returns key metadata (name, prefix, last used). The full key is never returned after creation. Available to all team members.

Create an API key

POST/api-keys
namerequired
string
A label for the key (e.g. "CI/CD", "CLI")

Only team owners can create API keys. Returns the raw key once — store it securely.

Delete an API key

DELETE/api-keys/:id

Only team owners can revoke API keys.

Rate Limits

API requests are subject to your plan's monthly link creation limit. Creating a link via the API counts against the same quota as the dashboard. If you exceed your limit, the API returns a 403 error.

General rate limiting is applied per API key. If you receive a 429 response, wait and retry.

Need help? Check the CLI documentation or contact us.