# POST /memory/purge

**Resource:** [Agent Memory](./memory.md)  
**MCP tool:** `purge_memory`  
**Scopes:** `memory:delete`  
**Write operation:** yes

Bulk-retract agent memories matching a filter, in one call. Soft-deletes by default (reversible, audit-preserving); pass hard:true to physically remove rows for PII / right-to-be-forgotten. This is the "forget everything about this contact / opportunity / company" primitive — filter by subject, agent, kind, tag, or linked entity. Refuses to run with no filter unless you set all:true. Requires the memory:delete scope.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `subject_type` | body | string | no | Purge memories about this subject type — e.g. "contact", "opportunity", "company", "self". |
| `subject_id` | body | string | no | Purge memories about this specific subject id (use with subject_type for "forget this contact"). |
| `agent_registry_id` | body | string | no | Purge memories owned by this agent. |
| `kind` | body | string | no | Purge memories of this kind. |
| `tag` | body | string | no | Purge memories carrying this tag. |
| `linked_entity_type` | body | string | no | Purge memories linked to an entity of this type (combine with linked_entity_id). |
| `linked_entity_id` | body | string | no | Purge memories linked to this entity id (combine with linked_entity_type). |
| `hard` | body | boolean | no | Default false (soft-delete). true physically removes the rows — irreversible. |
| `all` | body | boolean | no | Set true to purge EVERY memory in the workspace. Required when no filter is provided; ignored otherwise. |

## Request example

```bash
curl -X POST   "https://api.trustpager.com/functions/v1/api/v1/memory/purge"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"subject_type":"...","subject_id":"...","agent_registry_id":"..."}'
```

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`