Skip to content
API reference/Redirects

Add a redirect

Try it

Sends visitors of an old address to a new one — live within a minute. A rule for the same old address is replaced. It can't shadow a page of the site, the home page, robots.txt, sitemap.xml or rss.xml. Up to 500 per site.

POST/api/v1/sites/{site_id}/redirects

Authentication

An API key as Authorization: Bearer or x-api-key. It needs the redirects:write scope — add and remove redirects (live within a minute).

redirects:writeChanges the live siteIdempotency-Key requiredMCP tool: set_redirect

Parameters

Named placeholders go in the path; the rest in a JSON body.

site_idstringPath · required
The site's id.1 to 100 characters
from_pathstringBody · required
The old address, e.g. /our-menu.html (a full old URL keeps only its path).At most 500 characters
tostringBody · required
A page on the site like /menu, or a full https:// address.At most 500 characters
status_codenumberBody · optional
301 = moved for good (keeps Google ranking); 302 = for now.Default 301

Response

201 with JSON on success (schema on the right). Errors use the standard envelope; a retry with the same Idempotency-Key gets the first answer back (how retries work).

curl
curl -X POST 'https://websites.workflowcorp.com/api/v1/sites/SITE_ID/redirects' \
  -H "Authorization: Bearer $WEBSITEBUDDY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"from_path":"/our-menu.html","to":"/menu","status_code":301}'
Example arguments
{
  "site_id": "SITE_ID",
  "from_path": "/our-menu.html",
  "to": "/menu",
  "status_code": 301
}
Response schema
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "from_path": {
      "type": "string",
      "description": "The old address, normalised: lower-case, no query, no trailing slash."
    },
    "to": {
      "type": "string",
      "description": "A path on the site or a full https:// address."
    },
    "status_code": {
      "anyOf": [
        {
          "type": "number",
          "const": 301
        },
        {
          "type": "number",
          "const": 302
        }
      ]
    },
    "hits": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "How many visitors it has sent on (about)."
    },
    "created_at": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "from_path",
    "to",
    "status_code",
    "hits",
    "created_at"
  ],
  "additionalProperties": false
}