MemoryKit

Batch Ingest

Ingest up to 100 memories in a single request.

POST/v1/memories/batch

Request body

itemsobject[]required

Array of memory objects (1–100 items).

items[].contentstringrequired

Text content to store (1–5M chars).

items[].titlestring

Title (auto-extracted if omitted).

items[].typestring

Content type.

items[].tagsstring[]

Tags for filtering.

items[].metadataobject

Arbitrary key-value pairs.

items[].languagestring

ISO 639-1 language code.

items[].userIdstring

Associate with a user.

defaultsobject

Default values applied to all items.

defaults.typestring

Default content type.

defaults.tagsstring[]

Default tags.

defaults.languagestring

Default language.

defaults.userIdstring

Default user ID.

Response

Returns 202 Accepted with batch results.

itemsobject[]

Successfully ingested memories.

totalnumber

Total items submitted.

failednumber

Number of failed items.

errorsobject[]

Validation errors with index and error message.

Example response
{
  "items": [
    { "id": "mem_abc123", "title": "Meeting Notes", "status": "processing", "index": 0 },
    { "id": "mem_def456", "title": "Product Spec", "status": "processing", "index": 1 }
  ],
  "total": 2,
  "failed": 0,
  "errors": []
}

If some items fail validation, they appear in errors:

Partial failure
{
  "items": [
    { "id": "mem_abc123", "title": "Meeting Notes", "status": "processing", "index": 0 }
  ],
  "total": 2,
  "failed": 1,
  "errors": [
    { "index": 1, "error": "content: field required" }
  ]
}
const result = await mk.memories.batchIngest({
  items: [
    { content: "Meeting notes from Q4...", title: "Q4 Notes", tags: ["planning"] },
    { content: "Product requirements...", title: "PRD v2", tags: ["product"] },
  ],
  defaults: { type: "document", language: "en" },
});
 
console.log(`Ingested: ${result.total - result.failed}/${result.total}`);
Edit on GitHub

On this page