---
title: "Set Policy Agents Route"
method: PUT
path: "/api/v1/policies/{policy_id}/agents"
tags: ["policies"]
---

# Set Policy Agents Route

`PUT /api/v1/policies/{policy_id}/agents`

## Request

- Base URL: `https://cp.xenovia.io` (the document declares no server; this is the origin it was published from)
- URL: `https://cp.xenovia.io/api/v1/policies/{policy_id}/agents`
- Auth: none declared
- TypeScript: <https://skmtc.dev/xenovia/apis/controlplane/docs/api/v1/policies/:policy_id/agents/put.ts> (a function with typed inputs; its response is checked against the schema)

Replace the agents the policy covers; each one added or removed gets a
new config version.

## Path parameters

- `policy_id` string, uuid, required

## Headers

- `Authorization` string, nullable
- `X-Request-ID` string, nullable

## Request body

- PolicyAgentsSet: PUT /policies/{id}/agents: the whole set of agents the policy covers.
  - `agent_ids` string[], required

## Response `200`

Successful Response

- PolicyRead
  - `id` string, uuid, required
  - `agent_ids` string[]
  - `agents` PolicyAgentRef[]
    - `id` string, uuid, required
    - `name` string, required
    - `provider` string, nullable
    - `coding_tool` string, nullable
  - `agent_modes` object
  - `org_id` string, uuid, required
  - `owner_id` string, uuid, nullable, required
  - `name` string, required
  - `category` string, required
  - `summary` string, required
  - `rego` string, required
  - `enabled` boolean, required
  - `stage` string, required
  - `enforcement_mode` string
  - `template_id` string, nullable
  - `template_version` integer, nullable
  - `framework_tags` string[], nullable
  - `control_mappings` ControlMapping[], nullable
    - `framework` string, required
    - `controls` string[], required
    - `rationale` string
  - `parameter_values` object, nullable
  - `version` integer
  - `baseline_target` object, nullable
  - `conformance_cases` ConformanceCase[], nullable
    - `name` string, required
    - `stage` 'request' | 'response', nullable
    - `parameters` object
    - `input` object, required
    - `expect` ConformanceExpectation, required
      - `action` string, required
      - `rule` string, nullable
  - `conformance` ConformanceResult: The last run of a policy's cases: what an auditor reads next to the control the policy is evidence for.
    - `ran_at` string, date-time, required
    - `opa_version` string, nullable, required
    - `source` 'template' | 'policy', required
    - `passed` integer, required
    - `failed` integer, required
    - `cases` ConformanceCaseResult[], required
      - `name` string, required
      - `stage` 'request' | 'response', required
      - `expected_action` string, required
      - `expected_rule` string, nullable
      - `got_action` string, required
      - `got_rule` string, nullable
      - `ok` boolean, required
      - `error` string, nullable
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `warnings` string[], required
  - `group` string, required
  - `template_controls_outdated` boolean, required

## Other responses

- `422`: Validation Error

## Changes

- **2026-11-06** `19f8b5adbd7f`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/xenovia/apis/controlplane/changes/api/v1/policies/:policy_id/agents/put.md)

---

[API](https://skmtc.dev/xenovia/apis/controlplane.md) - [All operations](https://skmtc.dev/xenovia/apis/controlplane/llms.txt) - [OpenAPI document](https://skmtc.dev/xenovia/apis/controlplane/revisions/19f8b5adbd7f?raw)
