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

Update Home Page Redirect URL

Pro plan only. When users visit your domain name, they will be redirected to your specified URL.

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

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

const u301 = new U301({
 apiKey,
 workspaceId,
});
const homePageRedirectUrl = 'https://example.com';
const isSuccess = await u301.domains.updateHomePageRedirectUrl('t.example.com', homePageRedirectUrl); // [!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.
homePageRedirectUrlBodystringThe destination URL where users will be redirected when they visit your domain.

Response

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

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

Last updated on

On this page