# delete()

Canonical URL: https://developers.iagenify.com/sdk/ref/memory/delete/
Language: en

`api.memory.delete(name) → Promise<{ ok, deleted }>`

Removes a note by name. It tells you whether there was one, and an unknown name is a success rather than a failure.

Status: DELETE /api/ai/memories/:name · free · never 404

## Parameters {#parameters}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `name` | string | required | The note's name as stored — the converted form, the one [list()](/sdk/ref/memory/list) shows. |

## Returns {#returns}

```javascript
await api.memory.delete("tone-of-voice");
// { ok: true, deleted: true }

await api.memory.delete("never-existed");
// { ok: true, deleted: false }   ← no error
```

> **deleted is the answer, ok is not**
>
> The call succeeds either way. Read deleted when you need to know whether anything was there — a cleanup job can ignore it, a confirmation message should not.

```javascript
const { deleted } = await api.memory.delete(name);

ui.toast(deleted ? `Forgot "${name}".` : `There was nothing called "${name}".`);
```

## Use the stored name {#name}

Names are converted when saved, so the name you passed to `save()` may not be the name the note has. Delete with what `list()` shows, or the call succeeds and removes nothing.

```javascript
await api.memory.save({ name: "Tone Of Voice", content: "…" });
await api.memory.delete("Tone Of Voice");   // { deleted: false } — stored as "tone-of-voice"

const notes = await api.memory.list();
const match = notes.find((n) => n.description.includes("written to"));
if (match) await api.memory.delete(match.name);   // this works
```

## It is gone {#forever}

No trash, no versions. A note is a few lines of text, and keeping copies of forgotten things would defeat the point of being able to forget them.

```javascript
// Keep a copy yourself if you want one
const note = (await api.memory.list()).find((n) => n.name === name);
if (note) await audit.record({ action: "memory.delete", note, by: userId });
await api.memory.delete(name);
```

## Whose decision this is {#whose}

A note is something remembered about the account holder. Deleting one on their behalf — to free space, to tidy up, because it looked old — is a choice about them, and worth leaving to them. Showing the list and letting them pick costs one free call.

> **Clearing everything is rarely what someone wants**
>
> « Forget everything » is easy to implement and hard to undo. If you offer it, say exactly what will be forgotten and show the list first.

- [list()](/sdk/ref/memory/list): The names as stored, and the content behind them.
- [api.memory](/sdk/ref/memory): What belongs in a note, and what does not.

```python
api.memory.delete("tone-of-voice")
# {"ok": True, "deleted": True}

api.memory.delete("never-existed")
# {"ok": True, "deleted": False}   ← no error
```

```python
deleted = api.memory.delete(name)["deleted"]

ui.toast(f'Forgot "{name}".' if deleted else f'There was nothing called "{name}".')
```

```python
api.memory.save(name="Tone Of Voice", content="…")
api.memory.delete("Tone Of Voice")   # {"deleted": False} — stored as "tone-of-voice"

notes = api.memory.list()
match = next((n for n in notes if "written to" in n["description"]), None)
if match:
    api.memory.delete(match["name"])   # this works
```

```python
# Keep a copy yourself if you want one
note = next((n for n in api.memory.list() if n["name"] == name), None)
if note:
    audit.record(action="memory.delete", note=note, by=user_id)
api.memory.delete(name)
```
