---
title: "Apply Policy"
method: POST
path: "/api/v2/agents/{agent_id}/policy/apply"
tags: ["Sessions & Agents", "Memory Operations"]
---

# Apply Policy

`POST /api/v2/agents/{agent_id}/policy/apply`

Sweep the agent's memories and expire everything the policy matches.

Pass ``dry_run: true`` to see exactly what would be expired, with per-rule
counts, without writing anything.

Requires:
- X-Session-Token: {session_token}

## Path parameters

- `agent_id` string, required

## Headers

- `x-session-token` string, nullable
- `X-Api-Key` string, nullable

## Cookies

- `memanto_session_token` string, nullable

## Request body

- PolicyApplyRequest — Request body for a policy sweep or purge.
  - `dry_run` boolean — Report what would change without writing anything

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/moorcheh-ai/apis/memanto-memory-that-ai-agents-love.md) · [All operations](https://skmtc.net/moorcheh-ai/apis/memanto-memory-that-ai-agents-love/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/moorcheh-ai/memanto-memory-that-ai-agents-love/revisions/f8fc41287ced/schema)
