---
title: "Delete a memory node"
description: "Permanently delete an entity node and every fact connected to it.\n\nThe card-level \"forget this topic\" delete: the node, its fact edges in\nboth directions, and their search-overlay rows are removed from both\nstores. Episodic source content is not touched — per-record erasure\nstays a separate concern (``clear`` erases everything for the pair).\n\nScoping follows the fact delete: the calling user's id prefix, not\n``agent_id`` (kept for URL shape); ``graph_id`` targets a shared\nnamespace instead, service tokens only.\n\nResponses: 404 when the node isn't in the requested scope; 422\n``MEMORY_NODE_PROTECTED`` for structural nodes (the user's own User\nnode, Topic and Value taxonomy nodes), which are never deletable."
---

> Documentation Index
> Fetch the complete documentation index at: https://truememory-docs.mvstg.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: AI Gateway API › Memory

`DELETE /memories/{agent_id}/nodes/{node_id}`

Permanently delete an entity node and every fact connected to it.

The card-level "forget this topic" delete: the node, its fact edges in
both directions, and their search-overlay rows are removed from both
stores. Episodic source content is not touched — per-record erasure
stays a separate concern (``clear`` erases everything for the pair).

Scoping follows the fact delete: the calling user's id prefix, not
``agent_id`` (kept for URL shape); ``graph_id`` targets a shared
namespace instead, service tokens only.

Responses: 404 when the node isn't in the requested scope; 422
``MEMORY_NODE_PROTECTED`` for structural nodes (the user's own User
node, Topic and Value taxonomy nodes), which are never deletable.

## Authentication

- `HTTPBearer`, http, header `Authorization`

## Path parameters

- `agent_id` (`delete_node.path.agent_id`; string, required)
- `node_id` (`delete_node.path.node_id`; string, required)

## Query parameters

- `graph_id` (`delete_node.query.graph_id`; any of, optional) — Optional. Delete from a shared namespace instead of the user's own memory. Requires a service token; the agent_id path segment is ignored.
  - any of: `string`, `null`

## Header parameters

- `X-On-Behalf-Of` (`delete_node.header.X-On-Behalf-Of`; any of, optional)
  - any of: `string`, `null`
- `X-External-User-Id` (`delete_node.header.X-External-User-Id`; any of, optional)
  - any of: `string`, `null`
- `X-App-Id` (`delete_node.header.X-App-Id`; any of, optional)
  - any of: `string`, `null`

## Code samples

### cURL

```bash
curl --request DELETE \
  --url 'https://truememory-api.mvstg.com/memories/<agent_id>/nodes/<node_id>' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://truememory-api.mvstg.com/memories/<agent_id>/nodes/<node_id>';
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://truememory-api.mvstg.com/memories/<agent_id>/nodes/<node_id>"

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.text)
```

## Responses

### 200

Successful Response

#### Example

```json
{
  "status": "deleted",
  "node_id": "string",
  "facts_deleted": 0
}
```

- `node_id` (`delete_node.response.200.node_id`; string, required)
- `facts_deleted` (`delete_node.response.200.facts_deleted`; integer, required)
- `status` (`delete_node.response.200.status`; string, optional)
  - default `"deleted"`

### 422

Validation Error

#### Example

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
```

- `detail` (`delete_node.response.422.detail`; array<object>, optional)
  - `loc` (`delete_node.response.422.detail.loc`; array<any of>, required)
    - any of: `string`, `integer`
  - `msg` (`delete_node.response.422.detail.msg`; string, required)
  - `type` (`delete_node.response.422.detail.type`; string, required)
  - `input` (`delete_node.response.422.detail.input`; unknown, optional)
  - `ctx` (`delete_node.response.422.detail.ctx`; object, optional)


Source: https://truememory-docs.mvstg.com/api/memories/nodes/delete/index.md
