## Site cache group and per-site changes (`cache-sites`)

View or set the cache group used by one site and its per-site changes (added, modified, deleted rules and the ignore-params list).

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

### GET `/api/v2/cache-sites/{id}`

Site cache group and per-site changes · Authentication: User (some parameters admin only)

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

### PUT `/api/v2/cache-sites/{id}`

Change the cache group used by a site · Authentication: User (some parameters admin only)

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `expected_updated_at` | string |  | Optimistic lock (used on update) - the updated_at of the resource as the caller read it. If it differs from the stored one, 409 stale_version is returned and nothing is saved; omit to skip the check; ignored on create. |
| `group_id` | integer | Yes | Group referenced explicitly; null = follows the default group. |
| `keep` | boolean |  | Whether to keep the per-site changes when switching; omitted or true = keep and convert them by the group-change rules, false = drop them (clear) and follow the new group entirely. |

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

### PUT `/api/v2/cache-sites/{id}/overlay`

Save the per-site cache changes · Authentication: User (some parameters admin only)

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `expected_updated_at` | string |  | Optimistic lock (used on update) - the updated_at of the resource as the caller read it. If it differs from the stored one, 409 stale_version is returned and nothing is saved; omit to skip the check; ignored on create. |
| `overlay` | object | Yes | Per-site changes; null = none. |

```sh
curl -X PUT "https://panel.example.com/api/v2/cache-sites/{id}/overlay" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### DELETE `/api/v2/cache-sites/{id}/overlay`

Reset the site to its cache group as is · Authentication: User (some parameters admin only)

```sh
curl -X DELETE "https://panel.example.com/api/v2/cache-sites/{id}/overlay" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### GET `/api/v2/cache-sites/{id}/switch-preview`

Preview the site's rules after switching cache group · Authentication: User (some parameters admin only)

Query parameters:

| Field | Type | Required | Description |
|---|---|---|---|
| `group_id` | integer |  | Id of the target cache group (a platform group or one owned by the site's tenant); omit = follow the default group. |
| `keep` | boolean |  | Whether to keep the per-site changes, default true; false = drop them and follow the new group entirely. Default: true |

```sh
curl "https://panel.example.com/api/v2/cache-sites/{id}/switch-preview" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

Site cache group and per-site changes object:

| Field | Type | Required | Description |
|---|---|---|---|
| `counts` | object |  | Summary counts after the switch. |
| `effective` | CacheConfig |  | Cache rules, same as the cache field ({rules, ignore_params}) of the node contract schema/site.json; validated by the server against the contract. |
| `effective_group_id` | integer |  | Group actually in effect; null = no usable group (the factory preset applies; no group rules are pushed). |
| `expected_updated_at` | string |  | Optimistic lock (used on update) - the updated_at of the resource as the caller read it. If it differs from the stored one, 409 stale_version is returned and nothing is saved; omit to skip the check; ignored on create. |
| `group_id` | integer |  | Group referenced explicitly; null = follows the default group. |
| `group_ignore_params` | string[] |  | The group's own ignore-params list after the switch. |
| `group_name` | string |  | Name of the group in effect after the switch; omitted when there is no usable group. |
| `ignore_params` | string[] |  | The ignore-params list in effect after the switch. |
| `ignore_params_changed` | boolean |  | Whether the ignore-params list is this site's own value (differs from the group). |
| `keep` | boolean |  | Whether to keep the per-site changes when switching; omitted or true = keep and convert them by the group-change rules, false = drop them (clear) and follow the new group entirely. |
| `overlay` | object |  | Per-site changes; null = none. |
| `overlay_count` | integer |  | Number of changes: rule changes + 1 if the ignore-params list is changed. |
| `rows` | CacheSwitchRow[] |  | Rules one by one in display order; deleted rows stay at their position in the group. |
| `site_id` | integer |  | Site ID |
| `updated_at` | string |  | updated_at of the site (the version of the site row, also bumped when the group or the per-site changes are changed); send it back as expected_updated_at when writing. (read-only) |
