Skip to content

Update a rewrite rule

PATCH
/api/zones/{zoneId}/rewrite-rules/{id}

Updates the writable fields of a rewrite rule. The rule's zone cannot be changed. Changing "order" re-sequences the other rules in the zone so ordering stays contiguous. Uniqueness (name, and operator+source-pattern) and regex/target validity are re-checked on update.

Authorizations

ApiToken

Long-lived API token created via POST /api/api-tokens (returned once in plaintext).

Type
API Key (header: X-API-TOKEN)
or
JWT

JWT access token obtained via POST /api/auth/login. Send as: Authorization: Bearer .

Type
HTTP (bearer)

Parameters

Path Parameters

zoneId*

Zone identifier

Type
string
Required
id*

rewrite-rule identifier

Type
string
Required

Request Body

application/merge-patch+json
JSON
{
  
"name": "Redirect old blog paths",
  
"description": "Rewrites legacy /blog/* URLs to the new /articles/* structure.",
  
"operator": "regex",
  
"sourcePattern": "^/blog/(.*)$",
  
"target": "/articles/$1",
  
"order": 0,
  
"enabled": true
}

Responses

rewrite-rule resource updated

JSON
{
  
"@context": "string",
  
"@id": "string",
  
"@type": "string",
  
"id": "string",
  
"zone": "https://example.com/",
  
"name": "Redirect old blog paths",
  
"description": "Rewrites legacy /blog/* URLs to the new /articles/* structure.",
  
"operator": "regex",
  
"sourcePattern": "^/blog/(.*)$",
  
"target": "/articles/$1",
  
"order": 0,
  
"enabled": true,
  
"createdAt": "string",
  
"updatedAt": "string"
}

Playground

Authorization
Variables
Key
Value
Body

Samples

Powered by VitePress OpenAPI