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

# Initialize gmail sandbox with data

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

Initialize the sandbox with gmail-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

- GmailData — Complete Gmail sandbox data structure with all supported objects
  - `messages` GmailMessage[], nullable — List of Gmail messages to send
    - `subject` string, required — Email subject (required)
    - `to` string, required — Recipient email address (required)
    - `cc` string, nullable — CC email addresses (comma-separated)
    - `bcc` string, nullable — BCC email addresses (comma-separated)
    - `body` string, required — Email body content (required)
    - `from` string, nullable — Sender email address (optional, defaults to authenticated user)
    - `reply_to` string, nullable — Reply-to email address
    - `labels` string[], nullable — Gmail labels (e.g., INBOX, SENT, IMPORTANT)
  - `drafts` GmailDraft[], nullable — List of Gmail drafts to create
    - `subject` string, required — Draft subject (required)
    - `to` string, required — Recipient email address (required)
    - `cc` string, nullable — CC email addresses (comma-separated)
    - `bcc` string, nullable — BCC email addresses (comma-separated)
    - `body` string, required — Draft body content (required)
    - `from` string, nullable — Sender email address (optional, defaults to authenticated user)
    - `reply_to` string, nullable — Reply-to email address

## 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

---

[API](https://skmtc.net/klavis-ai/apis/klavis-ai-https-www-klavis-ai.md) · [All operations](https://skmtc.net/klavis-ai/apis/klavis-ai-https-www-klavis-ai/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/klavis-ai/klavis-ai-https-www-klavis-ai/versions/1f05ced7280f/schema)
