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

# Initialize resend sandbox with data

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

## Request

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

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

- ResendDataInput: Complete Resend sandbox data structure. Mixed structure: - Segments contain nested Broadcasts (broadcasts MUST have a segment) - Emails are standalone (transactional) - Contacts are standalone (can be optionally linked to segments)
  - `emails` ResendEmailInput[], nullable: List of standalone transactional emails
    - `id` string, nullable: Email ID (read-only, set by Resend)
    - `from` string, required: Sender email address
    - `to` string[], required: Recipient email addresses
    - `subject` string, required: Email subject
    - `html` string, nullable: HTML content of the email
    - `text` string, nullable: Plain text content of the email
    - `reply_to` string, nullable: Reply-to email address
    - `cc` string[], nullable: CC email addresses
    - `bcc` string[], nullable: BCC email addresses
    - `tags` object[], nullable: Email tags for categorization
    - `created_at` string, nullable: Creation timestamp
  - `contacts` ResendContactInput[], nullable: List of standalone contacts
    - `id` string, nullable: Contact ID (read-only, set by Resend)
    - `email` string, required: The email address of the contact.
    - `first_name` string, nullable: Contact first name
    - `last_name` string, nullable: Contact last name
    - `unsubscribed` boolean, nullable: Whether contact is unsubscribed from all Broadcasts
    - `created_at` string, nullable: Creation timestamp
  - `segments` ResendSegmentInput[], nullable: List of segments with nested broadcasts
    - `id` string, nullable: Segment ID (read-only, set by Resend)
    - `name` string, required: Segment name
    - `created_at` string, nullable: Creation timestamp
    - `broadcasts` ResendBroadcastInput[], nullable: Broadcasts sent to this segment
      - `id` string, nullable: Broadcast ID (read-only, set by Resend)
      - `from` string, required: Sender email with optional display name
      - `subject` string, required: Email subject
      - `name` string, nullable: Broadcast name for internal reference
      - `html` string, nullable: HTML content
      - `text` string, nullable: Plain text content
      - `reply_to` string, nullable: Reply-to email address
      - `status` string, nullable: Broadcast status (draft, sent, etc.)
      - `created_at` string, nullable: Creation timestamp
      - `scheduled_at` string, nullable: Scheduled send timestamp
      - `sent_at` string, nullable: Actual send timestamp
      - `topic_id` string, nullable: Topic ID for scoping

## 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/resend/: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)
