Create, manage, and track short links with Dub. Supports custom domains, UTM parameters, link analytics, and more.
Create a new short link with Dub. Supports custom domains, slugs, UTM parameters, and more.
| Paramètre | Type | Obligatoire | Description |
|---|
apiKey | string | Oui | Dub API key |
url | string | Oui | The destination URL of the short link |
domain | string | Non | Custom domain for the short link (defaults to dub.sh) |
key | string | Non | Custom slug for the short link (randomly generated if not provided) |
externalId | string | Non | External ID for the link in your database |
tagIds | string | Non | Comma-separated tag IDs to assign to the link |
comments | string | Non | Comments for the short link |
expiresAt | string | Non | Expiration date in ISO 8601 format |
password | string | Non | Password to protect the short link |
rewrite | boolean | Non | Whether to enable link cloaking |
archived | boolean | Non | Whether to archive the link |
title | string | Non | Custom OG title for the link preview |
description | string | Non | Custom OG description for the link preview |
utm_source | string | Non | UTM source parameter |
utm_medium | string | Non | UTM medium parameter |
utm_campaign | string | Non | UTM campaign parameter |
utm_term | string | Non | UTM term parameter |
utm_content | string | Non | UTM content parameter |
| Paramètre | Type | Description |
|---|
id | string | Unique ID of the created link |
domain | string | Domain of the short link |
key | string | Slug of the short link |
url | string | Destination URL |
shortLink | string | Full short link URL |
qrCode | string | QR code URL for the short link |
archived | boolean | Whether the link is archived |
externalId | string | External ID |
title | string | OG title |
description | string | OG description |
tags | json | Tags assigned to the link (id, name, color) |
clicks | number | Number of clicks |
leads | number | Number of leads |
sales | number | Number of sales |
saleAmount | number | Total sale amount in cents |
lastClicked | string | Last clicked timestamp |
createdAt | string | Creation timestamp |
updatedAt | string | Last update timestamp |
utm_source | string | UTM source parameter |
utm_medium | string | UTM medium parameter |
utm_campaign | string | UTM campaign parameter |
utm_term | string | UTM term parameter |
utm_content | string | UTM content parameter |
Create or update a short link by its URL. If a link with the same URL already exists, update it. Otherwise, create a new link.
| Paramètre | Type | Obligatoire | Description |
|---|
apiKey | string | Oui | Dub API key |
url | string | Oui | The destination URL of the short link |
domain | string | Non | Custom domain for the short link (defaults to dub.sh) |
key | string | Non | Custom slug for the short link (randomly generated if not provided) |
externalId | string | Non | External ID for the link in your database |
tagIds | string | Non | Comma-separated tag IDs to assign to the link |
comments | string | Non | Comments for the short link |
expiresAt | string | Non | Expiration date in ISO 8601 format |
password | string | Non | Password to protect the short link |
rewrite | boolean | Non | Whether to enable link cloaking |
archived | boolean | Non | Whether to archive the link |
title | string | Non | Custom OG title for the link preview |
description | string | Non | Custom OG description for the link preview |
utm_source | string | Non | UTM source parameter |
utm_medium | string | Non | UTM medium parameter |
utm_campaign | string | Non | UTM campaign parameter |
utm_term | string | Non | UTM term parameter |
utm_content | string | Non | UTM content parameter |
| Paramètre | Type | Description |
|---|
id | string | Unique ID of the link |
domain | string | Domain of the short link |
key | string | Slug of the short link |
url | string | Destination URL |
shortLink | string | Full short link URL |
qrCode | string | QR code URL for the short link |
archived | boolean | Whether the link is archived |
externalId | string | External ID |
title | string | OG title |
description | string | OG description |
tags | json | Tags assigned to the link (id, name, color) |
clicks | number | Number of clicks |
leads | number | Number of leads |
sales | number | Number of sales |
saleAmount | number | Total sale amount in cents |
lastClicked | string | Last clicked timestamp |
createdAt | string | Creation timestamp |
updatedAt | string | Last update timestamp |
utm_source | string | UTM source parameter |
utm_medium | string | UTM medium parameter |
utm_campaign | string | UTM campaign parameter |
utm_term | string | UTM term parameter |
utm_content | string | UTM content parameter |
Retrieve information about a short link by its link ID, external ID, or domain + key combination.
| Paramètre | Type | Obligatoire | Description |
|---|
apiKey | string | Oui | Dub API key |
linkId | string | Non | The unique ID of the short link |
externalId | string | Non | The external ID of the link in your database |
domain | string | Non | The domain of the link (use with key) |
key | string | Non | The slug of the link (use with domain) |
| Paramètre | Type | Description |
|---|
id | string | Unique ID of the link |
domain | string | Domain of the short link |
key | string | Slug of the short link |
url | string | Destination URL |
shortLink | string | Full short link URL |
qrCode | string | QR code URL for the short link |
archived | boolean | Whether the link is archived |
externalId | string | External ID |
title | string | OG title |
description | string | OG description |
tags | json | Tags assigned to the link (id, name, color) |
clicks | number | Number of clicks |
leads | number | Number of leads |
sales | number | Number of sales |
saleAmount | number | Total sale amount in cents |
lastClicked | string | Last clicked timestamp |
createdAt | string | Creation timestamp |
updatedAt | string | Last update timestamp |
utm_source | string | UTM source parameter |
utm_medium | string | UTM medium parameter |
utm_campaign | string | UTM campaign parameter |
utm_term | string | UTM term parameter |
utm_content | string | UTM content parameter |
Update an existing short link. You can modify the destination URL, slug, metadata, UTM parameters, and more.
| Paramètre | Type | Obligatoire | Description |
|---|
apiKey | string | Oui | Dub API key |
linkId | string | Oui | The link ID or external ID prefixed with ext_ |
url | string | Non | New destination URL |
domain | string | Non | New custom domain |
key | string | Non | New custom slug |
title | string | Non | Custom OG title |
description | string | Non | Custom OG description |
externalId | string | Non | External ID for the link |
tagIds | string | Non | Comma-separated tag IDs |
comments | string | Non | Comments for the short link |
expiresAt | string | Non | Expiration date in ISO 8601 format |
password | string | Non | Password to protect the link |
rewrite | boolean | Non | Whether to enable link cloaking |
archived | boolean | Non | Whether to archive the link |
utm_source | string | Non | UTM source parameter |
utm_medium | string | Non | UTM medium parameter |
utm_campaign | string | Non | UTM campaign parameter |
utm_term | string | Non | UTM term parameter |
utm_content | string | Non | UTM content parameter |
| Paramètre | Type | Description |
|---|
id | string | Unique ID of the updated link |
domain | string | Domain of the short link |
key | string | Slug of the short link |
url | string | Destination URL |
shortLink | string | Full short link URL |
qrCode | string | QR code URL for the short link |
archived | boolean | Whether the link is archived |
externalId | string | External ID |
title | string | OG title |
description | string | OG description |
tags | json | Tags assigned to the link (id, name, color) |
clicks | number | Number of clicks |
leads | number | Number of leads |
sales | number | Number of sales |
saleAmount | number | Total sale amount in cents |
lastClicked | string | Last clicked timestamp |
createdAt | string | Creation timestamp |
updatedAt | string | Last update timestamp |
utm_source | string | UTM source parameter |
utm_medium | string | UTM medium parameter |
utm_campaign | string | UTM campaign parameter |
utm_term | string | UTM term parameter |
utm_content | string | UTM content parameter |
Delete a short link by its link ID or external ID (prefixed with ext_).
| Paramètre | Type | Obligatoire | Description |
|---|
apiKey | string | Oui | Dub API key |
linkId | string | Oui | The link ID or external ID prefixed with ext_ |
| Paramètre | Type | Description |
|---|
id | string | ID of the deleted link |
Retrieve a paginated list of short links for the authenticated workspace. Supports filtering by domain, search query, tags, and sorting.
| Paramètre | Type | Obligatoire | Description |
|---|
apiKey | string | Oui | Dub API key |
domain | string | Non | Filter by domain |
search | string | Non | Search query matched against the short link slug and destination URL |
tagIds | string | Non | Comma-separated tag IDs to filter by |
showArchived | boolean | Non | Whether to include archived links (defaults to false) |
page | number | Non | Page number (default: 1) |
pageSize | number | Non | Number of links per page (default: 100, max: 100) |
| Paramètre | Type | Description |
|---|
links | json | Array of link objects (id, domain, key, url, shortLink, clicks, tags, createdAt) |
count | number | Number of links returned |
Retrieve the number of short links for the authenticated workspace, optionally filtered and grouped by domain, tag, user, or folder.
| Paramètre | Type | Obligatoire | Description |
|---|
apiKey | string | Oui | Dub API key |
domain | string | Non | Filter by domain |
search | string | Non | Search query matched against the short link slug and destination URL |
tagIds | string | Non | Comma-separated tag IDs to filter by |
tagNames | string | Non | Comma-separated tag names to filter by (case-insensitive) |
folderId | string | Non | Filter by folder ID |
showArchived | boolean | Non | Whether to include archived links (defaults to false) |
groupBy | string | Non | Group counts by: domain, tagId, userId, or folderId |
| Paramètre | Type | Description |
|---|
count | number | Total number of links matching the filters |
groups | json | Per-group counts when groupBy is set (e.g. [{ domain, count }]) |
Create up to 100 short links in a single request. Returns the created links alongside any per-link errors.
| Paramètre | Type | Obligatoire | Description |
|---|
apiKey | string | Oui | Dub API key |
links | json | Oui | JSON array of link objects to create. Each object requires a "url" and may include domain, key, tagIds, and other link fields (max 100). |
| Paramètre | Type | Description |
|---|
created | json | Array of successfully created link objects |
errors | json | Array of per-link errors ({ link, error, code }) for links that failed |
count | number | Number of links successfully created |
Apply the same set of field updates to up to 100 links at once, selected by link IDs or external IDs.
| Paramètre | Type | Obligatoire | Description |
|---|
apiKey | string | Oui | Dub API key |
linkIds | string | Non | Comma-separated link IDs to update (max 100, takes precedence over externalIds) |
externalIds | string | Non | Comma-separated external IDs to update (max 100) |
data | json | Oui | JSON object of fields to apply to every selected link (e.g. { "archived": true, "tagIds": ["..."] }) |
| Paramètre | Type | Description |
|---|
updated | json | Array of updated link objects |
count | number | Number of links updated |
Delete up to 100 short links in a single request by their link IDs. Non-existing IDs are ignored.
| Paramètre | Type | Obligatoire | Description |
|---|
apiKey | string | Oui | Dub API key |
linkIds | string | Oui | Comma-separated link IDs to delete (max 100) |
| Paramètre | Type | Description |
|---|
deletedCount | number | Number of links that were deleted |
Retrieve analytics for links including clicks, leads, and sales. Supports filtering by link, time range, and grouping by various dimensions.
| Paramètre | Type | Obligatoire | Description |
|---|
apiKey | string | Oui | Dub API key |
event | string | Non | Event type: clicks (default), leads, sales, or composite |
groupBy | string | Non | Group results by: count (default), timeseries, countries, cities, devices, browsers, os, referers, top_links, top_urls |
linkId | string | Non | Filter by link ID |
externalId | string | Non | Filter by external ID (prefix with ext_) |
domain | string | Non | Filter by domain |
interval | string | Non | Time interval: 24h (default), 7d, 30d, 90d, 1y, mtd, qtd, ytd, or all |
start | string | Non | Start date/time in ISO 8601 format (overrides interval) |
end | string | Non | End date/time in ISO 8601 format (defaults to now) |
country | string | Non | Filter by country (ISO 3166-1 alpha-2 code) |
timezone | string | Non | IANA timezone for timeseries data (defaults to UTC) |
| Paramètre | Type | Description |
|---|
clicks | number | Total number of clicks |
leads | number | Total number of leads |
sales | number | Total number of sales |
saleAmount | number | Total sale amount in cents |
data | json | Grouped analytics data (timeseries, countries, devices, etc.) |
Retrieve a paginated stream of individual click, lead, and sale events for links, with filtering by link, time range, and location.
| Paramètre | Type | Obligatoire | Description |
|---|
apiKey | string | Oui | Dub API key |
event | string | Non | Event type: clicks (default), leads, or sales |
linkId | string | Non | Filter by link ID |
externalId | string | Non | Filter by external ID (prefix with ext_) |
domain | string | Non | Filter by domain |
interval | string | Non | Time interval: 24h (default), 7d, 30d, 90d, 1y, mtd, qtd, ytd, or all |
start | string | Non | Start date/time in ISO 8601 format (overrides interval) |
end | string | Non | End date/time in ISO 8601 format (defaults to now) |
country | string | Non | Filter by country (ISO 3166-1 alpha-2 code) |
timezone | string | Non | IANA timezone for event timestamps (defaults to UTC) |
page | number | Non | Page number (default: 1) |
limit | number | Non | Number of events per page (default: 100, max: 1000) |
sortOrder | string | Non | Sort order: desc (default) or asc |
| Paramètre | Type | Description |
|---|
events | json | Array of event objects (event, timestamp, click, link, and customer/sale data when applicable) |
count | number | Number of events returned |
Generate a customizable QR code (PNG) for a short link, with control over size, error correction, colors, and margin.
| Paramètre | Type | Obligatoire | Description |
|---|
apiKey | string | Oui | Dub API key |
url | string | Oui | The short link URL to encode in the QR code |
size | number | Non | QR code size in pixels (default: 600) |
level | string | Non | Error correction level: L (default), M, Q, or H |
fgColor | string | Non | Foreground color in hex (default: #000000) |
bgColor | string | Non | Background color in hex (default: #FFFFFF) |
hideLogo | boolean | Non | Whether to hide the logo in the center of the QR code (default: false) |
margin | number | Non | Margin (quiet zone) around the QR code (default: 2) |
| Paramètre | Type | Description |
|---|
file | file | Generated QR code image stored in execution files |
content | string | Base64-encoded PNG image data |