Memory API reference
Base URL:https://api.withfoundry.aiAuth:
Authorization: Bearer key_...
All responses use this envelope:
success: false, data with error details, and appropriate HTTP status (4xx/5xx).
Write entries
POST /v1/memory/entries
Write one or more entries into a namespace. Each entry is embedded and indexed for semantic search.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
namespace | string | Yes | Namespace id (e.g. app or tenant). |
entries | array | Yes | Array of { content, metadata? }. |
entries[].content | string | Yes | Text to store and embed. |
entries[].metadata | object | No | Arbitrary JSON for filtering/display. |
data
| Field | Type | Description |
|---|---|---|
ids | string[] | IDs of created entries (e.g. mem_...). |
Search
POST /v1/memory/search
Semantic search over a namespace. Returns entries ranked by similarity to the query.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
namespace | string | Yes | Namespace to search. |
query | string | Yes | Natural-language query. |
limit | number | No | Max results (default from plan). |
metadataFilter | object | No | Key-value filters on metadata. |
data
Array of objects:
| Field | Type | Description |
|---|---|---|
id | string | Entry id. |
content | string | Stored text. |
metadata | object | Stored metadata. |
score | number | Similarity score (e.g. 0–1). |
Get context
POST /v1/memory/context
Run semantic search and return a single formatted context string for use in LLM prompts.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
namespace | string | Yes | Namespace to search. |
query | string | Yes | Query for ranking entries. |
limit | number | No | Max entries to include in the string. |
data
| Field | Type | Description |
|---|---|---|
text | string | Concatenated content of top entries. |
entryIds | string[] | IDs of entries included. |