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

Set Random ShortCode Length

Set random short code length for your branded domain, typically from 4-10 characters

u301.domains.setRandomCodeLength
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);

the response

Request

NameLocationTypeRequiredDefaultDescription
AuthorizationHeaderstringBearer token used for authentication.
workspaceIdQuerystringWorkspace identifier for multi‑tenant routing.
domainPathstringDomain for the short link.
randomCodeLengthBodynumber6Length of the random path segment.

Response

Return { success: true } on success, or throw an error if the domain creation failed.

NameTypeDescription
successbooleanWhether the domain creation was successful.
response-example.json
{
  "success": true
}

Last updated on

On this page