Create Memories Directly
JavaScript Example
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
memories: [
{
content: 'John prefers dark mode',
isStatic: false,
metadata: {},
forgetAfter: '2026-06-01T00:00:00Z',
forgetReason: 'temporary project deadline',
temporalContext: {documentDate: '<string>', eventDate: ['<string>']}
}
],
containerTag: 'user_123'
})
};
fetch('https://api.supermemory.ai/v4/memories', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
Response Status Codes
- 201
- 400
- 401
- 404
- 500
Sample Response
{
"documentId": "<string>",
"memories": [
{
"id": "<string>",
"memory": "<string>",
"isStatic": true,
"createdAt": "<string>",
"forgetAfter": "<string>",
"forgetReason": "<string>"
}
]
}
Authorizations
Authorization
Type: string
Location: header
Required: Yes
Format: Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body Specification
memories
Type: object[]
Required: Yes
Description: Array of memories to create. Required array length: 1 - 100 elements.
containerTag
Type: string
Required: Yes
Description: The space/container tag these memories belong to. Maximum string length: 100. Pattern: ^[a-zA-Z0-9_:-]+$. Example: "user_123".
Response Information
201
Type: application/json
Description: Memories created successfully.
Response fields:
- documentId
Type:string | null
Required: Yes
Description: ID of the source document created.
memories
Type: object[]
Required: Yes
Description: Details of the created memories.