Skip to content
All articles

API

2xurl API: A Complete Guide for Developers

Learn how to integrate 2xurl with your applications using our powerful and easy-to-use API.

2xurl Team

· 8 min read

The 2xurl REST API lets you do everything the dashboard does — from your own code. Here is how to get from zero to your first short link.

1. Create an API key

Open Developers in your dashboard and create a key. Choose only the scopes you need, such as links.write and analytics.read. The key is shown once, so store it safely on your server.

2. Make your first request

Send a POST to https://2xurl.com/api/v1/links with the header Authorization: Bearer 2x_your_key and a JSON body containing destinationUrl. The response includes the link’s id and shortUrl.

3. Build it properly

  • Send an Idempotency-Key header on POST requests so retries never create duplicates.
  • Respect 429 responses and wait for the Retry-After time.
  • Use webhooks instead of polling to hear about new and changed links.

The full list of endpoints and fields is in the API Reference.

Ready to build? Read the API Reference.

Stay updated

Get the latest blog posts, product updates and tips delivered to your inbox.

No spam. Unsubscribe anytime.