Create Memory

Database and user

Use a registered memory-capable database, such as the SQLite database in the example API server. Supply db_id when several database IDs are available. A table selector requires db_id and selects a configured adapter; it does not create arbitrary storage.

Scoped identity overrides a supplied user_id. JWT user isolation is opt-in; non-admin service-account PAT callers always self-scope. When authorization is enforced, use the appropriate memories:read, memories:write or memories:delete scope.

Create a memory

For an unscoped request, supply user_id; omission returns 400 despite the optional generated field. A scoped caller's identity takes precedence.

curl --fail-with-body http://127.0.0.1:7777/memories \
  -H "Authorization: Bearer $OS_SECURITY_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"user_id":"example-user","memory":"Prefers concise explanations.","topics":["preferences"]}'

This uses the linked example server and its database. Keep the returned memory_id. The current response includes updated_at; the generated example's created_at is not a field in UserMemorySchema.

POST/memories

Create a new user memory with content and associated topics. Memories are used to store contextual information for users across conversations.

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Query Parameters

db_id?|

Database ID to use for memory storage

table?|

Table to use for memory storage

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Define the payload expected for creating a new user memory

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl --request POST 'https://example.com/memories' \  --header 'Content-Type: application/json' \  --data-raw '{"memory":"string"}'
{  "memory_id": "mem-123",  "memory": "User prefers technical explanations with code examples",  "topics": [    "preferences",    "communication_style",    "technical"  ],  "user_id": "user-456",  "created_at": "2024-01-15T10:30:00Z",  "updated_at": "2024-01-15T10:30:00Z"}