Write items in bulk
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.
curl --request POST \
--url https://api.zavu.dev/v1/memory/collections/{collection}/items/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ops": [
{
"op": "set",
"key": "ORD-1",
"value": {
"status": "shipped"
}
},
{
"op": "delete",
"key": "ORD-0"
}
]
}
'import requests
url = "https://api.zavu.dev/v1/memory/collections/{collection}/items/batch"
payload = { "ops": [
{
"op": "set",
"key": "ORD-1",
"value": { "status": "shipped" }
},
{
"op": "delete",
"key": "ORD-0"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ops: [
{op: 'set', key: 'ORD-1', value: {status: 'shipped'}},
{op: 'delete', key: 'ORD-0'}
]
})
};
fetch('https://api.zavu.dev/v1/memory/collections/{collection}/items/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zavu.dev/v1/memory/collections/{collection}/items/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ops' => [
[
'op' => 'set',
'key' => 'ORD-1',
'value' => [
'status' => 'shipped'
]
],
[
'op' => 'delete',
'key' => 'ORD-0'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zavu.dev/v1/memory/collections/{collection}/items/batch"
payload := strings.NewReader("{\n \"ops\": [\n {\n \"op\": \"set\",\n \"key\": \"ORD-1\",\n \"value\": {\n \"status\": \"shipped\"\n }\n },\n {\n \"op\": \"delete\",\n \"key\": \"ORD-0\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.zavu.dev/v1/memory/collections/{collection}/items/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ops\": [\n {\n \"op\": \"set\",\n \"key\": \"ORD-1\",\n \"value\": {\n \"status\": \"shipped\"\n }\n },\n {\n \"op\": \"delete\",\n \"key\": \"ORD-0\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zavu.dev/v1/memory/collections/{collection}/items/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ops\": [\n {\n \"op\": \"set\",\n \"key\": \"ORD-1\",\n \"value\": {\n \"status\": \"shipped\"\n }\n },\n {\n \"op\": \"delete\",\n \"key\": \"ORD-0\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"key": "<string>",
"ok": true,
"rev": 123,
"error": "<string>"
}
]
}{
"code": "invalid_request",
"message": "Phone number is invalid",
"details": {}
}{
"code": "invalid_request",
"message": "Phone number is invalid",
"details": {}
}{
"code": "invalid_request",
"message": "Phone number is invalid",
"details": {}
}{
"code": "invalid_request",
"message": "Phone number is invalid",
"details": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Collection name.
Query Parameters
Which scope to address: contact:<contactId>, conversation:<conversationId>, or omitted for the project scope.
Note the asymmetry with POST /v1/memory and POST /v1/memory/search, which take the scope in the request BODY as scope plus contactId/conversationId. Every other Memory endpoint takes it here.
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.
"contact:jd7x2k3m4n5p6q7r8s9t0abc"
Body
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.
1 - 25 elementsShow child attributes
Show child attributes
Response
Every operation was attempted. Inspect each result.
One entry per submitted operation, in order. Check every ok: the call returns 200 even when some operations failed.
Show child attributes
Show child attributes
curl --request POST \
--url https://api.zavu.dev/v1/memory/collections/{collection}/items/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ops": [
{
"op": "set",
"key": "ORD-1",
"value": {
"status": "shipped"
}
},
{
"op": "delete",
"key": "ORD-0"
}
]
}
'import requests
url = "https://api.zavu.dev/v1/memory/collections/{collection}/items/batch"
payload = { "ops": [
{
"op": "set",
"key": "ORD-1",
"value": { "status": "shipped" }
},
{
"op": "delete",
"key": "ORD-0"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ops: [
{op: 'set', key: 'ORD-1', value: {status: 'shipped'}},
{op: 'delete', key: 'ORD-0'}
]
})
};
fetch('https://api.zavu.dev/v1/memory/collections/{collection}/items/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zavu.dev/v1/memory/collections/{collection}/items/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ops' => [
[
'op' => 'set',
'key' => 'ORD-1',
'value' => [
'status' => 'shipped'
]
],
[
'op' => 'delete',
'key' => 'ORD-0'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zavu.dev/v1/memory/collections/{collection}/items/batch"
payload := strings.NewReader("{\n \"ops\": [\n {\n \"op\": \"set\",\n \"key\": \"ORD-1\",\n \"value\": {\n \"status\": \"shipped\"\n }\n },\n {\n \"op\": \"delete\",\n \"key\": \"ORD-0\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.zavu.dev/v1/memory/collections/{collection}/items/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ops\": [\n {\n \"op\": \"set\",\n \"key\": \"ORD-1\",\n \"value\": {\n \"status\": \"shipped\"\n }\n },\n {\n \"op\": \"delete\",\n \"key\": \"ORD-0\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zavu.dev/v1/memory/collections/{collection}/items/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ops\": [\n {\n \"op\": \"set\",\n \"key\": \"ORD-1\",\n \"value\": {\n \"status\": \"shipped\"\n }\n },\n {\n \"op\": \"delete\",\n \"key\": \"ORD-0\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"key": "<string>",
"ok": true,
"rev": 123,
"error": "<string>"
}
]
}{
"code": "invalid_request",
"message": "Phone number is invalid",
"details": {}
}{
"code": "invalid_request",
"message": "Phone number is invalid",
"details": {}
}{
"code": "invalid_request",
"message": "Phone number is invalid",
"details": {}
}{
"code": "invalid_request",
"message": "Phone number is invalid",
"details": {}
}