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

# Initialize postgres sandbox with data

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

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

- PostgresDataInput — Complete Postgres sandbox data structure
  - `schemas` PostgresSchema[] — List of Postgres schemas
    - `name` string, required — Schema name
    - `tables` PostgresTable[], nullable — List of tables in the schema
      - `name` string, required — Table name
      - `columns` object, required — Table schema mapping column names to types
      - `rows` object[], nullable — Table data rows

## 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/revisions/1f05ced7280f/schema)
