Manage redirects for your domain

Set up redirects from one URL to another for your domain. This is useful when changing your website's address or ensuring visitors land on the correct page. The endpoint returns a `cloudflare_rule_id` that you use to call DELETE /api/redirects.

Domain Services Redirects

Context

Workflow links

Requires
Produces

Headers

Accept Example
Content-Type Example

Body

required
application/json
description string required · Example:
domain_id string required · Example: 21345
domain_name string required · Example: example.com
include_subdomains boolean required · Example: true
preserve_query_string boolean required · Example: false
redirect_scope string · enum required · Example: all
all
exact
root_www
source_url string required · Example: https://example.com/
status_code integer required · Example: 301
subpath_matching boolean required · Example: false
target_url string required · Example: https://example.com/

Responses

200
data object required
data.rule object required
data.rule.cloudflare_rule_id string required · Example: a7355385a0b4407db9286f1b4ca90598
data.rule.cloudflare_ruleset_id string required · Example: 572e00508d49439984c9fdd47b68724c
data.rule.cloudflare_zone_id string required · Example: f17d6880c12f2a39b09b5d6fb59a6b3a
data.rule.created_at string required · Example: 2026-02-10T00:00:00.000Z
data.rule.created_by integer required · Example: 10682
data.rule.description string required · Example:
data.rule.domain_id integer required · Example: 21345
data.rule.domain_name string required · Example: example.com
data.rule.enabled boolean required · Example: true
data.rule.id integer required · Example: 650
data.rule.include_subdomains boolean required · Example: true
data.rule.preserve_path_suffix boolean required · Example: false
data.rule.preserve_query_string boolean required · Example: false
data.rule.redirect_scope string · enum required · Example: all
all
exact
root_www
data.rule.source_url string required · Example: https://example.com/
data.rule.status_code integer required · Example: 301
data.rule.subpath_matching boolean required · Example: false
data.rule.target_url string required · Example: https://example.com/
data.rule.updated_at string required · Example: 2026-02-10T00:00:00.000Z
requestId string required · Example: 2121ae20-bd9d-41e9-aeeb-5dd1dd1a24ba

Unique request identifier (UUID).

success boolean required · Example: true

True for successful responses.

timestamp string required · Example: 2026-02-10T00:00:00.000Z

ISO 8601 timestamp (UTC).

500
code string required · Example: INTERNAL_ERROR

Machine-readable error code.

error string required · Example: Internal Server Error

HTTP status title (e.g. 'Bad Request').

message string required · Example: An unexpected error occurred

Human-readable message.

requestId string required · Example: 2121ae20-bd9d-41e9-aeeb-5dd1dd1a24ba

Unique request identifier (UUID).

timestamp string required · Example: 2026-02-10T00:00:00.000Z

ISO 8601 timestamp (UTC).

POST https://cloud.hostup.se/api/redirects
For AI assistants
cURL
curl -X POST "https://cloud.hostup.se/api/redirects" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domain_id": "21345",
    "domain_name": "example.com",
    "source_url": "https://example.com/",
    "target_url": "https://example.com/",
    "status_code": 301,
    "redirect_scope": "all",
    "preserve_query_string": false,
    "include_subdomains": true,
    "subpath_matching": false,
    "description": ""
  }'
Response
{
  "success": true,
  "timestamp": "2026-02-10T00:00:00.000Z",
  "requestId": "2121ae20-bd9d-41e9-aeeb-5dd1dd1a24ba",
  "data": {
    "rule": {
      "id": 650,
      "domain_id": 21345,
      "domain_name": "example.com",
      "cloudflare_zone_id": "f17d6880c12f2a39b09b5d6fb59a6b3a",
      "cloudflare_ruleset_id": "572e00508d49439984c9fdd47b68724c",
      "cloudflare_rule_id": "a7355385a0b4407db9286f1b4ca90598",
      "source_url": "https://example.com/",
      "target_url": "https://example.com/",
      "status_code": 301,
      "preserve_query_string": false,
      "include_subdomains": true,
      "preserve_path_suffix": false,
      "subpath_matching": false,
      "description": "",
      "enabled": true,
      "created_at": "2026-02-10T00:00:00.000Z",
      "updated_at": "2026-02-10T00:00:00.000Z",
      "created_by": 10682,
      "redirect_scope": "all"
    }
  }
}
Request Body Example 1
{
  "domain_id": "21345",
  "domain_name": "example.com",
  "source_url": "https://example.com/",
  "target_url": "https://example.com/",
  "status_code": 301,
  "redirect_scope": "all",
  "preserve_query_string": false,
  "include_subdomains": true,
  "subpath_matching": false,
  "description": ""
}