> For the complete documentation index, see [llms.txt](https://docs.release.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.release.com/reference-documentation/release-api/ai-sandbox-api/memory-stores.md).

# Memory Stores

The Memory Stores API lets you create and manage vector stores for semantic search. Memory stores hold text records with optional metadata, embedded using a model you specify at creation time. You can attach memory stores to sandbox sessions as resources for in-session retrieval.

To obtain your authentication credentials, [install the Release CLI](/cli/installation.md) and run `release auth login`. The CLI stores credentials in `~/.release.yaml`.

***

## List Memory Stores

Returns all memory stores for an account.

#### Endpoint

<mark style="color:green;">`GET`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/memory_stores`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Headers

| Header | Value              |
| ------ | ------------------ |
| Accept | `application/json` |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |

#### Status Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 200  | Returns array of memory stores                |
| 401  | Unauthorized — invalid or missing credentials |

#### Response Body

Returns an array of memory store objects.

| Field            | Type              | Description                                |
| ---------------- | ----------------- | ------------------------------------------ |
| id               | string (hashid)   | Unique identifier for the memory store     |
| name             | string            | Display name of the memory store           |
| embedding\_model | string            | The embedding model used for vectorization |
| created\_at      | string (ISO 8601) | When the memory store was created          |
| updated\_at      | string (ISO 8601) | When the memory store was last updated     |

#### Example Responses

**200 OK**

```json
[
  {
    "id": "mS5tR9",
    "name": "project-docs",
    "embedding_model": "text-embedding-3-small",
    "created_at": "2026-06-01T10:00:00Z",
    "updated_at": "2026-06-01T10:00:00Z"
  }
]
```

***

## Create Memory Store

Creates a new memory store with the specified embedding model.

#### Endpoint

<mark style="color:green;">`POST`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/memory_stores`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Headers

| Header       | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| Accept       | `application/json` |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |

#### Request Body

| Field            | Type   | Required | Description                                                |
| ---------------- | ------ | -------- | ---------------------------------------------------------- |
| name             | string | Yes      | Display name for the memory store                          |
| embedding\_model | string | Yes      | The embedding model to use (e.g. `text-embedding-3-small`) |

**Example**

```json
{
  "name": "project-docs",
  "embedding_model": "text-embedding-3-small"
}
```

#### Status Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 201  | Memory store created                          |
| 401  | Unauthorized — invalid or missing credentials |
| 422  | Validation error                              |

#### Response Body

| Field            | Type              | Description                                |
| ---------------- | ----------------- | ------------------------------------------ |
| id               | string (hashid)   | Unique identifier for the memory store     |
| name             | string            | Display name of the memory store           |
| embedding\_model | string            | The embedding model used for vectorization |
| created\_at      | string (ISO 8601) | When the memory store was created          |
| updated\_at      | string (ISO 8601) | When the memory store was last updated     |

#### Example Responses

**201 Created**

```json
{
  "id": "mS5tR9",
  "name": "project-docs",
  "embedding_model": "text-embedding-3-small",
  "created_at": "2026-06-01T10:00:00Z",
  "updated_at": "2026-06-01T10:00:00Z"
}
```

**422 Unprocessable Entity**

```json
{
  "errors": [
    {
      "code": "validation_error",
      "message": "Name can't be blank"
    }
  ]
}
```

***

## Get Memory Store

Returns a single memory store by ID.

#### Endpoint

<mark style="color:green;">`GET`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/memory_stores/{id}`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Headers

| Header | Value              |
| ------ | ------------------ |
| Accept | `application/json` |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |
| id        | string (hashid) | Yes      | The memory store ID    |

#### Status Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 200  | Returns the memory store                      |
| 401  | Unauthorized — invalid or missing credentials |
| 404  | Memory store not found                        |

#### Response Body

| Field            | Type              | Description                                |
| ---------------- | ----------------- | ------------------------------------------ |
| id               | string (hashid)   | Unique identifier for the memory store     |
| name             | string            | Display name of the memory store           |
| embedding\_model | string            | The embedding model used for vectorization |
| created\_at      | string (ISO 8601) | When the memory store was created          |
| updated\_at      | string (ISO 8601) | When the memory store was last updated     |

#### Example Responses

**200 OK**

```json
{
  "id": "mS5tR9",
  "name": "project-docs",
  "embedding_model": "text-embedding-3-small",
  "created_at": "2026-06-01T10:00:00Z",
  "updated_at": "2026-06-01T10:00:00Z"
}
```

**404 Not Found**

```json
{
  "errors": [
    {
      "code": "not_found",
      "message": "Memory store not found"
    }
  ]
}
```

***

## Delete Memory Store

Permanently deletes a memory store and all of its records. This action cannot be undone.

#### Endpoint

<mark style="color:green;">`DELETE`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/memory_stores/{id}`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |
| id        | string (hashid) | Yes      | The memory store ID    |

#### Status Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 204  | Memory store deleted (no content)             |
| 401  | Unauthorized — invalid or missing credentials |
| 404  | Memory store not found                        |

#### Example Responses

**404 Not Found**

```json
{
  "errors": [
    {
      "code": "not_found",
      "message": "Memory store not found"
    }
  ]
}
```

***

## Records

Records are the individual text entries stored in a memory store. Each record is embedded using the store's configured model and can be retrieved via semantic search.

***

## Write Records

Writes one or more records to a memory store. Each record is embedded and indexed for semantic search.

#### Endpoint

<mark style="color:green;">`POST`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/memory_stores/{id}/write`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Headers

| Header       | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| Accept       | `application/json` |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |
| id        | string (hashid) | Yes      | The memory store ID    |

#### Request Body

| Field               | Type   | Required | Description                                         |
| ------------------- | ------ | -------- | --------------------------------------------------- |
| records             | array  | Yes      | Array of record objects to write                    |
| records\[].content  | string | Yes      | The text content to embed and store                 |
| records\[].metadata | object | No       | Arbitrary key-value metadata attached to the record |

**Example**

```json
{
  "records": [
    {
      "content": "text to remember",
      "metadata": {
        "source": "doc"
      }
    }
  ]
}
```

#### Status Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 200  | Records written successfully                  |
| 401  | Unauthorized — invalid or missing credentials |
| 404  | Memory store not found                        |
| 422  | Validation error                              |

#### Example Responses

**200 OK**

```json
{
  "records": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "content": "text to remember",
      "metadata": {
        "source": "doc"
      }
    }
  ]
}
```

***

## Semantic Search

Searches for records semantically similar to the provided query. The query is embedded using the store's configured model and compared against all stored records.

#### Endpoint

<mark style="color:green;">`POST`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/memory_stores/{id}/search`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Headers

| Header       | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| Accept       | `application/json` |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |
| id        | string (hashid) | Yes      | The memory store ID    |

#### Request Body

| Field   | Type    | Required | Description                                            |
| ------- | ------- | -------- | ------------------------------------------------------ |
| query   | string  | Yes      | The search query text                                  |
| k       | integer | No       | Number of results to return (default varies by server) |
| filters | object  | No       | Key-value metadata filters to narrow results           |

**Example**

```json
{
  "query": "what did we discuss about auth?",
  "k": 5,
  "filters": {
    "source": "doc"
  }
}
```

#### Status Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 200  | Returns matching records                      |
| 401  | Unauthorized — invalid or missing credentials |
| 404  | Memory store not found                        |
| 422  | Validation error                              |

#### Response Body

Returns an array of matching record objects, ordered by relevance.

| Field    | Type   | Description                     |
| -------- | ------ | ------------------------------- |
| id       | string | Unique record identifier (UUID) |
| content  | string | The stored text content         |
| metadata | object | Metadata attached to the record |
| score    | number | Similarity score                |

#### Example Responses

**200 OK**

```json
{
  "records": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "content": "We decided to use JWT tokens for auth with a 1-hour expiry.",
      "metadata": {
        "source": "doc"
      },
      "score": 0.92
    }
  ]
}
```

***

## Delete Records

Deletes specific records from a memory store by their IDs.

#### Endpoint

<mark style="color:green;">`POST`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/memory_stores/{id}/delete_records`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Headers

| Header       | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| Accept       | `application/json` |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |
| id        | string (hashid) | Yes      | The memory store ID    |

#### Request Body

| Field | Type             | Required | Description            |
| ----- | ---------------- | -------- | ---------------------- |
| ids   | array of strings | Yes      | Record UUIDs to delete |

**Example**

```json
{
  "ids": [
    "550e8400-e29b-41d4-a716-446655440000",
    "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
  ]
}
```

#### Status Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 200  | Records deleted successfully                  |
| 401  | Unauthorized — invalid or missing credentials |
| 404  | Memory store not found                        |
| 422  | Validation error                              |

#### Example Responses

**200 OK**

```json
{
  "deleted": 2
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.release.com/reference-documentation/release-api/ai-sandbox-api/memory-stores.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
