Update a domain redirect
PATCH /api/v2/domains/{id}/redirects/{ruleId}
Changes a URL redirect. Send only the fields to change. Absent fields keep their stored values. Send enabled: false to pause a redirect without deleting it. enabled: true turns it back on. A new sourceUrl must still be on the domain or one of its subdomains. A target the rule itself would match is rejected with 400 invalid_request and errors[].code: "redirect_loop". Returns the updated redirect.
Authentication: An API key with the scope write:domains. About keys and scopes
Request
Path parameters
idstringrequiredThe domain ID (
dom_…).ruleIdstringrequiredThe redirect ID (
redir_…) from rules[].id on GET /api/v2/domains/{id}/redirects.Body
sourceUrlstringThe address to redirect, on the domain or one of its subdomains. Unicode and punycode hostnames are both accepted.
targetUrlstringThe absolute URL to send visitors to. Unicode and punycode hostnames are both accepted.
httpStatusCodeinteger301 or 308 for a permanent redirect, 302 or 307 for a temporary one. One of
301, 302, 307, 308.scopestringWhich hostnames the rule matches:
exact, root_www, subdomains or all. One of exact, root_www, subdomains, all.preserveQuerybooleanKeep the query string on the redirected request.
includeSubdomainsbooleanMatch subdomains of the source host.
includeSubpathsbooleanRedirect every page below the source address too.
preservePathbooleanSend each page to the same path on the target.
true implies includeSubpaths: true. includeSubpaths: false turns it off.descriptionstring or nullYour own note for the rule, up to 1024 characters.
null clears it.enabledbooleanfalse pauses the redirect. true turns it back on.Example
curl -X PATCH "https://cloud.hostup.se/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/redirects/redir_01hxa3b4c5d6e7f8g9h0j1k2m3" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "targetUrl": "https://example.com/new-home", "httpStatusCode": 302 }'curl -X PATCH "https://cloud.hostup.se/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/redirects/redir_01hxa3b4c5d6e7f8g9h0j1k2m3" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "enabled": false }'Responses
200 The updated redirect.
{ "id": "redir_01hxa3b4c5d6e7f8g9h0j1k2m3", "domainId": "dom_01hxa3b4c5d6e7f8g9h0j1k2m3", "sourceHost": "www.example.com", "sourcePath": null, "sourceUrl": "https://www.example.com", "targetUrl": "https://example.com/new-home", "httpStatusCode": 302, "scope": "exact", "includeSubpaths": false, "preservePath": false, "preserveQuery": false, "includeSubdomains": false, "status": "active", "reason": null, "description": "Temporary campaign redirect", "createdAt": "2026-04-27T12:00:00.000Z", "updatedAt": "2026-04-27T12:30:00.000Z"}Response fields
idstringdomainIdstringsourceHoststringThe source host. An internationalised hostname is returned in Unicode, not punycode.
sourcePathstring or nullsourceUrlstringThe source URL. An internationalised hostname is returned in Unicode.
targetUrlstringThe target URL. An internationalised hostname is returned in Unicode.
httpStatusCodeintegerOne of
301, 302, 307, 308.scopestringOne of
exact, root_www, subdomains, all.includeSubpathsbooleanEvery page below the source address is redirected too, not only the source address itself.
preservePathbooleanEach matched page goes to the same path on the target. Only true together with
includeSubpaths.preserveQuerybooleanincludeSubdomainsbooleanstatusstringOne of
active, pending_dns, error, disabled.reasonstring or nulldescriptionstring or nullcreatedAtstring or nullupdatedAtstring or nullErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Invalid request. The response body is an RFC 7807 Problem Details document. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | Not found. The resource does not exist or is not owned by the caller; code names the missing resource: domain_not_found, redirect_not_found. |
| 409 | Another redirect on the domain already uses the new source URL. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |
| 502 | The change could not be applied right now. The redirect is unchanged. |