## Site cache mode (`cache-sites`)

View or set the cache group or custom rules used by one site.

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

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

Site cache mode · 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}`

Set 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. |

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

Site cache mode object:

| Field | Type | Required | Description |
|---|---|---|---|
| `effective_group_id` | integer |  | Group actually in effect when mode=group; null = no usable group (no cache 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. |
| `mode` | string |  | Cache mode: group = follows a cache group; custom = site's own rules. Values: ["group","custom"] |
| `site_id` | integer |  | Site ID |
| `updated_at` | string |  | updated_at of the site (the version of the site row, also bumped when the cache mode changes); send it back as expected_updated_at when changing the cache mode. (read-only) |
