Save Memory stores a document under a name (its **namespace**). A [`GET /context`](/docs/api/context) whose `query` is exactly that name returns the document **word for word**, without a search. Memories are also indexed, so related queries find them too.

## Request

POST the content as the body, with the name as `namespace`. The response gives the name to read it back by:

```bash
curl -X POST "https://context-link.ai/api/v1/context/save?namespace=meeting-notes" \
  -H "Authorization: $CONTEXT_LINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '["Meeting notes from Feb 15: discussed roadmap priorities and Q2 goals."]'
```

```json
{ "message": "Saved", "namespace": "meeting-notes" }
```

## Request fields

| Field | Type | Description |
|---|---|---|
| `namespace` | string | Required, in the query string. The Memory's name. Case-insensitive; spaces become dashes. A `[mode]/name` form (e.g. `[customer-support]/top-links`) saves into that mode. |
| `mode` | string | Optional, in the query string. The mode this session runs in; the Memory is saved into it. See [Mode-scoped memories](#mode-scoped-memories). |
| body | text or JSON | Required. The content. A JSON array of strings, a JSON string, a JSON object or plain text all work; it's converted to markdown before it's saved. |

## Response fields

| Field | Type | Description |
|---|---|---|
| `message` | string | `Saved`. Returned with HTTP `201`. |
| `namespace` | string | The name to retrieve it by. Shown as `[mode]/name` when saved into a mode. |

## Versioning

- Saving to an existing name creates a **new version**. Retrieving by name always returns the latest; earlier versions are kept, not searched.
- Re-save the whole document each time it changes, rather than appending.
- Names organise Memories by topic: `brand-voice`, `project-roadmap`, `meeting-notes`.

## Mode-scoped memories

If you query with a `mode`, **save with the same `mode`**: whatever mode your GETs use, your saves use too.

- A Memory saved with a mode is named `[mode]/name` (e.g. `[customer-support]/top-links`) and **only exists in that mode**. Requests with no mode or another mode never see it, by name or by search.
- A Memory saved without a mode is visible everywhere.
- Inside a mode, `top-links` and `[customer-support]/top-links` both resolve to the mode's Memory. If an unmoded `top-links` also exists, the mode's version wins.
- One name can hold an unmoded Memory and one per mode, side by side.
- A `[mode]/` prefix that disagrees with `mode` is a `422`.

```bash
curl -X POST "https://context-link.ai/api/v1/context/save?namespace=top-links&mode=customer-support" \
  -H "Authorization: $CONTEXT_LINK_API_KEY" \
  -d 'The links support agents send most often.'
```

```json
{ "message": "Saved", "namespace": "[customer-support]/top-links" }
```

## Reading it back

```bash
curl "https://context-link.ai/api/v1/context?query=top-links&mode=customer-support" \
  -H "Authorization: $CONTEXT_LINK_API_KEY"
```

```json
{ "message": "The links support agents send most often.", "format": "markdown" }
```

Forgotten a name? [`GET /memories`](/docs/api/memories) lists every Memory you can read back.

## Good to know

- Saving shares `/context`'s rate limit: 5 requests per 10 seconds per API key.
- From your subdomain, `POST https://yourname.context-link.ai/<namespace>?p=YOUR_PIN` saves the same way without an API key.
