Skip to main content

Authentication

This endpoint requires authentication using a Bearer token.
Authorization: Bearer <token>

Endpoint

method
string
required
PATCH
endpoint
string
required
/links/:linkId

Path Parameters

The id of the link to update. You may use either linkId (obtained via /links/info endpoint) or externalId prefixed with ext_.

Request Body

All fields are optional. Only include the fields you want to update.
url
string
The destination URL of the short link.
domain
string
The domain of the short link (without protocol).
key
string
The short link slug.
externalId
string
The ID of the link in your database.
tenantId
string
The ID of the tenant that created the link inside your system.
programId
string
The ID of the program the short link is associated with.
partnerId
string
The ID of the partner the short link is associated with.
trackConversion
boolean
Whether to track conversions for the short link.
archived
boolean
Whether the short link is archived.
tagIds
array
The unique IDs of the tags assigned to the short link.
tagNames
array
The unique name of the tags assigned to the short link (case insensitive).
folderId
string
The unique ID existing folder to assign the short link to.
comments
string
The comments for the short link.
expiresAt
string
The date and time when the short link will expire at.
expiredUrl
string
The URL to redirect to when the short link has expired.
password
string
The password required to access the destination URL of the short link.
proxy
boolean
Whether the short link uses Custom Link Previews feature.
title
string
The custom link preview title (og:title). Will be used for Custom Link Previews if proxy is true.
description
string
The custom link preview description (og:description). Will be used for Custom Link Previews if proxy is true.
image
string
The custom link preview image (og:image). Will be used for Custom Link Previews if proxy is true.
video
string
The custom link preview video (og:video). Will be used for Custom Link Previews if proxy is true.
rewrite
boolean
Whether the short link uses link cloaking.
ios
string
The iOS destination URL for the short link for iOS device targeting.
android
string
The Android destination URL for the short link for Android device targeting.
geo
object
Geo targeting information for the short link in JSON format {[COUNTRY]: https://example.com }.
doIndex
boolean
Allow search engines to index your short link.
utm_source
string
The UTM source of the short link.
utm_medium
string
The UTM medium of the short link.
utm_campaign
string
The UTM campaign of the short link.
utm_term
string
The UTM term of the short link.
utm_content
string
The UTM content of the short link.
ref
string
The referral tag of the short link.
webhookIds
array
An array of webhook IDs to trigger when the link is clicked.
testVariants
array
An array of A/B test URLs and the percentage of traffic to send to each URL.
testStartedAt
string
The date and time when the tests started.
testCompletedAt
string
The date and time when the tests were or will be completed.

Response

id
string
The unique ID of the short link.
domain
string
The domain of the short link.
key
string
The short link slug.
url
string
The destination URL of the short link.
externalId
string
The ID of the link in your database.
trackConversion
boolean
Whether to track conversions for the short link.
archived
boolean
Whether the short link is archived.
expiresAt
string
The date and time when the short link will expire in ISO-8601 format.
expiredUrl
string
The URL to redirect to when the short link has expired.
password
string
The password required to access the destination URL of the short link.
proxy
boolean
Whether the short link uses Custom Link Previews feature.
title
string
The title of the short link.
description
string
The description of the short link.
image
string
The image of the short link.
rewrite
boolean
Whether the short link uses link cloaking.
doIndex
boolean
Whether to allow search engines to index the short link.
ios
string
The iOS destination URL for the short link.
android
string
The Android destination URL for the short link.
geo
object
Geo targeting information for the short link.
tags
array
The tags assigned to the short link.
folderId
string
The unique ID of the folder assigned to the short link.
comments
string
The comments for the short link.
The full URL of the short link, including the https protocol.
qrCode
string
The full URL of the QR code for the short link.
utm_source
string
The UTM source of the short link.
utm_medium
string
The UTM medium of the short link.
utm_campaign
string
The UTM campaign of the short link.
utm_term
string
The UTM term of the short link.
utm_content
string
The UTM content of the short link.
userId
string
The user ID of the creator of the short link.
workspaceId
string
The workspace ID of the short link.
clicks
number
The number of clicks on the short link.
leads
number
The number of leads the short link has generated.
conversions
number
The number of leads that converted to paying customers.
sales
number
The total number of sales generated by the short link.
saleAmount
number
The total dollar value of sales (in cents) generated by the short link.
lastClicked
string
The date and time when the short link was last clicked.
createdAt
string
The date and time when the short link was created.
updatedAt
string
The date and time when the short link was last updated.
curl -X PATCH "https://api.dub.co/links/clux0rgak00011..." \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "archived": false
  }'
{
  "id": "clux0rgak00011...",
  "domain": "dub.sh",
  "key": "try",
  "url": "https://example.com",
  "archived": false,
  "expiresAt": null,
  "expiredUrl": null,
  "password": null,
  "proxy": false,
  "title": null,
  "description": null,
  "image": null,
  "video": null,
  "rewrite": false,
  "doIndex": false,
  "ios": null,
  "android": null,
  "geo": null,
  "publicStats": false,
  "tags": [],
  "folderId": null,
  "comments": null,
  "shortLink": "https://dub.sh/try",
  "qrCode": "https://api.dub.co/qr?url=https://dub.sh/try",
  "utm_source": null,
  "utm_medium": null,
  "utm_campaign": null,
  "utm_term": null,
  "utm_content": null,
  "userId": "user_123",
  "workspaceId": "ws_123",
  "clicks": 0,
  "leads": 0,
  "conversions": 0,
  "sales": 0,
  "saleAmount": 0,
  "lastClicked": null,
  "createdAt": "2024-01-01T00:00:00.000Z",
  "updatedAt": "2024-01-01T00:00:00.000Z",
  "trackConversion": false,
  "externalId": null,
  "tenantId": null,
  "programId": null,
  "partnerId": null,
  "webhookIds": []
}

Build docs developers (and LLMs) love