API reference · CAIN Memory
Api Store Memory
POST /fabric/memory/store
Last reviewed 2026-10-02
POST /fabric/memory/store
Store a new memory with admission control.
Parameters
| Name | In | Type | Meaning |
|---|---|---|---|
X-Tenant-ID | header | string or null |
Request body
StoreMemoryRequest (required)
| Field | Type | Meaning |
|---|---|---|
agent_id required | string | min length 1 · max length 255 |
memory_type required | string | pattern ^(episodic|semantic|procedural|preference|task|working|factual|experience|instruction|observation)$ |
content required | string | min length 1 · max length 65536 |
source | string | pattern ^(agent|tool|human|delegated|system)$ · default "agent" |
identity_id | string or null | |
source_type | string | default "agent" |
source_reference | string or null | |
confidence | number | min 0.0 · max 1.0 · default 0.5 |
tags | array of string or null | |
metadata | object or null | |
expires_at | string or null | |
provenance | object or null | |
evidence_id | string or null | |
decision_id | string or null | |
trace_id | string or null | |
trajectory_id | string or null | |
sensitivity | string | pattern ^(internal|confidential|restricted|public)$ · default "internal" |
Responses
| Status | Meaning | Body |
|---|---|---|
200 | Successful Response | JSON |
422 | Validation Error | HTTPValidationError |
401 | No key, or a key that is not valid | JSON detail |
429 | Rate limit for your plan reached; retry after the Retry-After seconds | JSON detail |
Try it
This call changes data in the account the key belongs to.
The request goes from your browser straight to this site. Your key is not stored unless you tick the box, and then only in this tab's session storage.
Code
curl -sS -X POST 'https://cainstudio.online/fabric/memory/store' \
-H "X-API-Key: $CAIN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"agent_id": "agent-id", "memory_type": "memory-type", "content": "content", "source": "agent", "source_type": "agent", "confidence": 0.5, "sensitivity": "internal"}'import json, os, urllib.request
req = urllib.request.Request('https://cainstudio.online/fabric/memory/store', method='POST',
headers={"X-API-Key": os.environ["CAIN_API_KEY"], "Content-Type": "application/json"},
data=json.dumps({
"agent_id": "agent-id",
"memory_type": "memory-type",
"content": "content",
"source": "agent",
"source_type": "agent",
"confidence": 0.5,
"sensitivity": "internal"
}).encode())
with urllib.request.urlopen(req, timeout=60) as r:
print(r.status, json.load(r))const res = await fetch("https://cainstudio.online/fabric/memory/store", {
method: "POST",
headers: {
"X-API-Key": process.env.CAIN_API_KEY!,
"Content-Type": "application/json",
},
body: JSON.stringify({
"agent_id": "agent-id",
"memory_type": "memory-type",
"content": "content",
"source": "agent",
"source_type": "agent",
"confidence": 0.5,
"sensitivity": "internal"
}),
});
console.log(res.status, await res.json());Schemas used
HTTPValidationError · StoreMemoryRequest · ValidationError
← Api Get Stats · all 22 CAIN Memory calls · Api Set Trust Level →
Try CAIN-42 on your own agents
Create a free account and every new account starts with a 7-day trial of the full platform. Or try the sandbox first, with no account at all.
Create a free account → · Try the sandbox · See the whole ecosystem