The SDK is currently in active development. For more details, see the U301 Postman docs.

List all available domains in your workspace

Domains come in two categories: system‑provided domains and branded domains you add yourself. Use u301.domains.list to list all domains available in your workspace. You can choose which domain to use later when you create short links.

You can add branded domains in the U301 Console. For example, if your domain is example.com, you can add a subdomain like t.example.com for short links, or register a dedicated short domain such as examp.le.

Use the u301.domains.list method to retrieve all available domains.

u301.domains.list
import { U301 } from 'u301';

const apiKey = '<YOUR_API_KEY>';
const workspaceId = '<YOUR_WORKSPACE_ID>';

const u301 = new U301({
  apiKey,
  workspaceId,
});
const domains = await u301.domains.list(); // [!code highlight]
console.log(domains);

the response

Request

NameLocationTypeRequiredDefaultDescription
AuthorizationHeaderstringBearer token used for authentication.
workspaceIdQuerystringWorkspace identifier for multi‑tenant routing.

Response

Returns an array where each item is a domain object with the following fields:

NameTypeDescription
domainstringDomain name.
isPrimarybooleanWhether the domain is the primary domain for the workspace.
isGlobalbooleanWhether the domain is a global domain.
response-example.json
[
  {
    "domain": "u301.co",
    "isPrimary": true,
    "isGlobal": true
  },
  {
    "domain": "example.com",
    "isPrimary": false,
    "isGlobal": false
  }
]

Last updated on

On this page