## User defaults (`user-defaults`)

Default fields applied when creating a site or TCP/UDP forwarding, stored per kind.

Authentication: User · Docs: https://www.gocdn888.com/en/docs/api/user-defaults

### GET `/api/v2/user-defaults/{kind}`

Get user default settings · Authentication: User

```sh
curl "https://panel.example.com/api/v2/user-defaults/{kind}" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### PUT `/api/v2/user-defaults/{kind}`

Update user default settings · Authentication: User

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `expected_updated_at` | string |  | Optimistic lock - the updated_at as the caller read it (when the read updated_at is null, i.e. never set, use 1970-01-01T00:00:00Z). If it differs from the stored one, 409 stale_version is returned and nothing is saved; omit to skip the check. |
| `value` | object | Yes | Default fields (a subset of the top-level fields of the site/stream contract). |

```sh
curl -X PUT "https://panel.example.com/api/v2/user-defaults/{kind}" \
  -H "X-API-Key: $GOCDN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value":{"balance":"rr","origin_timeout_s":60}}'
```

### DELETE `/api/v2/user-defaults/{kind}`

Clear user default settings · Authentication: User

```sh
curl -X DELETE "https://panel.example.com/api/v2/user-defaults/{kind}" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

User defaults object:

| Field | Type | Required | Description |
|---|---|---|---|
| `expected_updated_at` | string |  | Optimistic lock - the updated_at as the caller read it (when the read updated_at is null, i.e. never set, use 1970-01-01T00:00:00Z). If it differs from the stored one, 409 stale_version is returned and nothing is saved; omit to skip the check. |
| `kind` | string |  | Kind of defaults: site or stream. Values: ["site","stream"] |
| `updated_at` | string |  | Updated at |
| `value` | object |  | Default fields (a subset of the top-level fields of the site/stream contract). |
