---
title: "Write items in bulk"
method: POST
path: "/v1/memory/collections/{collection}/items/batch"
tags: ["Memory"]
---

# Write items in bulk

`POST /v1/memory/collections/{collection}/items/batch`

## Request

- Base URL: `https://api.zavu.dev`
- URL: `https://api.zavu.dev/v1/memory/collections/{collection}/items/batch`
- Auth: HTTP bearer

Up to 25 sets and deletes in one call, in one scope.

**Not a transaction.** Each operation succeeds or fails on its own and is reported separately; the call returns `200` even when some failed. Check every entry's `ok` — treating a 200 as "all 25 landed" is the mistake this endpoint invites.

## Path parameters

- `collection` string, required

## Query parameters

- `scope` string: Scope as a query-string value: `contact:<contactId>`, `conversation:<conversationId>`, the literal `project`, or omitted for project scope. Only the SHAPE of the id is validated, never its existence — the partition already carries your project, so an id that matches nothing simply addresses an empty scope rather than returning 404.

## Request body

- MemoryItemBatchRequest: Up to 25 writes and deletes in one call. Operations are NOT atomic: each is reported on its own, and a failure in one does not roll the others back.
  - `ops` object[], required
    - `op` 'set' | 'delete', required
    - `key` string, required
    - `value` unknown
    - `ttlSeconds` integer

## Response `200`

Every operation was attempted. Inspect each result.

- MemoryItemBatchResponse
  - `results` object[], required: One entry per submitted operation, in order. Check every `ok`: the call returns 200 even when some operations failed.
    - `key` string, required
    - `ok` boolean, required
    - `rev` integer: New revision, on a successful `set`.
    - `error` string: Why this operation failed. Present when `ok` is false.

## Other responses

- `400`: Invalid body, scope, or more than 25 operations.
- `401`: Unauthorized.
- `404`: Collection not found.
- `429`: The plan's monthly unit quota is spent.

## Changes

> 80 revisions in range; 1 not diffed.

- **2026-08-26** `6e8c555e1104`: 1 info
  - removed the non-success response with the status `403`
- **2026-08-26** `83caf7165722`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/zavudev/apis/zavu-unified-messaging-layer-api/changes/v1/memory/collections/:collection/items/batch/post.md)

---

[API](https://skmtc.dev/zavudev/apis/zavu-unified-messaging-layer-api.md) - [All operations](https://skmtc.dev/zavudev/apis/zavu-unified-messaging-layer-api/llms.txt) - [OpenAPI document](https://skmtc.dev/zavudev/apis/zavu-unified-messaging-layer-api/revisions/75bc777b0ffb?raw)
