# delete()

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

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

Tira una nota per nome. Ti dice se c'era una, e un nome sconosciut è un successo e non un fallimento.

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

## Parâmetros {#parameters}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `name` | string | obrigatório | Il nome della nota come memorized — il form convertit, il [list()](/pt/sdk/ref/memory/list) mostra. |

## Retorno {#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
```

> **eliminato è la risposta, ok non è**
>
> L'invocazione succede in ogni modo. Let eliminat quando si ha bisogno di saper se c'era algo là — un lavoro di pulire può ignorar, un messaggio di conferma non deve.

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

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

## Usar il nome memorât {#name}

I nomi sono convertiti quando salvat, quindi il nome che passate a `save()` non è il nome che la nota ha. Elimina con che `list()` mostra, o il call succede e non elimina nulla.

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

## Se n'è piu' {#forever}

Un nota è unas righe di testo, e conservare copias di cose dimenticate s'imputaria il punto di poterle dimenticare.

```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);
```

## De chi è la decisione di cui {#whose}

Una nota è qualcosa ricordat del titulari conto. Deletare uno per loro — a libere lo spazio, a ordinare, perché pareveve vecchio — è una scelta su di loro, e vale la pena lasciar a loro. Mostrando la lista e lasciando-le escort costa un appello gratuito.

> **Limpar tutto è raramente quello que qualcuno vuole**
>
> «Olvidit tutto» è facile da implementare e difficile da desfare. Se lo offrez, dici exacto quello che sarà dimenticato e mostra la lista prima.

- [list()](/pt/sdk/ref/memory/list): I nomi come memorizzati, e il contenit tras de loro.
- [api.memory](/pt/sdk/ref/memory): Cenès di una nota, e cenès no.

```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)
```
