Skip to content

Developer API

Short links, from your own code.

Everything you can do in the 2xurl dashboard, available through a clean REST API — with scoped keys, signed webhooks and fair rate limits.

1. Overview

The 2xurl API lets your website, app, CRM or internal tools create and manage short links automatically. It is the same API our own dashboard uses, so new features reach developers at the same time as everyone else.

  • Simple REST

    JSON over HTTPS with predictable URLs and standard status codes.

  • Scoped keys

    Each API key gets only the permissions you choose, and can be revoked anytime.

  • Signed webhooks

    Real-time events delivered to your server with an HMAC signature.

2. What You Can Build

  • Short linksCreate, update, list and delete links with custom aliases, tags, expiry and UTM tags.
  • AnalyticsRead clicks by date, country, device, browser and referrer.
  • QR codesFetch and style the QR code for any link.
  • Campaigns & bio pagesGroup links into campaigns and manage link-in-bio pages.

3. Authentication

Create an API key under Developers in your dashboard and choose its scopes, such as links.write or analytics.read. Send it as a bearer token on every request:

Header
Authorization: Bearer 2x_your_key_here
  • A key is shown only once and stored as a hash — copy it somewhere safe.
  • Keys belong to a workspace, so a key only sees that workspace's links.
  • Keep keys on your server; never put them in browser or mobile app code.

4. Your First Request

Shorten a URL with a single call:

POST /links
curl -X POST https://2xurl.com/api/v1/links \
  -H "Authorization: Bearer 2x_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "destinationUrl": "https://example.com/summer-sale", "slug": "summer" }'

The response includes the new link's id and shortUrl. See the API Reference for every endpoint and field.

5. Webhooks

Instead of polling, subscribe to events such as link.created, link.updated and link.deleted. Each delivery is a JSON POST carrying X-2xurl-Event, X-2xurl-Delivery and X-2xurl-Signature headers. Verify the signature with your webhook secret before trusting the payload; failed deliveries are retried automatically.

6. Rate Limits & Pricing

  • Each key has per-minute and monthly limits, returned to you as response headers.
  • Over a limit you receive 429 with a Retry-After header — wait that many seconds before retrying.
  • API calls are billed per request from your prepaid wallet. See Pricing for current rates.

7. Reliability

  • Send an Idempotency-Key header on POST, PATCH and PUT so a retried request is never applied twice.
  • Errors return a consistent JSON body with a machine-readable code and a human-readable message.
  • Check live service health on the Status page.

8. Get Started

Sign up free, open Developers in your dashboard and create your first key. Questions? Email [email protected].

Building a bigger integration? Read how we protect keys and data on our Security page.