Create Memory
Updated at:
Creates a memory file inside a memory store. The store must be unarchived and undeleted.
Prerequisites
Endpoint and authentication configured. For details, see Overview and authentication.
Endpoint
POST
/memory_stores/{memory_store_id}/memoriesPath parameters
memory_store_idstringRequiredMemory store ID
Request body
pathstringRequiredPath inside the memory store, starting with /, for example /notes/project.md
contentstringRequiredBody in UTF-8 text; empty strings are allowed, up to 102400 bytes
Response fields
idstringMemory ID, format mem_xxx
typestringAlways memory
memory_store_idstringID of the owning memory store
pathstringPath inside the memory store, starting with /
contentstringBody, UTF-8 text; returned when view=full or in single-item reads
content_sha256stringSHA256 of the body; can be used as the optimistic lock for conditional updates
content_size_bytesintegerBody length in UTF-8 bytes
memory_version_idstringCurrent version ID, format memver_xxx
created_atstringCreation time, ISO 8601 UTC
updated_atstringLast update time, ISO 8601 UTC
Request example
curl -X POST "$AGENTSTUDIO_URL/memory_stores/memstore_xxx/memories" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"path": "/notes/project.md","content": "# Project Conventions\nThe default development environment is staging.\n"}'
Response example
{
"id": "mem_xxx",
"type": "memory",
"memory_store_id": "memstore_xxx",
"path": "/notes/project.md",
"content": "# Project Conventions\nThe default development environment is staging.\n",
"content_sha256": "e3b0c44b98fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"content_size_bytes": 47,
"memory_version_id": "memver_xxx",
"created_at": "2026-09-17T08:00:00Z",
"updated_at": "2026-09-17T08:00:00Z"
}
Error codes
| HTTP status | Error code | Description |
|---|---|---|
| 400 | invalid_request_error | Invalid parameters, path, limit, or pagination cursor |
| 401 | InvalidApiKey | API key missing, invalid, or expired |
| 403 | permission_error | Insufficient identity or resource access permissions |
| 404 | not_found_error | Resource does not exist or does not belong to the current workspace |
| 409 | memory_path_conflict_error etc. | Path conflict, conditional update conflict, or writing to an archived store |
Is this page helpful?