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.
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);Request
| Name | Location | Type | Required | Default | Description |
|---|---|---|---|---|---|
Authorization | Header | string | Bearer token used for authentication. | ||
workspaceId | Query | string | Workspace identifier for multi‑tenant routing. |
Response
Returns an array where each item is a domain object with the following fields:
| Name | Type | Description |
|---|---|---|
domain | string | Domain name. |
isPrimary | boolean | Whether the domain is the primary domain for the workspace. |
isGlobal | boolean | Whether the domain is a global domain. |
[
{
"domain": "u301.co",
"isPrimary": true,
"isGlobal": true
},
{
"domain": "example.com",
"isPrimary": false,
"isGlobal": false
}
]Last updated on