Skip to main content
Dub is the modern link attribution platform for short links, conversion tracking, and affiliate programs. The Dub API enables you to programmatically create and manage short links, track analytics, manage domains, and more.

Base URL

All API requests should be made to:
https://api.dub.co

API Features

The Dub API provides comprehensive endpoints for:
  • Links: Create, update, retrieve, and delete short links with advanced features
  • Analytics: Retrieve detailed analytics for links, domains, or entire workspaces
  • Domains: Manage custom domains for your short links
  • Tags: Organize links with custom tags
  • Folders: Organize links into folders for better management
  • Customers: Track and manage customer data for attribution
  • Partners: Manage affiliate partners and track commissions
  • Events: Stream real-time click events and conversion data
  • Tracking: Track leads and sales for conversion attribution

Quick Start

To get started with the Dub API:
  1. Create a workspace on dub.co
  2. Generate an API token from your workspace settings
  3. Include the token in the Authorization header of your requests
  4. Start making API calls
curl https://api.dub.co/links \\
  -H "Authorization: Bearer YOUR_API_TOKEN" \\
  -H "Content-Type: application/json" \\
  -d '{
    "url": "https://example.com",
    "domain": "dub.sh"
  }'

Workspace ID

Most API endpoints require a workspace ID to identify which workspace the request belongs to. You can provide this in two ways:
  1. As a query parameter: ?workspaceId=ws_...
  2. As a path parameter: /workspaces/{idOrSlug}/...
Workspace IDs start with ws_. You can find your workspace ID in your workspace settings or use your workspace slug instead.

SDKs

Dub provides official SDKs to make integration easier:

Support

Need help with the API? Here are some resources:

API Versioning

The current API version is 0.0.1. The API uses semantic versioning, and breaking changes will be communicated in advance.

Build docs developers (and LLMs) love