POST
/
domains
curl --request POST \
  --url https://api.dub.co/domains \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "slug": "acme.com",
  "type": "redirect",
  "target": "https://acme.com/landing",
  "expiredUrl": "https://acme.com/expired",
  "archived": true,
  "placeholder": "https://dub.co/help/article/what-is-dub"
}'
{
  "id": "<string>",
  "slug": "acme.com",
  "verified": true,
  "primary": true,
  "archived": true,
  "placeholder": "https://dub.co/help/article/what-is-dub",
  "expiredUrl": "https://acme.com/expired",
  "target": "https://acme.com/landing",
  "type": "redirect",
  "clicks": 123
}

Authorizations

Authorization
string
headerrequired

Default authentication mechanism

Query Parameters

workspaceId
string
required

The ID of the workspace.

projectSlug
string
deprecated

The slug of the project. This field is deprecated – use workspaceId instead.

Body

application/json
slug
string
required

Name of the domain.

type
enum<string>
default: redirect

The type of redirect to use for this domain.

Available options:
redirect,
rewrite
target
string | null

The page your users will get redirected to when they visit your domain.

expiredUrl
string | null

Redirect users to a specific URL when any link under this domain has expired.

archived
boolean
default: false

Whether to archive this domain. false will unarchive a previously archived domain.

placeholder
string | null
default: https://dub.co/help/article/what-is-dub

Provide context to your teammates in the link creation modal by showing them an example of a link to be shortened.

Response

201 - application/json
id
string
required

The unique identifier of the domain.

slug
string
required

The domain name.

verified
boolean
default: falserequired

Whether the domain is verified.

primary
boolean
default: falserequired

Whether the domain is the primary domain for the workspace.

archived
boolean
default: falserequired

Whether the domain is archived.

placeholder
string
default: https://dub.co/help/article/what-is-dubrequired

Provide context to your teammates in the link creation modal by showing them an example of a link to be shortened.

expiredUrl
string | null
required

The URL to redirect to when a link under this domain has expired.

target
string | null
required

The page your users will get redirected to when they visit your domain.

type
enum<string>
required

The type of redirect to use for this domain.

Available options:
redirect,
rewrite
clicks
number
default: 0required

The number of clicks on the domain.