POST
/
links
curl --request POST \
  --url https://api.dub.co/links \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "domain": "<string>",
  "key": "<string>",
  "url": "<string>",
  "archived": true,
  "expiresAt": "2023-11-07T05:31:56Z",
  "password": "<string>",
  "proxy": true,
  "title": "<string>",
  "description": "<string>",
  "image": "<string>",
  "rewrite": true,
  "ios": "<string>",
  "android": "<string>",
  "geo": {},
  "publicStats": true,
  "tagId": "<string>",
  "tagIds": [
    "<string>"
  ],
  "comments": "<string>"
}'
{
  "id": "<string>",
  "domain": "<string>",
  "key": "<string>",
  "url": "<string>",
  "archived": true,
  "expiresAt": "2023-11-07T05:31:56Z",
  "password": "<string>",
  "proxy": true,
  "title": "<string>",
  "description": "<string>",
  "image": "<string>",
  "rewrite": true,
  "ios": "<string>",
  "android": "<string>",
  "geo": {},
  "publicStats": true,
  "tagId": "<string>",
  "tagIds": [
    "<string>"
  ],
  "comments": "<string>",
  "shortLink": "<string>",
  "qrCode": "<string>",
  "utm_source": "<string>",
  "utm_medium": "<string>",
  "utm_campaign": "<string>",
  "utm_term": "<string>",
  "utm_content": "<string>",
  "tags": [
    {
      "id": "<string>",
      "name": "<string>",
      "color": "<string>"
    }
  ],
  "userId": "<string>",
  "projectId": "<string>",
  "clicks": 123,
  "lastClicked": "2023-11-07T05:31:56Z",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
headerrequired

Default authentication mechanism

Query Parameters

projectSlug
string
required

The slug for the project to create links for. E.g. for app.dub.co/acme, the projectSlug is acme.

Body

application/json
domain
string

The domain of the short link. If not provided, the primary domain for the project will be used (or dub.sh if the project has no domains).

key
string

The short link slug. If not provided, a random 7-character slug will be generated.

url
string
required

The destination URL of the short link.

archived
boolean
default: false

Whether the short link is archived.

expiresAt
string | null

The date and time when the short link will expire in ISO-8601 format. Must be in the future.

password
string | null

The password required to access the destination URL of the short link.

proxy
boolean
default: false

Whether the short link uses Custom Social Media Cards feature.

title
string | null

The title of the short link generated via api.dub.co/metatags. Will be used for Custom Social Media Cards if proxy is true.

description
string | null

The description of the short link generated via api.dub.co/metatags. Will be used for Custom Social Media Cards if proxy is true.

image
string | null

The image of the short link generated via api.dub.co/metatags. Will be used for Custom Social Media Cards if proxy is true.

rewrite
boolean
default: false

Whether the short link uses link cloaking.

ios
string | null

The iOS destination URL for the short link for iOS device targeting.

android
string | null

The Android destination URL for the short link for Android device targeting.

geo
object | null

Geo targeting information for the short link in JSON format {[COUNTRY]: https://example.com }. Learn more: https://dub.sh/geo

publicStats
boolean
default: false

Whether the short link's stats are publicly accessible.

tagId
string

The unique ID of the tag assigned to the short link.

tagIds
string[]

The unique IDs of the tags assigned to the short link.

comments
string | null

The comments for the short link.

Response

200 - application/json
id
string

The unique ID of the short link.

domain
string

The domain of the short link. If not provided, the primary domain for the project will be used (or dub.sh if the project has no domains).

key
string

The short link slug. If not provided, a random 7-character slug will be generated.

url
string

The destination URL of the short link.

archived
boolean
default: false

Whether the short link is archived.

expiresAt
string | null

The date and time when the short link will expire in ISO-8601 format. Must be in the future.

password
string | null

The password required to access the destination URL of the short link.

proxy
boolean
default: false

Whether the short link uses Custom Social Media Cards feature.

title
string | null

The title of the short link generated via api.dub.co/metatags. Will be used for Custom Social Media Cards if proxy is true.

description
string | null

The description of the short link generated via api.dub.co/metatags. Will be used for Custom Social Media Cards if proxy is true.

image
string | null

The image of the short link generated via api.dub.co/metatags. Will be used for Custom Social Media Cards if proxy is true.

rewrite
boolean
default: false

Whether the short link uses link cloaking.

ios
string | null

The iOS destination URL for the short link for iOS device targeting.

android
string | null

The Android destination URL for the short link for Android device targeting.

geo
object | null

Geo targeting information for the short link in JSON format {[COUNTRY]: https://example.com }. Learn more: https://dub.sh/geo

publicStats
boolean
default: false

Whether the short link's stats are publicly accessible.

tagId
string

The unique ID of the tag assigned to the short link.

tagIds
string[]

The unique IDs of the tags assigned to the short link.

comments
string | null

The comments for the short link.

shortLink
string

The full URL of the short link, including the https protocol (e.g. https://dub.sh/try).

qrCode
string

The full URL of the QR code for the short link (e.g. https://api.dub.co/qr?url=https://dub.sh/try).

utm_source
string | null

The UTM source of the short link.

utm_medium
string | null

The UTM medium of the short link.

utm_campaign
string | null

The UTM campaign of the short link.

utm_term
string | null

The UTM term of the short link.

utm_content
string | null

The UTM content of the short link.

tags
object[]

The tags assigned to the short link.

userId
string

The user ID of the creator of the short link.

projectId
string

The project ID of the short link.

clicks
number
default: 0

The number of clicks on the short link.

lastClicked
string | null

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.