---
title: "Initialize mem0 sandbox with data"
method: POST
path: "/sandbox/mem0/{sandbox_id}/initialize"
tags: ["sandbox"]
---

# Initialize mem0 sandbox with data

`POST /sandbox/mem0/{sandbox_id}/initialize`

## Request

- Base URL: `https://api.klavis.ai`
- URL: `https://api.klavis.ai/sandbox/mem0/{sandbox_id}/initialize`
- Auth: HTTP bearer

Initialize the sandbox with mem0-specific data following the defined schema.

## Path parameters

- `sandbox_id` string, required: The unique sandbox identifier

## Query parameters

- `init_default_data` boolean: If true, use default test data for initialization

## Request body

- Mem0DataInput: Complete Mem0 sandbox data structure
  - `memory_list` Mem0Memory[]: List of memories
    - `id` string, nullable: Memory ID (read-only, set by Mem0)
    - `content_text` string, nullable: Memory content (returned from API)
    - `message_list` Mem0Message[], nullable: Array of message objects representing the content
      - `role` string, required: Role of the message sender (user or assistant)
      - `content` string, required: Content of the message
    - `agent_id` string, nullable: Agent ID
    - `user_id` string, nullable: User ID
    - `app_id` string, nullable: App ID
    - `run_id` string, nullable: Run ID
    - `metadata` object, nullable: Additional metadata
    - `include_preferences` string, nullable: String to include specific preferences in the memory
    - `exclude_preferences` string, nullable: String to exclude specific preferences in the memory
    - `auto_infer` boolean: Whether to infer memories or directly store messages
    - `response_format` string, nullable: Response format structure (v1.0 or v1.1)
    - `category_definitions` object[], nullable: List of custom categories with name and description
    - `processing_instructions` string, nullable: Project-specific guidelines for handling memories
    - `read_only` boolean: Whether the memory is immutable
    - `background_processing` boolean: Whether to add memory asynchronously
    - `timestamp` integer, nullable: Unix timestamp of the memory
    - `created_at` string, nullable: Creation timestamp
    - `updated_at` string, nullable: Last update timestamp

## Response `200`

Successful Response

- InitializeSandboxResponse: Response model for sandbox initialization
  - `sandbox_id` string, required: Sandbox identifier
  - `status` 'idle' | 'occupied' | 'error', required: Status of a sandbox instance - matches database enum
  - `message` string, required: Initialization result message

## Other responses

- `422`: Validation Error

## Changes

- **2026-02-09** `522418a391e5`: 1 warning
  - removed the optional property `records_created` from the response with the `200` status
- **2026-02-08** `d70b82139caa`: 2 info
  - added the optional property `detail/items/ctx` to the response with the `422` status
  - added the optional property `detail/items/input` to the response with the `422` status
- **2026-01-31** `4457a0cdcfab`: 1 warning
  - added the new `error` enum value to the `status` response property for the response status `200`

[Operation history](https://skmtc.dev/klavis-ai/apis/klavis-ai-https-www-klavis-ai/changes/sandbox/mem0/:sandbox_id/initialize/post.md)

---

[API](https://skmtc.dev/klavis-ai/apis/klavis-ai-https-www-klavis-ai.md) - [All operations](https://skmtc.dev/klavis-ai/apis/klavis-ai-https-www-klavis-ai/llms.txt) - [OpenAPI document](https://skmtc.dev/klavis-ai/apis/klavis-ai-https-www-klavis-ai/revisions/1f05ced7280f?raw)
