API Reference
Bulk Add Memory
Submit 1–50 independent memory candidates and inspect the outcome for every original item.
Endpoint and request fields
POST/memory/bulk-add
207 Multi-Status
| Field | Type | Contract |
|---|---|---|
items | array | Required; 1–50 candidates. |
items[].text | string | Required candidate text. |
items[].source | string | Optional source label. |
items[].event_type / eventType | string | Optional event label. |
items[].tags | string[] | Optional tags. |
items[].importance | number | Optional value from 0 to 1. |
items[].metadata | object | Optional metadata. |
items[].client_ref | string | Optional; up to 128 characters. Your own identifier for this record. An item carrying one you have sent before is reported as skipped with reason already_ingested, and no second copy is stored. Unique per end user, project and environment. |
deduplicate | boolean | Accepted and ignored. Deduplication is always on for this route; the field is kept so existing callers are not rejected. |
Add a batch
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",project_id=os.environ["MEMORYSYNC_PROJECT_ID"],end_user_id="usr_7f3a9c2e",)from memorysync import BulkAddItemresult = client.bulk_add([BulkAddItem(text="The user prefers concise answers.", tags=["preference"]),BulkAddItem(text="The user uses dark mode.", tags=["preference", "ui"]),])
Result paths
| Meaning | Python path | Node.js path | REST path |
|---|---|---|---|
| Totals | result.total, .created, .skipped, .rejected | result.total, .created, .skipped, .rejected | total, created, skipped, rejected |
| Per-item outcome | result.results[i].status | result.results[i].status | results[i].status |
| Created IDs | result.results[i].memory_ids | result.results[i].memoryIds | results[i].memory_ids |
| Explanation | result.results[i].reason | result.results[i].reason | results[i].reason |
207-response.json
{"total":2,"created":1,"skipped":1,"rejected":0,"results":[{"index":0,"status":"created","memory_ids":[101],"reason":null},{"index":1,"status":"skipped","memory_ids":[],"reason":"duplicate"}]}
Errors and next action
CREATED
Use returned IDs
Continue with the created item.
SKIPPED
Accept the normal outcome
Read the reason; no new memory was created for that item.
REJECTED
Correct this item
Use the original index to locate and fix the candidate.
REQUEST ERROR
Handle the whole call
Correct 4xx; preserve a recoverable state for 429 or 5xx.
Safety notes
Batch contract in detail
| Rule | Contract |
|---|---|
| Batch size | Submit from 1 to 50 independent items. |
| Item text | Each item requires meaningful text and is validated independently. |
| Item context | Each item can include source, event type, tags, importance, metadata, and an end-user override. |
| Deduplication | Always applied. Near-duplicate detection is part of the shared extraction pipeline, so it cannot be turned off for a batch. It compares meaning rather than matching an id, which makes it a filter and not an idempotency guarantee. |
| Safe retries | Send items[].client_ref with your own id for each record. A retry carrying the same value reports that item as skipped with reason already_ingested and returns the ids the first submission produced. This is the guarantee near-duplicate detection cannot give. |
| Response | HTTP 207 reports totals and preserves the original zero-based index for each result. |
Reconcile every item
- 01
Match
INDEXUse each result’s
indexto find the original candidate. - 02
Accept
CREATEDRecord returned IDs for every
createditem. - 03
Explain
SKIPPEDTreat
skippedas a normal outcome and read its reason. - 04
Correct
REJECTEDFix only the corresponding
rejecteditem. - 05
Report
DONEPresent completion only after inspecting all entries.
Related reference
Was this page helpful?