## PATCH /api/v2/domains/{id}/email-forwarding/{ruleId}

**Change forwarding rule recipients**

Replaces the recipient list of one forwarding rule. The forwarding address itself cannot change. To use another address, delete the rule and create a new one with `POST /api/v2/domains/{id}/email-forwarding`. A new recipient address gets a verification e-mail. While any recipient in the list is unverified, nothing changes and `createOutcome.status` is `verification_required`. Send the same request again once every recipient has verified. To send a recipient the e-mail again, use `POST /api/v2/domains/{id}/email-forwarding/destinations/{destinationId}/verification`. Returns the domain's forwarding settings with the updated rule.

### Related Endpoints

- `DELETE /api/v2/domains/{id}/email-forwarding/{ruleId}`: Delete an email forwarding rule
- `GET /api/v2/domains/{id}/email-forwarding`: Get domain email forwarding
- `POST /api/v2/domains/{id}/email-forwarding`: Create an email forwarding rule

### Headers

- `Authorization`: Bearer $HOSTUP_API_KEY
- Scopes: `write:email`, `write:domains`
- `Content-Type`: application/json

### Parameters

- `id` (path, string, required): The domain ID (`dom_…`). Example: `dom_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `ruleId` (path, string, required): The forwarding rule ID (`ef_…`) from `rules[].id` on `GET /api/v2/domains/{id}/email-forwarding`. Example: `dom_01hxa3b4c5d6e7f8g9h0j1k2m3`

### Request Body

- `destinations` (array<string>, required): The complete new recipient list, 1 to 10 addresses. Addresses left out stop receiving mail. Example: `["owner@example.net","backup@example.org"]`

### Request Examples

#### Forward to two addresses

```bash
curl -X PATCH "https://cloud.hostup.se/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/email-forwarding/dom_01hxa3b4c5d6e7f8g9h0j1k2m3" \
  -H "Authorization: Bearer $HOSTUP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "destinations": [
      "owner@example.net",
      "backup@example.org"
    ]
  }'
```

```json
{
  "destinations": [
    "owner@example.net",
    "backup@example.org"
  ]
}
```

### Response Schema

- `enabled` (boolean, optional) Example: `true`
- `integrationStatus` (string, optional) Example: `enabled`
  Allowed values: enabled, disabled, unavailable
- `reason` (string, optional, nullable) Example: `null`
- `maxRules` (integer, optional) Example: `200`
- `ruleCount` (integer, optional) Example: `1`
- `rules` (array<object>, optional)
- `rules[].id` (string, required) Example: `ef_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `rules[].email` (string, required) Example: `hello@example.com`
- `rules[].destination` (string, required) Example: `owner@example.net`
- `rules[].isEnabled` (boolean, required) Example: `true`
- `rules[].name` (string, required, nullable) Example: `null`
- `rules[].priority` (integer, required) Example: `0`
- `destinations` (array<object>, optional)
- `destinations[].id` (string, required) Example: `efd_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `destinations[].email` (string, required) Example: `owner@example.net`
- `destinations[].verificationStatus` (string, required) Example: `verified`
  Allowed values: verified, pending, unverified
- `destinations[].createdAt` (string, required, nullable) Example: `2026-04-27T12:00:00.000Z`
- `destinations[].verifiedAt` (string, required, nullable) Example: `2026-04-27T12:05:00.000Z`
- `catchAll` (object | null, optional) Example: `{"action":"disabled","destination":null}`
- `catchAll.action` (string, required) Example: `disabled`
  Allowed values: forward, drop, disabled
- `catchAll.destination` (string, required, nullable) Example: `null`
- `existingMxRecords` (array<object>, optional)
- `existingMxRecords[].type` (string, required) Example: `MX`
  Allowed values: MX
- `existingMxRecords[].value` (string, required) Example: `mail.example.com`
- `existingMxRecords[].priority` (integer, required, nullable) Example: `10`
- `dnsActivation` (object, optional): Whether the domain's DNS zone at Hostup is live. E-mail forwarding runs on it. `active`: forwarding can be turned on now. `activating`: the domain already uses our nameservers and the zone is being activated. Reading this resource starts the check. Poll until `active`, usually a few minutes. `not_delegated`: the domain uses other nameservers. `unavailable`: there is no zone at Hostup or its state could not be read.
- `dnsActivation.status` (string, required) Example: `activating`
  Allowed values: active, activating, not_delegated, unavailable
- `dnsActivation.reason` (string, required, nullable): Why the zone is not active, in plain words. Null when it is active. Example: `The domain points at our nameservers and its DNS zone is being activated. This usually completes within a few minutes.`
- `dnsActivation.checkedAt` (string, required) Example: `2026-08-22T12:00:00.000Z`
- `actions` (object, optional)
- `actions.canCreateNewRule` (object, required)
- `actions.canCreateNewRule.allowed` (boolean, required) Example: `true`
- `actions.canCreateNewRule.reason` (string, required, nullable) Example: `null`
- `actions.canCreateNewRule.code` (string, optional, nullable): A machine-readable code for why the action is blocked. Example: `pending_order`
- `actions.canSetCatchAll` (object, required)
- `actions.canSetCatchAll.allowed` (boolean, required) Example: `true`
- `actions.canSetCatchAll.reason` (string, required, nullable) Example: `null`
- `actions.canSetCatchAll.code` (string, optional, nullable): A machine-readable code for why the action is blocked. Example: `pending_order`
- `createOutcome` (object, optional)
- `createOutcome.createdRuleCount` (integer, required) Example: `1`
- `createOutcome.createdRules` (array<object>, required)
- `createOutcome.createdRules[].id` (string, required) Example: `ef_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `createOutcome.createdRules[].email` (string, required) Example: `hello@example.com`
- `createOutcome.createdRules[].destination` (string, required) Example: `owner@example.net`
- `createOutcome.createdRules[].isEnabled` (boolean, required) Example: `true`
- `createOutcome.createdRules[].name` (string, required, nullable) Example: `null`
- `createOutcome.createdRules[].priority` (integer, required) Example: `0`

### Responses

#### 200 - The change was saved or a new recipient must verify first (`createOutcome.status`). The body is the domain's forwarding settings.
```json
{
  "enabled": true,
  "integrationStatus": "enabled",
  "reason": null,
  "maxRules": 200,
  "ruleCount": 1,
  "rules": [
    {
      "id": "ef_01hxa3b4c5d6e7f8g9h0j1k2m3",
      "email": "hello@example.com",
      "destination": "owner@example.net",
      "destinations": [
        "owner@example.net",
        "backup@example.org"
      ],
      "editable": true,
      "isEnabled": true,
      "name": "hello",
      "priority": 0
    }
  ],
  "destinations": [
    {
      "id": "efd_01hxa3b4c5d6e7f8g9h0j1k2m3",
      "email": "owner@example.net",
      "verificationStatus": "verified",
      "createdAt": "2026-04-27T12:00:00.000Z",
      "verifiedAt": "2026-04-27T12:05:00.000Z"
    },
    {
      "id": "efd_01hxb4c5d6e7f8g9h0j1k2m3n4",
      "email": "backup@example.org",
      "verificationStatus": "verified",
      "createdAt": "2026-04-27T12:00:00.000Z",
      "verifiedAt": "2026-04-27T12:06:00.000Z"
    }
  ],
  "catchAll": {
    "action": "disabled",
    "destination": null
  },
  "existingMxRecords": [],
  "dnsActivation": {
    "status": "active",
    "reason": null,
    "checkedAt": "2026-04-27T12:05:00.000Z"
  },
  "actions": {
    "canCreateNewRule": {
      "allowed": true,
      "reason": null
    },
    "canSetCatchAll": {
      "allowed": true,
      "reason": null
    }
  },
  "createOutcome": {
    "status": "completed",
    "reason": null,
    "createdRuleCount": 0,
    "createdRules": []
  }
}
```

#### 400 - The body has a field other than `destinations`, a recipient is invalid or the recipients would forward mail in a loop (`email_forwarding_loop`).
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Invalid request",
  "status": 400,
  "detail": "Only destinations can be updated.",
  "code": "invalid_request",
  "instance": "/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/email-forwarding/ef_01hxa3b4c5d6e7f8g9h0j1k2m3"
}
```

#### 401 - Unauthorized. Authentication is required.
```json
{
  "type": "https://developer.hostup.se/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authentication is required.",
  "code": "unauthorized",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 403 - Forbidden. The caller lacks a required scope or does not own the resource.
```json
{
  "type": "https://developer.hostup.se/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "The caller lacks a required scope or does not own the resource.",
  "code": "forbidden",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 404 - The domain, the rule or the domain's forwarding setup was not found.
```json
{
  "type": "https://developer.hostup.se/errors/email_forwarding_rule_not_found",
  "title": "Email forwarding rule not found",
  "status": 404,
  "detail": "The requested email forwarding rule could not be found.",
  "code": "email_forwarding_rule_not_found",
  "instance": "/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/email-forwarding/ef_01hxa3b4c5d6e7f8g9h0j1k2m3"
}
```

#### 409 - `email_forwarding_not_editable`: the rule was set up outside the forwarding settings (`rules[].editable` is false). `email_forwarding_busy`: another forwarding change on the domain is still running.
```json
{
  "type": "https://developer.hostup.se/errors/email_forwarding_not_editable",
  "title": "Rule cannot be edited",
  "status": 409,
  "detail": "This rule is managed outside the forwarding editor.",
  "code": "email_forwarding_not_editable",
  "instance": "/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/email-forwarding/ef_01hxa3b4c5d6e7f8g9h0j1k2m3"
}
```

#### 429 - Rate limited. Retry after the limit resets. 429 responses include `Retry-After` seconds plus `X-RateLimit-*` headers.
```json
{
  "type": "https://developer.hostup.se/errors/rate_limit_exceeded",
  "title": "Too many requests",
  "status": 429,
  "detail": "Rate limit exceeded. Please try again later.",
  "code": "rate_limit_exceeded",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 500 - Internal error. Retry later or contact support if the issue persists.
```json
{
  "type": "https://developer.hostup.se/errors/internal_error",
  "title": "Internal server error",
  "status": 500,
  "detail": "An unexpected error occurred. Retry later or contact support if the issue persists.",
  "code": "internal_error",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 502 - The forwarding service did not confirm the change. Read the rule list before you retry.
```json
{
  "type": "https://developer.hostup.se/errors/external_provider_failed",
  "title": "External provider failed",
  "status": 502,
  "detail": "Could not confirm the recipient change. Refresh the forwarding list before retrying.",
  "code": "external_provider_failed",
  "instance": "/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/email-forwarding/ef_01hxa3b4c5d6e7f8g9h0j1k2m3"
}
```
