Pro plan only. When users visit a short link that does not exist, they will be redirected to your specified URL.
import { U301 } from 'u301';
const apiKey = '<YOUR_API_KEY>';
const workspaceId = '<YOUR_WORKSPACE_ID>';
const u301 = new U301({
apiKey,
workspaceId,
});
const notFoundPageRedirectUrl = 'https://example.com';
const isSuccess = await u301.domains.updateNotFoundPageRedirectUrl('t.example.com', notFoundPageRedirectUrl); // [!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. | ||
| notFoundPageRedirectUrl | Body | string | The destination URL where users will be redirected when they visit a short link that does not exist. |
Response
Return { success: true } on success, or throw an error if the update failed.
| Name | Type | Description |
|---|---|---|
| success | boolean | Whether the update was successful. |
{
"success": true
}Last updated on