# client.policies

> client.policies — the policies operations.

`client.policies` — the `policies` operations.

On `AsyncKindgi` every method is the same, awaited.

## `client.policies.list()`

```python signature
list(
    *,
    limit: int | None = None,
    cursor: str | None = None,
    kind: Literal['access-control', 'model-routing', 'adapter-allowlist', 'rate-limit', 'retention', 'compliance', 'tool-errors', 'hitl'] | None = None,
    name: str | None = None,
    timeout: float | None = None,
) -> PolicyCollectionPage
```

List tenant policies. `GET /v1/policies`

Cursor-paginated. Optional `?kind=` narrows to a single policy kind (exact match); optional `?name=` is a prefix match on `Policy.id`. Sort order: policy id ascending. Latest version per id.

## `client.policies.publish()`

```python signature
publish(
    body: PublishPolicyBody | Mapping[str, Any] | None = None,
    /,
    *,
    idempotency_key: str | None = None,
    timeout: float | None = None,
    **fields: Any,
) -> PublishPolicyResult
```

Publish a policy. `POST /v1/policies`

Body is a full `Policy` — the server validates top-level shape (id, tenantId, semver version, kind ∈ closed enum, spec is an object), and `spec` for `tool-errors`, `hitl` and `retention` (a retention policy with an unknown domain or `mode: archive` is refused with `400 validation-failed`, naming the field). Other kinds' specs are their runtime consumer's to validate. Re-publishing an existing `(policyId, version)` returns `409 policy-already-registered`. A tenant has one retention policy per domain, plus one for `*`: a second policy id for a covered domain is refused with `409 policy-scope-taken` (`details.heldBy` names the policy that covers it; publish a new version of that one instead), and a new version can't move a policy to another domain (`409 policy-scope-changed`). A known kind that no runtime consumer applies yet (`access-control`, `adapter-allowlist`, `rate-limit`, `compliance`) is refused with `400 kind-not-applied` (`details.appliedKinds` lists the ones that are): publishing it would change nothing. Idempotency-Key applies (retries with the same key replay the original 201).

## `client.policies.get()`

```python signature
get(policy_id: str | UUID, /, *, timeout: float | None = None) -> Policy
```

Fetch a policy (latest version). `GET /v1/policies/{policyId}`

## `client.policies.reinstate_version()`

```python signature
reinstate_version(
    policy_id: str | UUID,
    version: str,
    /,
    *,
    idempotency_key: str | None = None,
    timeout: float | None = None,
) -> ReinstatePolicyVersionResult
```

Reinstate a specific tombstoned policy version. `POST /v1/policies/{policyId}/versions/{version}/reinstate`

Un-tombstones a previously-unregistered version: clears the tombstone on that version and recomputes the latest active version (and refreshes `policyKind` to match). Restores manifest bytes verbatim (semver hygiene). Idempotent. Reactivates a fully-retired policy identity when applicable. Publish is always allowed regardless of retirement state.
