Skip to main content
Use Dub through Corsair: one client, typed API calls, and incoming webhooks. Create a key at https://app.dub.co/settings/tokens (workspace Settings, API Keys, Create). The key is tied to one workspace, so no operation takes a workspaceId. Things to know:
  • Deleting is permanent. Deleted links, tags, domains, folders and customers cannot be restored, and a recreated link starts with zero analytics.
  • Tracking cannot be undone. track.lead and track.sale append conversion data with no delete; invoiceId on track.sale is the only duplicate guard (one sale per invoice ID).
  • Retries. Dub rate limits per key (60-3000 requests/minute by plan, separate per-second caps on analytics). A 429 is retried up to three times, honouring Retry-After. Writes are never replayed on a 5xx because Dub has no idempotency keys; links.upsert is the exception: it matches the existing link by destination url, so replaying the same body gives the same result. A different key on an existing url renames that link’s slug.
  • Paging. links.list and customers.list page by cursor: pass nextCursor as startingAfter. events.list, tags.list, domains.list and folders.list page by page number, and a full last page leads to one empty page.
  • Plans. On Dub’s free plan these answer 403 forbidden “Need higher plan” (checked 11-28): folders.create/update/delete (folders.list works), track.lead and track.sale (track.open works), every customers.* operation, domains.checkStatus, and most of the Partners program (partners, program applications, discount codes, bounties, messages, embed tokens, commissions.create). Without a partner program, commissions.list/update/bulkUpdate and payouts.list answer 404 “Program not found” instead. The analytics routes answer 429 with X-RateLimit-Limit: 0. Webhooks need the Business plan.
  • Webhooks. Dub sends link, click, lead, sale, partner, commission, discount code and message events. Add the endpoint in the workspace’s webhook settings and store its secret as the webhook signature; each delivery’s Dub-Signature (an HMAC-SHA256 of the body) is checked.
  • Analytics shapes. analytics.retrieve returns a count object for groupBy: 'count' and an array of rows for every other groupBy.
  • QR codes. qr.get returns the SVG document as a string. PNG is not exposed.
  • Partners program. The partners, program applications, commissions, payouts, discount codes, bounties, messages and embed token operations come straight from Dub’s OpenAPI file. The ones that pay, email or ban a partner are destructive. domains.register claims a .link domain and is destructive too.
What you get:
  • 63 typed API operations
  • 14 incoming webhook event types

Setup

1

Install

2

Add the plugin

corsair.ts
With multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.
3

Choose authentication

4

Connect a tenant

Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see Connect / OAuth.

Example API calls

List the workspace links
Create a short link
See the full list on the API page.

Webhooks

This plugin registers 14 webhook event types. Configure the provider to POST to your Corsair HTTP handler, then use webhookHooks on the plugin factory. See Webhooks for every event path and payload shape, and Webhooks concept for routing.

What’s next

API reference

Every dub.api.* operation with input and output types.

Webhooks

Event paths, payloads, and webhookHooks examples.

Connect / OAuth

createLink, Hub delivery, and tenant connect flows.

Use with agents

Expose this plugin’s operations as MCP tools.