MemLibMemLib

Batch Store

POST /memory/batch — Store multiple memories at once

Endpoint

POST /v1/memory/batch

Permission: Read & Write


Request Body

{
  "namespace": "my-app",
  "entity": "user-123",
  "memories": [
    { "content": "Likes coffee" },
    { "content": "Works remotely", "tags": ["work"] },
    { "content": "Located in Berlin", "metadata": { "source": "profile" } }
  ]
}
FieldTypeRequiredDescription
namespacestringMemory namespace
entitystringEntity identifier
memoriesArrayArray of memories to store

Each memory accepts:

FieldTypeRequiredDescription
contentstringText content
tagsstring[]Tags for categorization
metadataobjectArbitrary metadata
ttlnumberTime-to-live in seconds

Response

{
  "count": 3,
  "memories": [
    {
      "id": "uuid-1",
      "content": "Likes coffee",
      "namespace": "my-app",
      "entity": "user-123",
      "createdAt": "2024-03-20T10:00:00.000Z"
    }
  ]
}

curl Example

curl -X POST https://mem.anishroy.com/api/v1/memory/batch \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "namespace": "my-app",
    "entity": "user-123",
    "memories": [
      { "content": "Likes coffee" },
      { "content": "Works remotely" }
    ]
  }'

Note: Batch store uses raw storage (no LLM inference). For smart store with fact extraction, use the store endpoint with individual calls.

On this page