Archive a Policy
DELETE /v1/policies/{policy_id}
| Property | Value |
|---|---|
| Operation | archive_policy |
| Group | Policies |
| Scope | policies:write |
| Route class | control |
| Idempotency | No Idempotency-Key |
| Audit | Audited policy.archive (mutation) |
| Released in | 1.47.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Archives the Policy at the revision If-Match names and answers it with archived_at set. Nothing is deleted: the versions Agent versions pin keep running, and the Policy can still be read. An archived organization-scoped Policy is no longer resolved at dispatch; an archived Policy is refused by a later write with policy_archived. A write to an organization-scoped Policy, or one that disables a compliance-tagged Policy, also needs policies:admin and is otherwise refused with forbidden and the detail policies_admin_required.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the policies:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -X DELETE "$VOCAL_API/v1/policies/pol_..." \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H 'If-Match: "1"'const response = await fetch(`${process.env.VOCAL_API}/v1/policies/pol_...`, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'If-Match': '"1"',
},
});
console.log(response.status, await response.text());import os
import requests
response = requests.delete(
f"{os.environ['VOCAL_API']}/v1/policies/pol_...",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"If-Match": '"1"',
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
policy_id | path | PolicyId | yes | The id of a Policy: pol_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
if-match | header | string | yes | The revision the change was made against, quoted as the ETag returns it, or * to overwrite. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | Policy | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden, org_suspended |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | policy_archived |
412 | application/json | ErrorEnvelope | revision_mismatch |
428 | application/json | ErrorEnvelope | precondition_required |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is Policy.
| Field | Type | Required | Description |
|---|---|---|---|
action_type | PolicyActionType | yes | The one action type the document may output; its legality at hook is checked at save. |
active_version | integer or null | yes | The version Agent version publish pins (agent scope) or dispatch resolves (organization scope), or null when none is active. |
analysis | PolicyAnalysis | yes | |
archived_at | Timestamp or null | yes | When DELETE archived the Policy, or null. An archived Policy takes no write, publish or activation (409 policy_archived); its pinned versions keep running. |
compliance_tag | ComplianceTag or null | yes | |
created_at | Timestamp | yes | |
description | string or null | yes | For reviewers; never sent to the model. |
enabled | boolean | yes | The kill switch, read at dispatch and effective from the next Call; not part of any version. |
hook | HookPoint | yes | |
id | PolicyId | yes | |
latest_version | integer or null | yes | The highest published version, or null before the first publish. |
logic | JdmDocument | yes | |
name | PolicyName | yes | |
object | "policy" | yes | |
organization_id | OrganizationId | yes | |
origin | PolicyOrigin | yes | |
priority | integer | yes | Lower runs first; ties go to organization scope, then to the id. |
revision | integer | yes | Counts writes to the draft; returned as the ETag and required in If-Match. |
scope | PolicyScope | yes | |
setting_path | SettingPath or null | yes | For a derived Policy, the setting it was compiled from; null when authored. |
updated_at | Timestamp | yes |