Create a URL redirect for one owned domain. Get {id} from GET /api/v2/domains data[].id; the sourceUrl host must be the domain or one of its subdomains. Use this endpoint instead of manually adding DNS records for URL forwarding. The API creates or reuses the needed DNS anchor records for the source hostname.…
Create a URL redirect for one owned domain. Get {id} from GET /api/v2/domains data[].id; the sourceUrl host must be the domain or one of its subdomains. Use this endpoint instead of manually adding DNS records for URL forwarding. The API creates or reuses the needed DNS anchor records for the source hostname. If an existing A/AAAA/CNAME/ALIAS record conflicts with the redirect anchor, the route returns 409 dns_conflict instead of silently overwriting a live website. Only sourceUrl and targetUrl are required. Defaults are httpStatusCode: 301, scope: "exact", preserveQuery: false, includeSubdomains: false, and preservePath: false. The domain can have up to 10 redirect rules. A newly created rule may return status: "pending_dns" until the domain's DNS is active for redirects.
write:domains
Use Authorization: Bearer <token> for API keys. Dashboard sessions may also use hostup_session.
id string required
Example: dom_01hxa3b4c5d6e7f8g9h0j1k2m3 Public domain ID from `GET /api/v2/domains` `data[].id`. Do not invent this value; use the exact ID returned by the referenced API response.
Accept Example Content-Type Example sourceUrl string required
· Example: https://www.example.com Source URL on the owned domain or one of its subdomains.
targetUrl string required
· Example: https://example.com Absolute destination URL.
httpStatusCode integer · enum
· Example: 301 301 302 307 308 scope string · enum
· Example: root_www `root_www` prepares both the apex and `www`; `subdomains` prepares wildcard subdomains; `all` prepares apex plus wildcard.
exact root_www subdomains all preserveQuery boolean
· Example: false When true, keep the original query string on the redirected request.
includeSubdomains boolean
· Example: false When true, broaden matching to subdomains. Prefer selecting the intended `scope` explicitly.
preservePath boolean
· Example: false When true, append the source path suffix to the target URL.
description stringnull
· Example: Redirect www to apex id string
· Example: redir_01hxa3b4c5d6e7f8g9h0j1k2m3 domainId string
· Example: dom_01hxa3b4c5d6e7f8g9h0j1k2m3 sourceHost string
· Example: www.example.com sourcePath stringnull
· Example: null sourceUrl string
· Example: https://www.example.com targetUrl string
· Example: https://example.com httpStatusCode integer · enum
· Example: 301 301 302 307 308 scope string · enum
· Example: root_www exact root_www subdomains all preservePath boolean
· Example: false preserveQuery boolean
· Example: false includeSubdomains boolean
· Example: false status string · enum
· Example: active active pending_dns error disabled reason stringnull
· Example: null description stringnull
· Example: Redirect www to apex createdAt stringnull
· Example: 2026-04-27T12:00:00.000Z updatedAt stringnull
· Example: 2026-04-27T12:00:00.000Z type string
· Example: https://developer.hostup.se/errors/invalid_request title string
· Example: Validation failed status integer
· Example: 400 detail string
· Example: The request body failed validation. code string
· Example: invalid_request Stable machine-readable code. Branch on this field, not on `detail`.
instance string
· Example: /api/v2/orders requestId string
· Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3 timestamp string
· Example: 2026-04-27T12:34:56.000Z errors array<object> Field-level validation errors when `code` is `invalid_request`.
errors[].pointer string required
· Example: /items/0/eppCode errors[].detail string required
· Example: `eppCode` is required for this transfer. errors[].code string required
· Example: missing_required extensions object type string
· Example: https://developer.hostup.se/errors/invalid_request title string
· Example: Validation failed status integer
· Example: 400 detail string
· Example: The request body failed validation. code string
· Example: invalid_request Stable machine-readable code. Branch on this field, not on `detail`.
instance string
· Example: /api/v2/orders requestId string
· Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3 timestamp string
· Example: 2026-04-27T12:34:56.000Z errors array<object> Field-level validation errors when `code` is `invalid_request`.
errors[].pointer string required
· Example: /items/0/eppCode errors[].detail string required
· Example: `eppCode` is required for this transfer. errors[].code string required
· Example: missing_required extensions object type string
· Example: https://developer.hostup.se/errors/invalid_request title string
· Example: Validation failed status integer
· Example: 400 detail string
· Example: The request body failed validation. code string
· Example: invalid_request Stable machine-readable code. Branch on this field, not on `detail`.
instance string
· Example: /api/v2/orders requestId string
· Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3 timestamp string
· Example: 2026-04-27T12:34:56.000Z errors array<object> Field-level validation errors when `code` is `invalid_request`.
errors[].pointer string required
· Example: /items/0/eppCode errors[].detail string required
· Example: `eppCode` is required for this transfer. errors[].code string required
· Example: missing_required extensions object type string
· Example: https://developer.hostup.se/errors/invalid_request title string
· Example: Validation failed status integer
· Example: 400 detail string
· Example: The request body failed validation. code string
· Example: invalid_request Stable machine-readable code. Branch on this field, not on `detail`.
instance string
· Example: /api/v2/orders requestId string
· Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3 timestamp string
· Example: 2026-04-27T12:34:56.000Z errors array<object> Field-level validation errors when `code` is `invalid_request`.
errors[].pointer string required
· Example: /items/0/eppCode errors[].detail string required
· Example: `eppCode` is required for this transfer. errors[].code string required
· Example: missing_required extensions object type string
· Example: https://developer.hostup.se/errors/invalid_request title string
· Example: Validation failed status integer
· Example: 400 detail string
· Example: The request body failed validation. code string
· Example: invalid_request Stable machine-readable code. Branch on this field, not on `detail`.
instance string
· Example: /api/v2/orders requestId string
· Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3 timestamp string
· Example: 2026-04-27T12:34:56.000Z errors array<object> Field-level validation errors when `code` is `invalid_request`.
errors[].pointer string required
· Example: /items/0/eppCode errors[].detail string required
· Example: `eppCode` is required for this transfer. errors[].code string required
· Example: missing_required extensions object type string
· Example: https://developer.hostup.se/errors/invalid_request title string
· Example: Validation failed status integer
· Example: 400 detail string
· Example: The request body failed validation. code string
· Example: invalid_request Stable machine-readable code. Branch on this field, not on `detail`.
instance string
· Example: /api/v2/orders requestId string
· Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3 timestamp string
· Example: 2026-04-27T12:34:56.000Z errors array<object> Field-level validation errors when `code` is `invalid_request`.
errors[].pointer string required
· Example: /items/0/eppCode errors[].detail string required
· Example: `eppCode` is required for this transfer. errors[].code string required
· Example: missing_required extensions object https://cloud.hostup.se/api/v2/domains/{id}/redirects curl -X POST "https://cloud.hostup.se/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/redirects" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"sourceUrl": "https://www.example.com",
"targetUrl": "https://example.com",
"httpStatusCode": 301,
"scope": "root_www",
"description": "Redirect www to apex"
}' {
"id": "redir_01hxa3b4c5d6e7f8g9h0j1k2m3",
"domainId": "dom_01hxa3b4c5d6e7f8g9h0j1k2m3",
"sourceHost": "www.example.com",
"sourcePath": null,
"sourceUrl": "https://www.example.com",
"targetUrl": "https://example.com",
"httpStatusCode": 301,
"scope": "root_www",
"preservePath": false,
"preserveQuery": false,
"includeSubdomains": false,
"status": "active",
"reason": null,
"description": "Redirect www to apex",
"createdAt": "2026-04-27T12:00:00.000Z",
"updatedAt": "2026-04-27T12:00:00.000Z"
} {
"sourceUrl": "https://www.example.com",
"targetUrl": "https://example.com",
"httpStatusCode": 301,
"scope": "root_www",
"description": "Redirect www to apex"
}