## PATCH /api/v2/account/service-consolidation

**Update monthly service invoice preferences**

Monthly service consolidation is separate from domain consolidation. Opt-in applies to future invoices, due when the first service renews. Existing invoices and service periods are unchanged. No payment-history, company or country requirement applies. The optional suggestion requires multiple upcoming renewals on different dates and respects explicit separation and dismissal. Read actions.canToggle before offering a change. Changing preferences requires account-owner access or an explicitly scoped API key. After a 503, reload before retrying.

### Related Endpoints

- `GET /api/v2/account/service-consolidation`: Get monthly service invoice preferences
- `GET /api/v2/account/invoice-lead`: Get invoice timing
- `PATCH /api/v2/account/invoice-lead`: Update invoice timing

### Headers

- `Accept`: application/json
- `Authorization`: Bearer YOUR_API_KEY
- Required API scope: `write:billing`
- `Content-Type`: application/json

### Request Body

- `enabled` (boolean, optional): Enable or disable combining future monthly service invoices.
- `dismissSuggestion` (boolean, optional): Permanently dismiss the service consolidation suggestion.
  Allowed values: true

### Request Examples

#### enable

```bash
curl -X PATCH "https://cloud.hostup.se/api/v2/account/service-consolidation" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true
  }'
```

```json
{
  "enabled": true
}
```

#### separate

```bash
curl -X PATCH "https://cloud.hostup.se/api/v2/account/service-consolidation" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": false
  }'
```

```json
{
  "enabled": false
}
```

#### dismiss

```bash
curl -X PATCH "https://cloud.hostup.se/api/v2/account/service-consolidation" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "dismissSuggestion": true
  }'
```

```json
{
  "dismissSuggestion": true
}
```

### Response Schema

- `enabled` (boolean, required)
- `available` (boolean, required)
- `suggestion` (object, required)
- `suggestion.show` (boolean, required)
- `suggestion.settingsUrl` (string, required)
- `actions` (object, required)
- `actions.canToggle` (object, required)
- `actions.canToggle.allowed` (boolean, required)
- `actions.canToggle.reason` (string, required, nullable): Nullable (may be null when not applicable).

### Responses

#### 200 - Current service invoice preference.
```json
{
  "enabled": false,
  "available": true,
  "suggestion": {
    "show": true,
    "settingsUrl": "/account?tab=billing#service-invoices"
  },
  "actions": {
    "canToggle": {
      "allowed": true,
      "reason": null
    }
  }
}
```

#### 400 - Send either enabled as a boolean or dismissSuggestion as true.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Invoice preferences",
  "status": 400,
  "code": "invalid_request",
  "detail": "Send either enabled as a boolean or dismissSuggestion as true.",
  "instance": "/api/v2/account/service-consolidation"
}
```

#### 401 - Authentication is required.
```json
{
  "type": "https://developer.hostup.se/errors/unauthorized",
  "title": "Invoice preferences",
  "status": 401,
  "code": "unauthorized",
  "detail": "Authentication is required.",
  "instance": "/api/v2/account/service-consolidation"
}
```

#### 403 - Account-owner access is required.
```json
{
  "type": "https://developer.hostup.se/errors/forbidden",
  "title": "Invoice preferences",
  "status": 403,
  "code": "forbidden",
  "detail": "Account-owner access is required.",
  "instance": "/api/v2/account/service-consolidation"
}
```

#### 404 - Not found. The resource does not exist or is not owned by the caller.
```json
{
  "type": "https://developer.hostup.se/errors/not_found",
  "title": "Not found",
  "status": 404,
  "detail": "The requested resource could not be found.",
  "code": "not_found",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 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": "Too many requests. Retry after the limit resets.",
  "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"
}
```

#### 503 - Invoice preferences could not be confirmed. Reload before retrying.
```json
{
  "type": "https://developer.hostup.se/errors/billing_state_unavailable",
  "title": "Invoice preferences",
  "status": 503,
  "code": "billing_state_unavailable",
  "detail": "Invoice preferences could not be confirmed. Reload before retrying.",
  "instance": "/api/v2/account/service-consolidation"
}
```
