> ## 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.

# Get Expiry Policy

> Return the agent's expiry policy.

## Overview

Returns the agent's expiry policy: the per-type retention table, the named rules,
and the purge window. An agent with no policy set returns an empty one, with
`is_empty` set to `true` — that policy expires nothing.

See the [Memory Lifecycle](/reference/memory-lifecycle) reference for how the two
halves interact.

## 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>

## Path Parameters

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

<RequestExample>
  ```bash cURL theme={null}
  curl "http://localhost:8000/api/v2/agents/my-agent/policy" \
    -H "X-Session-Token: your_session_token"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - OK theme={null}
  {
    "agent_id": "my-agent",
    "is_empty": false,
    "policy": {
      "version": 1,
      "retention": {
        "context": "7d",
        "event": "30d",
        "error": "30d",
        "observation": "60d",
        "commitment": "90d",
        "artifact": "180d"
      },
      "rules": [
        {
          "name": "pinned",
          "match": { "tags": ["pinned"] },
          "expire_after": "never"
        },
        {
          "name": "low-confidence-guesses",
          "match": { "provenance": ["inferred"], "confidence_below": 0.5 },
          "expire_after": "14d"
        }
      ],
      "purge_expired_after": "never"
    }
  }
  ```

  ```json 200 - OK (no policy set) theme={null}
  {
    "agent_id": "my-agent",
    "is_empty": true,
    "policy": {
      "version": 1,
      "retention": {},
      "rules": [],
      "purge_expired_after": "never"
    }
  }
  ```

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

## Notes

* Unset match conditions are omitted from the response rather than returned as `null`.
* Rules are returned in evaluation order: the first one that matches a memory wins and overrides the retention table.
* The policy is stored per agent at `~/.memanto/policies/<agent-id>.yaml`.

## Next Steps

* [Set Expiry Policy](/api-reference/policy/set-policy) to replace it
* [Apply Expiry Policy](/api-reference/policy/apply-policy) to run a sweep
