# Update the agent memory

> Replace the notes, turn them on or off, or both. The last save wins.

`PATCH /v1/tenants/{tenant}/memory`

```bash curl
curl -X PATCH "https://api.shako.dev/v1/tenants/acme/memory" \
  -H "Authorization: Bearer $SHAKO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Always answer in bullet points.","enabled":true}'
```

```python Python
import os

import requests

response = requests.patch(
    "https://api.shako.dev/v1/tenants/acme/memory",
    headers={"Authorization": f"Bearer {os.environ['SHAKO_API_KEY']}"},
    json={
        "text": "Always answer in bullet points.",
        "enabled": True,
    },
)
response.raise_for_status()
print(response.json())
```

```javascript JavaScript
const response = await fetch("https://api.shako.dev/v1/tenants/acme/memory", {
  method: "PATCH",
  headers: { Authorization: `Bearer ${process.env.SHAKO_API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "text": "Always answer in bullet points.",
    "enabled": true
  }),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
```

```json 200 (excerpt)
{
  "enabled": true,
  "text": "Always answer in bullet points.",
  "tokens": 8,
  "updated": 1793491200
}
```

Authenticate with `Authorization: Bearer <API key>` on `https://api.shako.dev`. Role: contributor or owner.

## Path parameters

**tenant** `string` *required*

The tenant's name, from GET /v1/tenants.

## Request body

**text** `string` (default: no change)

The notes, at most 2000 tokens.

**enabled** `boolean` (default: no change)

true: Shako adds the notes to each LLM request from the VMs of the tenant.

## Response

200 with [the agent memory object](https://shako.dev/api/objects/agent-memory.md).

The errors: https://shako.dev/api/errors.md. All the endpoints of Agent memory: https://shako.dev/api/memory.md.
