GET
/
domains
import { Dub } from "dub";

const dub = new Dub({
  token: "DUB_API_KEY",
});

async function run() {
  const result = await dub.domains.list();

  for await (const page of result) {
    // Handle the page
    console.log(page);
  }
}

run();
[
  {
    "id": "<string>",
    "slug": "acme.com",
    "verified": false,
    "primary": false,
    "archived": false,
    "placeholder": "https://dub.co/help/article/what-is-dub",
    "expiredUrl": "https://acme.com/expired",
    "notFoundUrl": "https://acme.com/not-found",
    "createdAt": "<string>",
    "updatedAt": "<string>",
    "registeredDomain": {
      "id": "<string>",
      "createdAt": "<string>",
      "expiresAt": "<string>"
    }
  }
]

Authorizations

Authorization
string
header
required

Default authentication mechanism

Query Parameters

archived
boolean
default:false

Whether to include archived domains in the response. Defaults to false if not provided.

The search term to filter the domains by.

page
number
default:1

The page number for pagination.

Required range: x > 0
Example:

1

pageSize
number
default:50

The number of items per page.

Required range: 0 < x <= 50
Example:

50

Response

200
application/json
The domains were retrieved.
id
string
required

The unique identifier of the domain.

slug
string
required

The domain name.

Example:

"acme.com"

verified
boolean
default:false
required

Whether the domain is verified.

primary
boolean
default:false
required

Whether the domain is the primary domain for the workspace.

archived
boolean
default:false
required

Whether the domain is archived.

placeholder
string | null
required

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

Example:

"https://dub.co/help/article/what-is-dub"

expiredUrl
string | null
required

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

Example:

"https://acme.com/expired"

notFoundUrl
string | null
required

The URL to redirect to when a link under this domain doesn't exist.

Example:

"https://acme.com/not-found"

createdAt
string
required

The date the domain was created.

updatedAt
string
required

The date the domain was last updated.

registeredDomain
object | null
required

The registered domain record.