Skip to main content
POST
/
sandbox
/
mem0
/
{sandbox_id}
/
initialize
Initialize mem0 sandbox with data
curl --request POST \
  --url https://api.klavis.ai/sandbox/mem0/{sandbox_id}/initialize \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "memory_list": [
    {
      "message_list": [
        {
          "role": "user",
          "content": "I prefer dark mode for all applications"
        }
      ],
      "user_id": "user_001",
      "agent_id": "agent_assistant",
      "app_id": "settings_app",
      "run_id": "run_12345",
      "auto_infer": true,
      "background_processing": true,
      "category_definitions": [
        {
          "ui_preferences": "Tracks user interface settings and visual preferences including themes, colors, and display options"
        }
      ],
      "metadata": {
        "category": "preferences",
        "tags": [
          "ui",
          "settings"
        ]
      },
      "version": "v2"
    },
    {
      "message_list": [
        {
          "role": "user",
          "content": "My favorite programming language is Python"
        },
        {
          "role": "assistant",
          "content": "I've noted that Python is your favorite programming language."
        }
      ],
      "user_id": "user_001",
      "agent_id": "agent_assistant",
      "app_id": "dev_app",
      "run_id": "run_12346",
      "auto_infer": true,
      "background_processing": true,
      "category_definitions": [
        {
          "technical_skills": "Tracks programming languages, frameworks, tools and technical expertise levels"
        }
      ],
      "metadata": {
        "category": "preferences",
        "tags": [
          "programming",
          "development"
        ]
      },
      "version": "v2"
    },
    {
      "message_list": [
        {
          "role": "user",
          "content": "I have a meeting every Monday at 9 AM"
        }
      ],
      "user_id": "user_001",
      "agent_id": "agent_calendar",
      "app_id": "calendar_app",
      "run_id": "run_12347",
      "auto_infer": true,
      "background_processing": false,
      "category_definitions": [
        {
          "schedule_management": "Tracks recurring events, meetings, appointments and time commitments"
        }
      ],
      "processing_instructions": "Store all calendar events with timezone information",
      "metadata": {
        "category": "schedule",
        "tags": [
          "calendar",
          "recurring"
        ]
      },
      "version": "v2"
    },
    {
      "message_list": [
        {
          "role": "user",
          "content": "I'm working on a machine learning project using TensorFlow"
        }
      ],
      "user_id": "user_001",
      "agent_id": "agent_assistant",
      "app_id": "project_app",
      "run_id": "run_12348",
      "auto_infer": true,
      "background_processing": true,
      "include_preferences": "project details, technologies, status",
      "category_definitions": [
        {
          "project_tracking": "Tracks active and past projects including technologies used, status, and objectives"
        }
      ],
      "metadata": {
        "category": "projects",
        "tags": [
          "ml",
          "tensorflow",
          "current"
        ]
      },
      "version": "v2"
    },
    {
      "message_list": [
        {
          "role": "user",
          "content": "My email is user@example.com"
        }
      ],
      "user_id": "user_001",
      "agent_id": "agent_assistant",
      "app_id": "contact_app",
      "run_id": "run_12349",
      "auto_infer": false,
      "background_processing": true,
      "read_only": true,
      "exclude_preferences": "temporary contact info",
      "category_definitions": [
        {
          "contact_information": "Tracks permanent contact details including email, phone numbers, and social media handles"
        }
      ],
      "metadata": {
        "category": "contact",
        "tags": [
          "email",
          "personal"
        ]
      },
      "version": "v2"
    }
  ]
}
EOF
import requests

url = "https://api.klavis.ai/sandbox/mem0/{sandbox_id}/initialize"

payload = { "memory_list": [
{
"message_list": [
{
"role": "user",
"content": "I prefer dark mode for all applications"
}
],
"user_id": "user_001",
"agent_id": "agent_assistant",
"app_id": "settings_app",
"run_id": "run_12345",
"auto_infer": True,
"background_processing": True,
"category_definitions": [{ "ui_preferences": "Tracks user interface settings and visual preferences including themes, colors, and display options" }],
"metadata": {
"category": "preferences",
"tags": ["ui", "settings"]
},
"version": "v2"
},
{
"message_list": [
{
"role": "user",
"content": "My favorite programming language is Python"
},
{
"role": "assistant",
"content": "I've noted that Python is your favorite programming language."
}
],
"user_id": "user_001",
"agent_id": "agent_assistant",
"app_id": "dev_app",
"run_id": "run_12346",
"auto_infer": True,
"background_processing": True,
"category_definitions": [{ "technical_skills": "Tracks programming languages, frameworks, tools and technical expertise levels" }],
"metadata": {
"category": "preferences",
"tags": ["programming", "development"]
},
"version": "v2"
},
{
"message_list": [
{
"role": "user",
"content": "I have a meeting every Monday at 9 AM"
}
],
"user_id": "user_001",
"agent_id": "agent_calendar",
"app_id": "calendar_app",
"run_id": "run_12347",
"auto_infer": True,
"background_processing": False,
"category_definitions": [{ "schedule_management": "Tracks recurring events, meetings, appointments and time commitments" }],
"processing_instructions": "Store all calendar events with timezone information",
"metadata": {
"category": "schedule",
"tags": ["calendar", "recurring"]
},
"version": "v2"
},
{
"message_list": [
{
"role": "user",
"content": "I'm working on a machine learning project using TensorFlow"
}
],
"user_id": "user_001",
"agent_id": "agent_assistant",
"app_id": "project_app",
"run_id": "run_12348",
"auto_infer": True,
"background_processing": True,
"include_preferences": "project details, technologies, status",
"category_definitions": [{ "project_tracking": "Tracks active and past projects including technologies used, status, and objectives" }],
"metadata": {
"category": "projects",
"tags": ["ml", "tensorflow", "current"]
},
"version": "v2"
},
{
"message_list": [
{
"role": "user",
"content": "My email is user@example.com"
}
],
"user_id": "user_001",
"agent_id": "agent_assistant",
"app_id": "contact_app",
"run_id": "run_12349",
"auto_infer": False,
"background_processing": True,
"read_only": True,
"exclude_preferences": "temporary contact info",
"category_definitions": [{ "contact_information": "Tracks permanent contact details including email, phone numbers, and social media handles" }],
"metadata": {
"category": "contact",
"tags": ["email", "personal"]
},
"version": "v2"
}
] }
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({
memory_list: [
{
message_list: [{role: 'user', content: 'I prefer dark mode for all applications'}],
user_id: 'user_001',
agent_id: 'agent_assistant',
app_id: 'settings_app',
run_id: 'run_12345',
auto_infer: true,
background_processing: true,
category_definitions: [
{
ui_preferences: 'Tracks user interface settings and visual preferences including themes, colors, and display options'
}
],
metadata: {category: 'preferences', tags: ['ui', 'settings']},
version: 'v2'
},
{
message_list: [
{role: 'user', content: 'My favorite programming language is Python'},
{
role: 'assistant',
content: 'I\'ve noted that Python is your favorite programming language.'
}
],
user_id: 'user_001',
agent_id: 'agent_assistant',
app_id: 'dev_app',
run_id: 'run_12346',
auto_infer: true,
background_processing: true,
category_definitions: [
{
technical_skills: 'Tracks programming languages, frameworks, tools and technical expertise levels'
}
],
metadata: {category: 'preferences', tags: ['programming', 'development']},
version: 'v2'
},
{
message_list: [{role: 'user', content: 'I have a meeting every Monday at 9 AM'}],
user_id: 'user_001',
agent_id: 'agent_calendar',
app_id: 'calendar_app',
run_id: 'run_12347',
auto_infer: true,
background_processing: false,
category_definitions: [
{
schedule_management: 'Tracks recurring events, meetings, appointments and time commitments'
}
],
processing_instructions: 'Store all calendar events with timezone information',
metadata: {category: 'schedule', tags: ['calendar', 'recurring']},
version: 'v2'
},
{
message_list: [
{
role: 'user',
content: 'I\'m working on a machine learning project using TensorFlow'
}
],
user_id: 'user_001',
agent_id: 'agent_assistant',
app_id: 'project_app',
run_id: 'run_12348',
auto_infer: true,
background_processing: true,
include_preferences: 'project details, technologies, status',
category_definitions: [
{
project_tracking: 'Tracks active and past projects including technologies used, status, and objectives'
}
],
metadata: {category: 'projects', tags: ['ml', 'tensorflow', 'current']},
version: 'v2'
},
{
message_list: [{role: 'user', content: 'My email is user@example.com'}],
user_id: 'user_001',
agent_id: 'agent_assistant',
app_id: 'contact_app',
run_id: 'run_12349',
auto_infer: false,
background_processing: true,
read_only: true,
exclude_preferences: 'temporary contact info',
category_definitions: [
{
contact_information: 'Tracks permanent contact details including email, phone numbers, and social media handles'
}
],
metadata: {category: 'contact', tags: ['email', 'personal']},
version: 'v2'
}
]
})
};

fetch('https://api.klavis.ai/sandbox/mem0/{sandbox_id}/initialize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
memory_list: [
{
message_list: [{role: 'user', content: 'I prefer dark mode for all applications'}],
user_id: 'user_001',
agent_id: 'agent_assistant',
app_id: 'settings_app',
run_id: 'run_12345',
auto_infer: true,
background_processing: true,
category_definitions: [
{
ui_preferences: 'Tracks user interface settings and visual preferences including themes, colors, and display options'
}
],
metadata: {category: 'preferences', tags: ['ui', 'settings']},
version: 'v2'
},
{
message_list: [
{role: 'user', content: 'My favorite programming language is Python'},
{
role: 'assistant',
content: 'I\'ve noted that Python is your favorite programming language.'
}
],
user_id: 'user_001',
agent_id: 'agent_assistant',
app_id: 'dev_app',
run_id: 'run_12346',
auto_infer: true,
background_processing: true,
category_definitions: [
{
technical_skills: 'Tracks programming languages, frameworks, tools and technical expertise levels'
}
],
metadata: {category: 'preferences', tags: ['programming', 'development']},
version: 'v2'
},
{
message_list: [{role: 'user', content: 'I have a meeting every Monday at 9 AM'}],
user_id: 'user_001',
agent_id: 'agent_calendar',
app_id: 'calendar_app',
run_id: 'run_12347',
auto_infer: true,
background_processing: false,
category_definitions: [
{
schedule_management: 'Tracks recurring events, meetings, appointments and time commitments'
}
],
processing_instructions: 'Store all calendar events with timezone information',
metadata: {category: 'schedule', tags: ['calendar', 'recurring']},
version: 'v2'
},
{
message_list: [
{
role: 'user',
content: 'I\'m working on a machine learning project using TensorFlow'
}
],
user_id: 'user_001',
agent_id: 'agent_assistant',
app_id: 'project_app',
run_id: 'run_12348',
auto_infer: true,
background_processing: true,
include_preferences: 'project details, technologies, status',
category_definitions: [
{
project_tracking: 'Tracks active and past projects including technologies used, status, and objectives'
}
],
metadata: {category: 'projects', tags: ['ml', 'tensorflow', 'current']},
version: 'v2'
},
{
message_list: [{role: 'user', content: 'My email is user@example.com'}],
user_id: 'user_001',
agent_id: 'agent_assistant',
app_id: 'contact_app',
run_id: 'run_12349',
auto_infer: false,
background_processing: true,
read_only: true,
exclude_preferences: 'temporary contact info',
category_definitions: [
{
contact_information: 'Tracks permanent contact details including email, phone numbers, and social media handles'
}
],
metadata: {category: 'contact', tags: ['email', 'personal']},
version: 'v2'
}
]
})
};

fetch('https://api.klavis.ai/sandbox/mem0/{sandbox_id}/initialize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
{
  "sandbox_id": "<string>",
  "message": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Authorizations

Authorization
string
header
required

Your Klavis AI API key.

Path Parameters

sandbox_id
string
required

The unique sandbox identifier

Query Parameters

init_default_data
boolean
default:false

If true, use default test data for initialization

Body

application/json

Complete Mem0 sandbox data structure

memory_list
Mem0Memory · object[]

List of memories

Response

Successful Response

Response model for sandbox initialization

sandbox_id
string
required

Sandbox identifier

status
enum<string>
required

Current status

Available options:
idle,
occupied,
error
message
string
required

Initialization result message