---
title: "Update enforcement settings"
method: PATCH
path: "/alignment/agent/{agent_id}/enforcement"
tags: ["Alignment"]
---

# Update enforcement settings

`PATCH /alignment/agent/{agent_id}/enforcement`

## Request

- Base URL: `https://api.mnemom.ai/v1`
- URL: `https://api.mnemom.ai/v1/alignment/agent/{agent_id}/enforcement`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-Mnemom-Api-Key`
  - API key in cookie `mnemom_session`

PATCH applies RFC 7396 JSON Merge Patch to the `enforcement` block (fine-grained tool-use policy (forbidden patterns, unmapped severity, grace window)). `null` deletes a key; missing keeps; present replaces. Arrays are replaced wholesale (not item-merged). Requires `Idempotency-Key` and `If-Match`.

## Path parameters

- `agent_id` string, required

## Headers

- `Idempotency-Key` string, required
- `If-Match` string, required

## Request body

- object
  - `allow_unmapped_tools` boolean
  - `default_unmapped_severity` 'low' | 'medium' | 'high' | 'critical'
  - `forbidden_tools` object[]
  - `grace_period_hours` number

## Response `200`

The `enforcement` primitive was updated at the agent scope.

- object
  - `ok` true, required
  - `scope` 'agent', required
  - `scope_id` string, required
  - `resource` 'alignment', required
  - `primitive` 'enforcement', required
  - `verb` 'put' | 'patch', required
  - `value` object, required
    - `allow_unmapped_tools` boolean
    - `default_unmapped_severity` 'low' | 'medium' | 'high' | 'critical'
    - `forbidden_tools` object[]
    - `grace_period_hours` number
  - `content_hash` string, required: New `sha256:<hex64>` of the spec at this scope after the write.
  - `version` integer
  - `field_provenance` object
  - `_warnings` object: Pre-existing structural issues outside the modified primitive. Present only when the existing spec carries unrelated validation problems; never blocks the write.

## Other responses

- `400`: Bad request
- `401`: Authentication required
- `403`: Forbidden
- `404`: Resource not found
- `409`: Resource conflict — the request cannot proceed because of a current state conflict (e.g., resource already exists, version mismatch, in-flight idempotency key with a different body).
- `412`: The `If-Match` header carried a stale ETag (the spec was updated since the caller read it). Run `GET` to fetch the current ETag, splice your changes onto the latest state, and retry the write. Cards-as-primitive Phase 4 W3.1.
- `413`: Request body exceeded the per-endpoint size cap. Cards-as-primitive sub-resource verbs cap each primitive body at 64 KiB; full-card PUTs cap at 128 KiB (alignment) / 64 KiB (protection).
- `422`: Request was well-formed but semantically invalid (e.g., business-rule validation failure, malformed YAML inside a JSON payload).
- `428`: The `If-Match` header is missing on a sub-resource write. Sub-resource verbs use optimistic concurrency — read the current ETag via `GET`, then retry with `If-Match: "sha256:..."`. Cards-as-primitive Phase 4 W3.1.
- `429`: Rate-limit exceeded. The global per-IP limiter (100 requests/minute, applied to every `/v1/*` route) rejected this request. Back off until the window resets — `Retry-After` carries the cooldown in seconds and `X-RateLimit-Reset` the absolute reset time.
- `500`: Server error — request was well-formed but the server failed to fulfill it. Typically a downstream dependency (DB / RPC / external API) returned an unexpected error.

---

[API](https://skmtc.dev/mnemom/apis/mnemom-api.md) · [All operations](https://skmtc.dev/mnemom/apis/mnemom-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mnemom/apis/mnemom-api/revisions/274b7a6ea182?raw)
