# POST /websites/:website_id/redirects

**Resource:** [Websites](./websites.md)  
**MCP tool:** `set_website_redirect`  
**Scopes:** `websites:write`  
**Write operation:** yes

Add or update one path redirect on a website, then publish it to the live site. Use for short branded links (send "/video" to a long booking URL so an SMS carries the client's own domain) and for fixing broken URLs found by get_website_broken_urls. Re-calling with the same source_path re-points it, so this both creates and edits. Publishing commits to the site's repo and rebuilds it, so the redirect is normally live within a couple of minutes. The website must have a connected repository.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `website_id` | path | string | yes | UUID of the website. Get ids from list_websites. |
| `source_path` | body | string | yes | The path on this site to redirect FROM, starting with "/", e.g. "/video". A single trailing "*" redirects a whole section, e.g. "/old-blog/*". |
| `target_url` | body | string | yes | Where to send the visitor: a full https:// address, or a path on the same site starting with "/". |
| `status_code` | body | number | no | HTTP redirect status: 301 (permanent), 302 (temporary, the default), 307, or 308. Use 302 unless the destination is settled, because browsers cache a 301 hard. |
| `is_active` | body | boolean | no | Whether the redirect is live. Defaults to true. Set false to switch one off without deleting it. |
| `publish` | body | boolean | no | Whether to rebuild the live site now. Defaults to true. Pass false for each of a batch of redirects, then call publish_website_redirects once, so the site rebuilds a single time instead of once per redirect. Note this only defers the rebuild: publishing always writes every active redirect, so the next publish from any redirect takes this one live too. To keep a redirect off the live site regardless, set is_active false instead. |
| `require_approval` | body | boolean | no | Optional. Set true to route this write into the approval queue for human review instead of executing it immediately (returns 202 + an approval_id). Works even when your key/token has permission to execute directly. |

## Request example

```bash
curl -X POST   "https://api.trustpager.com/functions/v1/api/v1/websites/:website_id/redirects"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"source_path":"...","target_url":"...","status_code":"..."}'
```

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`