# Infrastructure API

## GET /api/v1/admin/queues

`GET /api/v1/admin/queues` · operation `listDurableQueues`

Durable queues (T056, flag durable_queues). Each registered queue with its boot profile (durable_queues block, restart to change) and its counts - ready (due now), delayed (waiting out a retry backoff), leased (held by a worker), dead_letters and done (kept for completed_retention_hours without payload). Queues: log_delivery, alert_delivery and fx_refresh (T168). workload_ready is false while the workload behind a queue is off (log_delivery waits for log_destinations, alert_delivery for alert_channels, fx_refresh for fx_display); its jobs then wait without spending attempts. Console permission queues:read (admin, viewer, operator).

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Queues | `application/json`: object |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `503` | storage_unavailable | — |

Response `200` fields:

- `application/json`: object
  - `poll_interval_ms` (integer, required)
  - `data` (array of [DurableQueue](/docs/api/schemas/d/#durablequeue), required)


## GET /api/v1/admin/queues/{queue}/dead-letters

`GET /api/v1/admin/queues/{queue}/dead-letters` · operation `listQueueDeadLetters`

Dead letters of one queue, newest first, metadata only (never the payload): attempts, last_error_class, payload size and SHA-256, timestamps, reprocess count. Console permission queues:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `queue` | path | string, required, pattern `^[a-z][a-z0-9_]{0,47}$` | Registered queue name (log_delivery, alert_delivery or fx_refresh) |
| `error_class` | query | string, pattern `^[a-z][a-z0-9_]{0,63}$` |  |
| `limit` | query | integer, default `50`, min 1, max 200 |  |
| `cursor` | query | string, max length 512 |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | One page of dead letters | `application/json`: object |
| `400` | invalid_filter or invalid_cursor | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | feature_disabled, or not_found for an unknown queue | — |
| `503` | storage_unavailable | — |

Response `200` fields:

- `application/json`: object
  - `data` (array of [QueueJob](/docs/api/schemas/q/#queuejob), required)
  - `next_cursor` (string)


## GET /api/v1/admin/queues/{queue}/dead-letters/{id}

`GET /api/v1/admin/queues/{queue}/dead-letters/{id}` · operation `inspectQueueDeadLetter`

Inspects one dead letter with the first 4096 bytes of its payload (payload_preview; payload_binary when it is not UTF-8 text, payload_truncated when longer). The inspection is audited (queue.dead_letter.inspect). Console permission queues:manage (admin, operator).

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `queue` | path | string, required, pattern `^[a-z][a-z0-9_]{0,47}$` | Registered queue name (log_delivery, alert_delivery or fx_refresh) |
| `id` | path | string, required, pattern `^qj_[0-9a-f]{32}$` |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Dead letter with a bounded preview | `application/json`: [QueueJobPreview](/docs/api/schemas/q/#queuejobpreview) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | feature_disabled, or not_found | — |
| `503` | storage_unavailable | — |


## DELETE /api/v1/admin/queues/{queue}/dead-letters/{id}

`DELETE /api/v1/admin/queues/{queue}/dead-letters/{id}` · operation `purgeQueueDeadLetter`

Deletes one dead letter for good, with an audit row (queue.dead_letter.purge) in the same statement. Console permission queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
| `queue` | path | string, required, pattern `^[a-z][a-z0-9_]{0,47}$` | Registered queue name (log_delivery, alert_delivery or fx_refresh) |
| `id` | path | string, required, pattern `^qj_[0-9a-f]{32}$` |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Purged | `application/json`: [DeadLetterActionResult](/docs/api/schemas/d/#deadletteractionresult) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | feature_disabled, or not_found when it is not a dead letter of this queue | — |
| `503` | storage_unavailable | — |


## POST /api/v1/admin/queues/{queue}/dead-letters/{id}/reprocess

`POST /api/v1/admin/queues/{queue}/dead-letters/{id}/reprocess` · operation `reprocessQueueDeadLetter`

Returns one dead letter to its queue with a fresh attempt budget, due at once, with an audit row (queue.dead_letter.reprocess) in the same statement. The body is ignored. Console permission queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
| `queue` | path | string, required, pattern `^[a-z][a-z0-9_]{0,47}$` | Registered queue name (log_delivery, alert_delivery or fx_refresh) |
| `id` | path | string, required, pattern `^qj_[0-9a-f]{32}$` |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Reprocessed | `application/json`: [DeadLetterActionResult](/docs/api/schemas/d/#deadletteractionresult) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | feature_disabled, or not_found when it is not a dead letter of this queue | — |
| `503` | storage_unavailable | — |


## POST /api/v1/admin/queues/{queue}/dead-letters/reprocess

`POST /api/v1/admin/queues/{queue}/dead-letters/reprocess` · operation `reprocessQueueDeadLetters`

Bulk reprocess: explicit ids (at most 500), or all dead letters of the queue (optionally of one error_class), at most limit (1-500, default 500) per call, oldest first. One audit row per job. IDs that are no longer dead letters are skipped; the response lists the jobs moved. Console permission queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
| `queue` | path | string, required, pattern `^[a-z][a-z0-9_]{0,47}$` | Registered queue name (log_delivery, alert_delivery or fx_refresh) |

**Request body** (required)

- `application/json`: [DeadLetterSelection](/docs/api/schemas/d/#deadletterselection)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Reprocessed | `application/json`: [DeadLetterActionResult](/docs/api/schemas/d/#deadletteractionresult) |
| `400` | invalid_request or invalid_selection | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | feature_disabled, or not_found for an unknown queue | — |
| `503` | storage_unavailable | — |


## POST /api/v1/admin/queues/{queue}/dead-letters/purge

`POST /api/v1/admin/queues/{queue}/dead-letters/purge` · operation `purgeQueueDeadLetters`

Bulk purge with the same selection as bulk reprocess; all: true also needs confirm: true (400 confirmation_required). Deletion is permanent; one audit row per job. Console permission queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
| `queue` | path | string, required, pattern `^[a-z][a-z0-9_]{0,47}$` | Registered queue name (log_delivery, alert_delivery or fx_refresh) |

**Request body** (required)

- `application/json`: [DeadLetterSelection](/docs/api/schemas/d/#deadletterselection)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Purged | `application/json`: [DeadLetterActionResult](/docs/api/schemas/d/#deadletteractionresult) |
| `400` | invalid_request, invalid_selection or confirmation_required | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | feature_disabled, or not_found for an unknown queue | — |
| `503` | storage_unavailable | — |


## GET /api/v1/admin/cache-backend

`GET /api/v1/admin/cache-backend` · operation `getCacheBackend`

Global admin reads the effective response cache backend (YAML base or console override), the YAML base and the state applied on this replica. Requires cache_backend_management. Redis credentials are never returned; only scheme, host and port. Cache-Control private, no-store.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | version, source, effective, base, process and note; optional safe settings under boot_settings_view | `application/json`: [CacheBackendEnvelope](/docs/api/schemas/c/#cachebackendenvelope) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled | `application/json`: [Error](/docs/api/schemas/e/#error) |


## PUT /api/v1/admin/cache-backend

`PUT /api/v1/admin/cache-backend` · operation `setCacheBackend`

Global admin switches the response cache to memory, Redis/Valkey or Memcached at runtime. The receiving replica builds the client and runs the connectivity, read, write and CAS check before anything is persisted; failure returns 422. The connection URL (url) is encrypted with the control-plane key; omit url to keep the stored one. A content key is generated server-side and preserved across edits unless rotate_content_key is true. Every replica applies the change on its next control sync and keeps its previous connection if its own check fails. Whole-snapshot validation applies, so distributed_exact_cache cannot stay enabled over memory.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `version` (integer (int64), required, min 0) — Configuration version from GET /api/v1/admin/cache-backend
  - `backend` (string, required, one of `"memory"`, `"redis"`, `"memcached"`)
  - `namespace` (string, pattern `^[a-zA-Z][a-zA-Z0-9_-]{0,47}$`)
  - `addresses` (array of string, min items 1, max items 8) — Memcached host:port list
  - `timeout` (string) — 10ms..2s
  - `max_entries` (integer, min 0, max 256) — 0 selects the existing default 256; applies to memory and remote
  - `max_bytes` (`0` or any) — 0 selects 33554432; memory may bypass responses larger than the byte budget
    - Any of (1): `0`
    - Any of (2): any
  - `max_response_bytes` (`0` or any) — 0 selects 65536; applies to memory and remote
    - Any of (1): `0`
    - Any of (2): any
  - `max_concurrency` (integer, min 0, max 64) — 0 selects 16; remote operation control
  - `allow_insecure` (boolean)
  - `tls_enabled` (boolean)
  - `tls_server_name` (string)
  - `tls_ca_pem` (string, max length 65536) — PEM certificates only
  - `url` (string, write-only) — Connection URL of the redis backend (redis:// or rediss:// with explicit host and port); write-only. Named redis_url before T179, which is now refused naming url
  - `rotate_content_key` (boolean)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Saved and applied on this replica; same shape as GET | `application/json`: [CacheBackendEnvelope](/docs/api/schemas/c/#cachebackendenvelope) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `409` | Stale configuration version | — |
| `422` | Cache service failed the connectivity/read/write/CAS check; nothing was saved | — |


## DELETE /api/v1/admin/cache-backend

`DELETE /api/v1/admin/cache-backend` · operation `revertCacheBackend`

Remove the console override and return to the YAML base, after whole-snapshot validation.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `version` (integer (int64), required, min 0)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Reverted; same shape as GET | `application/json`: [CacheBackendEnvelope](/docs/api/schemas/c/#cachebackendenvelope) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | No override or feature disabled | — |
| `409` | Stale configuration version | — |


## GET /api/v1/admin/cost-adjustments

`GET /api/v1/admin/cost-adjustments` · operation `getCostAdjustments`

Requires cost_adjustments and prices:read. Returns the effective provider discounts and margins (ADR 0146), their source (default when omitted/null, yaml when declared even if empty, or console for a versioned override) and the YAML base. Fractions, 0.05 is 5%.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Versioned adjustments | `application/json`: [CostAdjustmentsView](/docs/api/schemas/c/#costadjustmentsview) |
| `400` | Invalid bounded request | — |
| `401` | Authentication required | — |
| `403` | Role or resource forbidden | — |
| `404` | Feature disabled or resource unavailable | — |
| `409` | Version or trust conflict | — |
| `422` | The adjustments fail whole-configuration validation | — |
| `503` | Storage, trust or operation temporarily unavailable | — |


## PUT /api/v1/admin/cost-adjustments

`PUT /api/v1/admin/cost-adjustments` · operation `replaceCostAdjustments`

Requires prices:manage, same-origin session and CSRF. Replaces the whole cost_adjustments block with a versioned, audited PostgreSQL override after whole-configuration validation (keys are global or a provider ID; discounts 0 to below 1; margin percent and fixed_usd 0 to 10). Events valued before keep the adjustments captured in their rate snapshot.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)
  - `cost_adjustments` ([CostAdjustments](/docs/api/schemas/c/#costadjustments), required)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Configuration committed | — |
| `400` | Invalid bounded request | — |
| `401` | Authentication required | — |
| `403` | Role or resource forbidden | — |
| `404` | Feature disabled or resource unavailable | — |
| `409` | Version or trust conflict | — |
| `422` | The adjustments fail whole-configuration validation | — |
| `503` | Storage, trust or operation temporarily unavailable | — |


## DELETE /api/v1/admin/cost-adjustments

`DELETE /api/v1/admin/cost-adjustments` · operation `revertCostAdjustments`

Requires prices:manage, same-origin session and CSRF. Removes the override and restores the YAML block; 404 when none exists.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Configuration committed | — |
| `400` | Invalid bounded request | — |
| `401` | Authentication required | — |
| `403` | Role or resource forbidden | — |
| `404` | Feature disabled or resource unavailable | — |
| `409` | Version or trust conflict | — |
| `422` | The adjustments fail whole-configuration validation | — |
| `503` | Storage, trust or operation temporarily unavailable | — |


## GET /api/v1/admin/resiliency

`GET /api/v1/admin/resiliency` · operation `getResiliencyPolicy`

Requires resilience_management and resilience:read. Returns effective shared configuration and source; default/V1 observations remain process-local; explicitV2 distinguishes optional PostgreSQL shared state and checks.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `version` | query | integer, one of `1`, `2`, default `1` | Explicit2 selects health/shared-state view; default1 preserves the historical projection. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Versioned policy | `application/json`: [ResiliencyPolicyView](/docs/api/schemas/r/#resiliencypolicyview) and any or [ResiliencyPolicyViewV2](/docs/api/schemas/r/#resiliencypolicyviewv2) |
| `400` | Invalid bounded request | — |
| `401` | Authentication required | — |
| `403` | Role or resource forbidden | — |
| `404` | Feature disabled or resource unavailable | — |
| `409` | Version or trust conflict | — |
| `503` | Storage, trust or operation temporarily unavailable | — |

Response `200` fields:

- `application/json`: [ResiliencyPolicyView](/docs/api/schemas/r/#resiliencypolicyview) and any or [ResiliencyPolicyViewV2](/docs/api/schemas/r/#resiliencypolicyviewv2)
  - One of (1): [ResiliencyPolicyView](/docs/api/schemas/r/#resiliencypolicyview) and any
    - All of (1): [ResiliencyPolicyView](/docs/api/schemas/r/#resiliencypolicyview)
    - All of (2): any
  - One of (2): [ResiliencyPolicyViewV2](/docs/api/schemas/r/#resiliencypolicyviewv2)


## PUT /api/v1/admin/resiliency

`PUT /api/v1/admin/resiliency` · operation `replaceResiliencyPolicy`

Requires resilience:manage, same-origin session and CSRF. Whole snapshot validation, global optimistic version and transactional audit. DELETE restores YAML. New policy resets local observations when applied; no replay or extra retry is introduced.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)
  - `resiliency` ([ResiliencyPolicyV2](/docs/api/schemas/r/#resiliencypolicyv2), required)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Configuration committed | — |
| `400` | Invalid bounded request | — |
| `401` | Authentication required | — |
| `403` | Role or resource forbidden | — |
| `404` | Feature disabled or resource unavailable | — |
| `409` | Version or trust conflict | — |
| `503` | Storage, trust or operation temporarily unavailable | — |


## DELETE /api/v1/admin/resiliency

`DELETE /api/v1/admin/resiliency` · operation `revertResiliencyPolicy`

Requires resilience:manage, same-origin session and CSRF. Whole snapshot validation, global optimistic version and transactional audit. DELETE restores YAML. New policy resets local observations when applied; no replay or extra retry is introduced.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Configuration committed | — |
| `400` | Invalid bounded request | — |
| `401` | Authentication required | — |
| `403` | Role or resource forbidden | — |
| `404` | Feature disabled or resource unavailable | — |
| `409` | Version or trust conflict | — |
| `503` | Storage, trust or operation temporarily unavailable | — |


## GET /api/v1/admin/boot-settings

`GET /api/v1/admin/boot-settings` · operation `getBootSettings`

Requires boot_settings_management and boot_settings:read (global admin/viewer). Desired and applied HTTP settings are process-local observations; compare process_instance_id across replicas. Pending compares values and ownership sources. Environment selection captured at boot overrides the read policy. Legacy HTTP catalog rows use paired null for console sources; this dedicated DTO is authoritative. An unowned factory returns paired null desired/applied/source/pending fields.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `parameter_catalog_version` | query | integer, one of `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`, `19`, `20`, `21`, `22`, `23`, `24`, `25`, `26`, `27`, default `1` | Optional; 25 or later adds listen_backlog to desired, applied and both source objects. Omitted or earlier keeps the three-duration members. Any value /config accepts is accepted; an unsupported or repeated value is 400. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Desired policy and immutable applied HTTP settings | `application/json`: [HTTPBootSettingsSnapshot](/docs/api/schemas/h/#httpbootsettingssnapshot) |
| `400` | Unsupported or repeated parameter_catalog_version | — |
| `401` | Authentication required | — |
| `403` | Global read permission required | — |
| `404` | Management flag disabled | — |
| `503` | Storage or configuration refresh unavailable | — |


## PUT /api/v1/admin/boot-settings

`PUT /api/v1/admin/boot-settings` · operation `replaceBootSettings`

Requires global admin boot_settings:manage, flag and same-origin CSRF. Strict canonical policy of the three durations plus an optional listen_backlog, 4096-byte body. Empty strings and backlog 0 or omission choose compiled defaults, not YAML inheritance; zero durations are invalid. Validates complete prospective configuration before global CAS and actor/request audit. Never modifies this process listener. A real process restart consumes the persisted flag and policy before constructing HTTP options. Environment is captured once and not re-read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)
  - `server` ([HTTPBootPolicy](/docs/api/schemas/h/#httpbootpolicy), required)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Desired policy committed; applied HTTP settings unchanged | — |
| `400` | Invalid canonical policy or complete configuration | — |
| `401` | Authentication required | — |
| `403` | Administrator or CSRF required | — |
| `404` | Management flag disabled | — |
| `409` | Configuration version conflict | — |
| `413` | Request body too large | — |
| `503` | No owned HTTP capture, storage unavailable or committed configuration synchronization pending | — |


## DELETE /api/v1/admin/boot-settings

`DELETE /api/v1/admin/boot-settings` · operation `revertBootSettings`

Exact version-only body removes the override, restoring YAML/default desired settings while retaining captured environment precedence. Applied listener settings remain unchanged until an actual restart. Requires global administrator boot_settings:manage, flag and CSRF.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Override removed; actual listener remains unchanged | — |
| `400` | Invalid canonical version-only payload | — |
| `401` | Authentication required | — |
| `403` | Administrator or CSRF required | — |
| `404` | Flag disabled or override missing | — |
| `409` | Configuration version conflict | — |
| `413` | Request body too large | — |
| `503` | Capture, storage or synchronization unavailable | — |


## GET /api/v1/admin/log-destination-policy

`GET /api/v1/admin/log-destination-policy` · operation `getLogDestinationPolicy`

Requires log_destination_management and destinations:read (global admin/viewer). Returns only nonsecret template identifiers, sanitized targets and mutable tuning. Template type, network trust and environment/cloud credential bindings remain YAML-owned and require rollout. Saved overrides replace the whole list, including an empty list. Runtime policy is separate from immutable startup inspection and per-worker status counters.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Versioned template-based metadata delivery policy | `application/json`: [LogDestinationPolicySnapshot](/docs/api/schemas/l/#logdestinationpolicysnapshot) |
| `401` | Authentication required | — |
| `403` | Global destination read permission required | — |
| `404` | Destination management disabled | — |
| `503` | Configuration storage or refresh unavailable | — |


## PUT /api/v1/admin/log-destination-policy

`PUT /api/v1/admin/log-destination-policy` · operation `replaceLogDestinationPolicy`

Global admin destinations:manage, operational flag and same-origin CSRF required. Exact canonical full-list replacement from operator-declared templates, at most ten rows; zero batching values choose existing defaults. No raw credentials, new environment references, endpoint, profile, type or cloud identity may be supplied. Validates complete snapshot before global CAS and actor/request audit. Workers follow the newest completion-time configuration; old queued records may drain to their original sink. Repeated changes cancel superseded older generations and can drop records; delivery is bounded best effort, never lossless. No global control lock is held during worker retirement. Body limit 1048576 bytes.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)
  - `destinations` (array of [LogDestinationBinding](/docs/api/schemas/l/#logdestinationbinding), required, max items 10)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Policy committed and responding replica refreshed | — |
| `400` | Invalid canonical template declaration or tuning | — |
| `401` | Authentication required | — |
| `403` | Admin permission or CSRF required | — |
| `404` | Management flag disabled | — |
| `409` | Configuration version conflict | — |
| `413` | Request body too large | — |
| `503` | Storage or synchronization unavailable; configuration_sync_pending means the write committed | — |


## DELETE /api/v1/admin/log-destination-policy

`DELETE /api/v1/admin/log-destination-policy` · operation `revertLogDestinationPolicy`

Exact version-only canonical body removes an existing override and restores YAML declarations. Management flag off also restores the local baseline while keeping the override dormant. Does not change immutable template trust or promise lossless queue transfer.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Override removed and YAML declarations restored | — |
| `400` | Invalid canonical payload | — |
| `401` | Authentication required | — |
| `403` | Administrator or CSRF required | — |
| `404` | Feature disabled or no override exists | — |
| `409` | Configuration version conflict | — |
| `413` | Request body too large | — |
| `503` | Storage or synchronization unavailable | — |


## GET /api/v1/admin/realtime-policy

`GET /api/v1/admin/realtime-policy` · operation `getRealtimePolicy`

Requires realtime_management and realtime:read (global admin/viewer). Returns the complete nonsecret new-session policy and its sources; per-key IDs are visible only through this global permission. Startup realtime_settings stays immutable and exposes only the key-count. The request captures its policy before admission, so an already-started handshake and active session retain it. No atomic cluster cutover is promised.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Versioned Realtime policy for new requests after replica refresh | `application/json`: [RealtimePolicySnapshot](/docs/api/schemas/r/#realtimepolicysnapshot) |
| `401` | Authentication required | — |
| `403` | Global Realtime read permission required | — |
| `404` | Realtime management disabled | — |
| `503` | Storage or configuration refresh unavailable | — |


## PUT /api/v1/admin/realtime-policy

`PUT /api/v1/admin/realtime-policy` · operation `replaceRealtimePolicy`

Requires realtime_management, administrator realtime:manage and same-origin CSRF. Complete replacement of all four canonical fields, never a merge; zero/empty scalars select existing compiled defaults, an empty map clears per-key overrides. Validate the full candidate, commit under global CAS with actor/request audit, then refresh the responding replica. Active sessions retain their captured lease limit, duration and fallback reservation estimate. The output-token setting sizes a quota reservation; it does not cap provider generation. Body limit 1048576 bytes.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)
  - `realtime` ([RealtimePolicy](/docs/api/schemas/r/#realtimepolicy), required)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Override committed and responding replica refreshed | — |
| `400` | Invalid bounded or noncanonical policy | — |
| `401` | Authentication required | — |
| `403` | Administrator or CSRF required | — |
| `404` | Realtime management disabled | — |
| `409` | Configuration version conflict | — |
| `413` | Request body too large | — |
| `503` | Storage or synchronization unavailable; configuration_sync_pending means the write committed | — |


## DELETE /api/v1/admin/realtime-policy

`DELETE /api/v1/admin/realtime-policy` · operation `revertRealtimePolicy`

Administrator realtime:manage and same-origin CSRF required. Exact version-only body removes an existing override; new requests return to YAML/default policy after refresh. Flag off restores the baseline while retaining a dormant override. Existing sessions and leases are not changed or terminated.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Override removed and baseline restored for new requests | — |
| `400` | Invalid canonical payload | — |
| `401` | Authentication required | — |
| `403` | Administrator or CSRF required | — |
| `404` | Feature disabled or no override exists | — |
| `409` | Configuration version conflict | — |
| `413` | Request body too large | — |
| `503` | Storage or synchronization unavailable | — |


## GET /api/v1/admin/logging

`GET /api/v1/admin/logging` · operation `getRuntimeLogging`

Requires logging_management and logging:read (global administrator or viewer). Separates effective policy from the actually owned runtime controller. Paired null applied values mean unavailable; immutable logging_settings remains the startup observation. No payloads, credentials or destinations are returned.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Versioned runtime logging policy and application state | `application/json`: [RuntimeLoggingSnapshot](/docs/api/schemas/r/#runtimeloggingsnapshot) |
| `401` | Authentication required | — |
| `403` | Global logging read permission required | — |
| `404` | Logging management disabled | — |
| `503` | Storage or configuration refresh unavailable | — |


## PUT /api/v1/admin/logging

`PUT /api/v1/admin/logging` · operation `replaceRuntimeLogging`

Requires logging_management, logging:manage (administrator only), same-origin session and CSRF. Strict canonical JSON, complete candidate validation, global version CAS and atomic audit. Each replica applies the minimum through its owned handler/controller after control refresh; existing requests use the current minimum per record. Does not enable debug, payload logging or new destinations.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)
  - `level` (string, required, one of `"info"`, `"warn"`, `"error"`)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Override committed and applied on the responding replica | — |
| `400` | Invalid bounded or noncanonical logging payload | — |
| `401` | Authentication required | — |
| `403` | Administrator or CSRF required | — |
| `404` | Logging management disabled | — |
| `409` | Configuration version conflict | — |
| `503` | Storage, owned logging controller or synchronization unavailable; configuration_sync_pending means the write committed | — |


## DELETE /api/v1/admin/logging

`DELETE /api/v1/admin/logging` · operation `revertRuntimeLogging`

Administrator logging:manage, same-origin session and CSRF required. Accepts version only and reverts an existing override to the local YAML/default minimum. A missing owned controller refuses the mutation. Disabling logging_management restores the baseline but retains a dormant saved override for later re-enable.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Existing override removed and YAML/default applied | — |
| `400` | Invalid bounded or noncanonical payload | — |
| `401` | Authentication required | — |
| `403` | Administrator or CSRF required | — |
| `404` | Feature disabled or no override exists | — |
| `409` | Configuration version conflict | — |
| `503` | Storage, owned logging controller or synchronization unavailable | — |


## GET /api/v1/admin/stream-timeouts

`GET /api/v1/admin/stream-timeouts` · operation `getStreamTimeouts`

Requires stream_timeout_management and resilience:read. The effective network stream clocks, each with its source (console, yaml or default), and the console override if any.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Versioned stream clocks | `application/json`: object |
| `400` | Invalid bounded request | — |
| `401` | Authentication required | — |
| `403` | Role or resource forbidden | — |
| `404` | Feature disabled or resource unavailable | — |
| `409` | Version or trust conflict | — |
| `503` | Storage, trust or operation temporarily unavailable | — |

Response `200` fields:

- `application/json`: object
  - `version` (integer, required, min 0)
  - `effective` (object, required)
    - `first_byte` (string, required)
    - `idle` (string, required)
    - `max_duration` (string, required)
    - `write_stall` (string, required)
  - `sources` (object, required)
    - `first_byte` (string, required, one of `"console"`, `"yaml"`, `"default"`)
    - `idle` (string, required, one of `"console"`, `"yaml"`, `"default"`)
    - `max_duration` (string, required, one of `"console"`, `"yaml"`, `"default"`)
    - `write_stall` (string, required, one of `"console"`, `"yaml"`, `"default"`)
  - `defaults` (object) — Optional only under boot_settings_view. Existing fixed clock defaults, duration-equivalent to 60s/120s/30m/60s; runtime/model overrides and existing streams remain separate. Not accepted in PUT.
    - `first_byte` (string, required)
    - `idle` (string, required)
    - `max_duration` (string, required)
    - `write_stall` (string, required)
  - `override` (null or [StreamTimeoutsOverride](/docs/api/schemas/s/#streamtimeoutsoverride), required)
    - One of (1): null
    - One of (2): [StreamTimeoutsOverride](/docs/api/schemas/s/#streamtimeoutsoverride)


## PUT /api/v1/admin/stream-timeouts

`PUT /api/v1/admin/stream-timeouts` · operation `replaceStreamTimeouts`

Requires resilience:manage, same-origin session and CSRF. Whole snapshot validation, global optimistic version and transactional audit. Applies to streams that start after the change; open streams keep the clocks they started with. DELETE restores YAML.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)
  - `stream_timeouts` ([StreamTimeoutsOverride](/docs/api/schemas/s/#streamtimeoutsoverride), required)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Configuration committed | — |
| `400` | Invalid bounded request | — |
| `401` | Authentication required | — |
| `403` | Role or resource forbidden | — |
| `404` | Feature disabled or resource unavailable | — |
| `409` | Version or trust conflict | — |
| `503` | Storage, trust or operation temporarily unavailable | — |


## DELETE /api/v1/admin/stream-timeouts

`DELETE /api/v1/admin/stream-timeouts` · operation `revertStreamTimeouts`

Requires resilience:manage, same-origin session and CSRF. Removes the console override; every clock returns to the YAML for streams that start afterwards.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Configuration committed | — |
| `400` | Invalid bounded request | — |
| `401` | Authentication required | — |
| `403` | Role or resource forbidden | — |
| `404` | Feature disabled or resource unavailable | — |
| `409` | Version or trust conflict | — |
| `503` | Storage, trust or operation temporarily unavailable | — |


## GET /api/v1/admin/license

`GET /api/v1/admin/license` · operation `getEnterpriseLicense`

Global administrator with entitlements:manage; requires enterprise_license and license_management. Safe metadata only, never the activation token. Offline verification does not grant operational flags, roles or plan rights.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Safe versioned license status | `application/json`: [EnterpriseLicenseSnapshot](/docs/api/schemas/e/#enterpriselicensesnapshot) |
| `401` | Authentication required | — |
| `403` | Global administrator required | — |
| `404` | Feature disabled | — |
| `503` | Configuration storage unavailable | — |


## PUT /api/v1/admin/license

`PUT /api/v1/admin/license` · operation `activateEnterpriseLicense`

Requires global administrator, same-origin session, CSRF, current version and active license management. Verifies the signature and current activation period before encrypted, versioned, audited persistence. A temp- trial requires enterprise_trial and atomically retains first activation in PostgreSQL; replay never extends its fourteen-day period. No token is returned. Existing traffic keeps its authentication and quota controls on expiry.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)
  - `key` (string, required, min length 1, max length 8192, write-only)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | License activation saved | `application/json`: [EnterpriseLicenseSnapshot](/docs/api/schemas/e/#enterpriselicensesnapshot) |
| `400` | Invalid canonical input | — |
| `401` | Authentication required | — |
| `403` | Role or CSRF denied | — |
| `404` | Feature disabled | — |
| `409` | Configuration version changed | — |
| `422` | Invalid signature or activation period | — |
| `503` | Configuration or encryption unavailable | — |


## DELETE /api/v1/admin/license

`DELETE /api/v1/admin/license` · operation `restoreYAMLEnterpriseLicense`

Versioned, CSRF-protected global-administrator action removing the encrypted override and restoring YAML; never deletes trial activation history or changes inference authorization.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 0)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | YAML license restored | `application/json`: [EnterpriseLicenseSnapshot](/docs/api/schemas/e/#enterpriselicensesnapshot) |
| `400` | Invalid canonical input | — |
| `401` | Authentication required | — |
| `403` | Role or CSRF denied | — |
| `404` | No override or feature disabled | — |
| `409` | Configuration version changed | — |
| `503` | Configuration unavailable | — |

