Set random short code length for your branded domain, typically from 4-10 characters
import { U301 } from 'u301';
const apiKey = '<YOUR_API_KEY>';
const workspaceId = '<YOUR_WORKSPACE_ID>';
const u301 = new U301({
apiKey,
workspaceId,
});
const randomCodeLength = 6
const isSuccess = await u301.domains.setRandomCodeLength('t.example.com', randomCodeLength) // [!code highlight]
console.log(isSuccess);Request
| Name | Location | Type | Required | Default | Description |
|---|---|---|---|---|---|
| Authorization | Header | string | Bearer token used for authentication. | ||
| workspaceId | Query | string | Workspace identifier for multi‑tenant routing. | ||
| domain | Path | string | Domain for the short link. | ||
| randomCodeLength | Body | number | 6 | Length of the random path segment. |
Response
Return { success: true } on success, or throw an error if the domain creation failed.
| Name | Type | Description |
|---|---|---|
| success | boolean | Whether the domain creation was successful. |
{
"success": true
}Last updated on