## Cache policy (`cache-policy`)

Sets the tenant's default cache group and can reset all sites to follow it.

Authentication: User (some parameters admin only) · Docs: https://www-sa2.kuxitong.com/en/docs/api/cache-policy

### GET `/api/v2/cache-policy`

Cache policy · Authentication: User (some parameters admin only)

Query parameters:

| Field | Type | Required | Description |
|---|---|---|---|
| `tenant_id` | integer |  | Admin only: filter by tenant (a malformed value returns 422). Ignored for tenant credentials, which only see their own tenant's data |

```sh
curl "https://panel.example.com/api/v2/cache-policy" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### PUT `/api/v2/cache-policy`

Set the tenant's default group · Authentication: User (some parameters admin only)

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `default_group_id` | integer | Yes | Platform default group; null = no group yet. |

```sh
curl -X PUT "https://panel.example.com/api/v2/cache-policy" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### GET `/api/v2/cache-policy/default-impact`

Preview the impact of changing the default group · Authentication: User (some parameters admin only)

Query parameters:

| Field | Type | Required | Description |
|---|---|---|---|
| `tenant_id` | integer |  | Admin only: filter by tenant (a malformed value returns 422). Ignored for tenant credentials, which only see their own tenant's data |
| `default_group_id` | integer | Yes | Id of the cache group to be used as default. |

```sh
curl "https://panel.example.com/api/v2/cache-policy/default-impact" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### POST `/api/v2/cache-policy/reset-sites`

Reset all sites to the default group · Authentication: User (some parameters admin only)

```sh
curl -X POST "https://panel.example.com/api/v2/cache-policy/reset-sites" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

Cache policy object:

| Field | Type | Required | Description |
|---|---|---|---|
| `affected_sites` | integer |  | Sites following the default: no explicit group and the group in effect would change. |
| `applied` | integer |  | Number of sites updated. |
| `default_group_id` | integer |  | Platform default group; null = no group yet. |
| `my_default_group_id` | integer |  | Default group in effect for this tenant (the one it set, or the platform default if none). |
| `my_default_group_set` | boolean |  | Whether this tenant has set its own default group. |
| `over_limit_sites` | integer |  | Of those, sites whose merged rules would exceed 128 after conversion, so the real change would be rejected with 422. |
| `overlay_sites` | integer |  | Of those, sites with per-site changes that would be converted. |
| `sites` | object |  | Number of the tenant's sites: total = all sites, overlay = those with per-site cache changes, follow_default = those whose cache group follows the default (no group set, or the group set is the tenant's effective default; independent of per-site changes). |
