> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memanto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Apply Policy Preset

> Adopt a predefined policy bundle as the agent's policy.

## Overview

Adopts a shipped preset as the agent's expiry policy, replacing whatever was
there. Nothing expires until a sweep runs.

<Warning>
  This **replaces the entire policy**, including any rules written by hand. Preview
  the preset first with
  [Get Policy Preset](/api-reference/policy/get-policy-preset).
</Warning>

## Authentication

API clients do not send an API key or `Authorization` header.

<ParamField header="X-Session-Token" type="string" required>
  Session token from [Activate Agent](/api-reference/sessions/activate-agent). Must match `agent_id`.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be `application/json`
</ParamField>

## Path Parameters

<ParamField path="agent_id" type="string" required>
  The unique identifier of the agent.
</ParamField>

## Body

<ParamField body="name" type="string" required>
  Preset name: `conservative`, `balanced`, or `aggressive`.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "http://localhost:8000/api/v2/agents/my-agent/policy/preset" \
    -H "X-Session-Token: your_session_token" \
    -H "Content-Type: application/json" \
    -d '{"name": "balanced"}'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - OK theme={null}
  {
    "agent_id": "my-agent",
    "preset": "balanced",
    "policy": {
      "version": 1,
      "retention": { "context": "7d", "event": "30d", "error": "30d" },
      "rules": [
        { "name": "pinned", "match": { "tags": ["pinned"] }, "expire_after": "never" }
      ],
      "purge_expired_after": "never"
    }
  }
  ```

  ```json 400 - Bad Request theme={null}
  {
    "detail": "Unknown preset 'nope'. Must be one of: aggressive, balanced, conservative."
  }
  ```

  ```json 401 - Unauthorized (Missing Token) theme={null}
  {
    "detail": "Missing session token. Use X-Session-Token header."
  }
  ```
</ResponseExample>

## Next Steps

* [Apply Expiry Policy](/api-reference/policy/apply-policy) to run the sweep
* [Get Expiry Policy](/api-reference/policy/get-policy) to read it back
