Skip to main content
POST
/
sandbox
/
supabase
/
{sandbox_id}
/
initialize
Initialize supabase sandbox with data
curl --request POST \
  --url https://api.klavis.ai/sandbox/supabase/{sandbox_id}/initialize \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "projects": [
    {
      "name": "test-project",
      "tables": [
        {
          "name": "users",
          "columns": {
            "email": "TEXT",
            "name": "TEXT",
            "age": "INTEGER",
            "is_active": "BOOLEAN",
            "balance": "REAL",
            "avatar_url": "TEXT",
            "roles": "JSONB",
            "metadata": "JSONB",
            "created_at": "TEXT"
          },
          "rows": [
            {
              "id": 1,
              "email": "john@example.com",
              "name": "John Doe",
              "age": 30,
              "is_active": true,
              "balance": 1250.5,
              "roles": [
                "admin",
                "user"
              ],
              "metadata": {
                "last_login": "2024-01-15T10:00:00Z",
                "login_count": 42
              },
              "created_at": "2024-01-01T10:00:00Z"
            },
            {
              "id": 2,
              "email": "jane@example.com",
              "name": "Jane Smith",
              "age": 28,
              "is_active": true,
              "balance": 3500.75,
              "avatar_url": "https://example.com/avatars/jane.jpg",
              "roles": [
                "user"
              ],
              "metadata": {
                "last_login": "2024-01-16T11:30:00Z",
                "login_count": 156
              },
              "created_at": "2024-01-02T11:30:00Z"
            },
            {
              "id": 3,
              "email": "bob@example.com",
              "name": "Bob Johnson",
              "age": 45,
              "is_active": false,
              "balance": 0,
              "roles": [
                "user",
                "moderator"
              ],
              "metadata": {
                "last_login": "2023-12-20T09:15:00Z",
                "login_count": 8
              },
              "created_at": "2024-01-03T09:15:00Z"
            }
          ]
        },
        {
          "name": "posts",
          "columns": {
            "title": "TEXT",
            "content": "TEXT",
            "author_id": "INTEGER",
            "view_count": "INTEGER",
            "like_count": "INTEGER",
            "is_published": "BOOLEAN",
            "is_featured": "BOOLEAN",
            "tags": "JSONB",
            "rating": "REAL",
            "settings": "JSONB",
            "created_at": "TEXT",
            "updated_at": "TEXT"
          },
          "rows": [
            {
              "id": 101,
              "title": "First Post",
              "content": "This is my first post!",
              "author_id": 1,
              "view_count": 245,
              "like_count": 18,
              "is_published": true,
              "is_featured": false,
              "tags": [
                "introduction",
                "welcome"
              ],
              "rating": 4.5,
              "settings": {
                "allow_comments": true,
                "notify_author": true
              },
              "created_at": "2024-01-01T12:00:00Z"
            },
            {
              "id": 102,
              "title": "Hello World",
              "content": "Welcome to my blog",
              "author_id": 2,
              "view_count": 1032,
              "like_count": 67,
              "is_published": true,
              "is_featured": true,
              "tags": [
                "blog",
                "announcement",
                "community"
              ],
              "rating": 4.8,
              "settings": {
                "allow_comments": true,
                "notify_author": false
              },
              "created_at": "2024-01-02T14:30:00Z",
              "updated_at": "2024-01-05T09:20:00Z"
            }
          ]
        }
      ]
    },
    {
      "name": "analytics-project",
      "tables": [
        {
          "name": "events",
          "columns": {
            "event_name": "TEXT",
            "user_id": "INTEGER",
            "user_agent": "TEXT",
            "duration_ms": "INTEGER",
            "is_bot": "BOOLEAN",
            "coordinates": "JSONB",
            "timestamp": "TEXT"
          },
          "rows": [
            {
              "id": 5001,
              "event_name": "page_view",
              "user_id": 1,
              "user_agent": "Mozilla/5.0",
              "duration_ms": 3450,
              "is_bot": false,
              "coordinates": {
                "latitude": 37.7749,
                "longitude": -122.4194
              },
              "timestamp": "2024-01-01T08:00:00Z"
            },
            {
              "id": 5002,
              "event_name": "click",
              "user_id": 2,
              "user_agent": "Chrome/120.0",
              "is_bot": false,
              "coordinates": {
                "latitude": 40.7128,
                "longitude": -74.006
              },
              "timestamp": "2024-01-01T08:15:00Z"
            }
          ]
        },
        {
          "name": "metrics",
          "columns": {
            "metric_name": "TEXT",
            "value": "INTEGER",
            "percentage": "REAL",
            "is_trending": "BOOLEAN",
            "change_rate": "REAL",
            "thresholds": "JSONB",
            "recorded_at": "TEXT"
          },
          "rows": [
            {
              "id": 1,
              "metric_name": "total_visits",
              "value": 1250,
              "is_trending": true,
              "change_rate": 15.5,
              "thresholds": {
                "warning": 1000,
                "critical": 500
              },
              "recorded_at": "2024-01-01T00:00:00Z"
            },
            {
              "id": 2,
              "metric_name": "bounce_rate",
              "value": 35,
              "percentage": 0.35,
              "is_trending": false,
              "change_rate": -2.3,
              "thresholds": {
                "warning": 50,
                "critical": 70
              },
              "recorded_at": "2024-01-01T00:00:00Z"
            },
            {
              "id": 3,
              "metric_name": "avg_session_duration",
              "value": 180,
              "is_trending": true,
              "change_rate": 8.7,
              "thresholds": {
                "warning": 120,
                "critical": 60
              },
              "recorded_at": "2024-01-01T00:00:00Z"
            }
          ]
        }
      ]
    }
  ]
}
'
import requests

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

payload = { "projects": [
{
"name": "test-project",
"tables": [
{
"name": "users",
"columns": {
"email": "TEXT",
"name": "TEXT",
"age": "INTEGER",
"is_active": "BOOLEAN",
"balance": "REAL",
"avatar_url": "TEXT",
"roles": "JSONB",
"metadata": "JSONB",
"created_at": "TEXT"
},
"rows": [
{
"id": 1,
"email": "john@example.com",
"name": "John Doe",
"age": 30,
"is_active": True,
"balance": 1250.5,
"roles": ["admin", "user"],
"metadata": {
"last_login": "2024-01-15T10:00:00Z",
"login_count": 42
},
"created_at": "2024-01-01T10:00:00Z"
},
{
"id": 2,
"email": "jane@example.com",
"name": "Jane Smith",
"age": 28,
"is_active": True,
"balance": 3500.75,
"avatar_url": "https://example.com/avatars/jane.jpg",
"roles": ["user"],
"metadata": {
"last_login": "2024-01-16T11:30:00Z",
"login_count": 156
},
"created_at": "2024-01-02T11:30:00Z"
},
{
"id": 3,
"email": "bob@example.com",
"name": "Bob Johnson",
"age": 45,
"is_active": False,
"balance": 0,
"roles": ["user", "moderator"],
"metadata": {
"last_login": "2023-12-20T09:15:00Z",
"login_count": 8
},
"created_at": "2024-01-03T09:15:00Z"
}
]
},
{
"name": "posts",
"columns": {
"title": "TEXT",
"content": "TEXT",
"author_id": "INTEGER",
"view_count": "INTEGER",
"like_count": "INTEGER",
"is_published": "BOOLEAN",
"is_featured": "BOOLEAN",
"tags": "JSONB",
"rating": "REAL",
"settings": "JSONB",
"created_at": "TEXT",
"updated_at": "TEXT"
},
"rows": [
{
"id": 101,
"title": "First Post",
"content": "This is my first post!",
"author_id": 1,
"view_count": 245,
"like_count": 18,
"is_published": True,
"is_featured": False,
"tags": ["introduction", "welcome"],
"rating": 4.5,
"settings": {
"allow_comments": True,
"notify_author": True
},
"created_at": "2024-01-01T12:00:00Z"
},
{
"id": 102,
"title": "Hello World",
"content": "Welcome to my blog",
"author_id": 2,
"view_count": 1032,
"like_count": 67,
"is_published": True,
"is_featured": True,
"tags": ["blog", "announcement", "community"],
"rating": 4.8,
"settings": {
"allow_comments": True,
"notify_author": False
},
"created_at": "2024-01-02T14:30:00Z",
"updated_at": "2024-01-05T09:20:00Z"
}
]
}
]
},
{
"name": "analytics-project",
"tables": [
{
"name": "events",
"columns": {
"event_name": "TEXT",
"user_id": "INTEGER",
"user_agent": "TEXT",
"duration_ms": "INTEGER",
"is_bot": "BOOLEAN",
"coordinates": "JSONB",
"timestamp": "TEXT"
},
"rows": [
{
"id": 5001,
"event_name": "page_view",
"user_id": 1,
"user_agent": "Mozilla/5.0",
"duration_ms": 3450,
"is_bot": False,
"coordinates": {
"latitude": 37.7749,
"longitude": -122.4194
},
"timestamp": "2024-01-01T08:00:00Z"
},
{
"id": 5002,
"event_name": "click",
"user_id": 2,
"user_agent": "Chrome/120.0",
"is_bot": False,
"coordinates": {
"latitude": 40.7128,
"longitude": -74.006
},
"timestamp": "2024-01-01T08:15:00Z"
}
]
},
{
"name": "metrics",
"columns": {
"metric_name": "TEXT",
"value": "INTEGER",
"percentage": "REAL",
"is_trending": "BOOLEAN",
"change_rate": "REAL",
"thresholds": "JSONB",
"recorded_at": "TEXT"
},
"rows": [
{
"id": 1,
"metric_name": "total_visits",
"value": 1250,
"is_trending": True,
"change_rate": 15.5,
"thresholds": {
"warning": 1000,
"critical": 500
},
"recorded_at": "2024-01-01T00:00:00Z"
},
{
"id": 2,
"metric_name": "bounce_rate",
"value": 35,
"percentage": 0.35,
"is_trending": False,
"change_rate": -2.3,
"thresholds": {
"warning": 50,
"critical": 70
},
"recorded_at": "2024-01-01T00:00:00Z"
},
{
"id": 3,
"metric_name": "avg_session_duration",
"value": 180,
"is_trending": True,
"change_rate": 8.7,
"thresholds": {
"warning": 120,
"critical": 60
},
"recorded_at": "2024-01-01T00:00:00Z"
}
]
}
]
}
] }
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({
projects: [
{
name: 'test-project',
tables: [
{
name: 'users',
columns: {
email: 'TEXT',
name: 'TEXT',
age: 'INTEGER',
is_active: 'BOOLEAN',
balance: 'REAL',
avatar_url: 'TEXT',
roles: 'JSONB',
metadata: 'JSONB',
created_at: 'TEXT'
},
rows: [
{
id: 1,
email: 'john@example.com',
name: 'John Doe',
age: 30,
is_active: true,
balance: 1250.5,
roles: ['admin', 'user'],
metadata: {last_login: '2024-01-15T10:00:00Z', login_count: 42},
created_at: '2024-01-01T10:00:00Z'
},
{
id: 2,
email: 'jane@example.com',
name: 'Jane Smith',
age: 28,
is_active: true,
balance: 3500.75,
avatar_url: 'https://example.com/avatars/jane.jpg',
roles: ['user'],
metadata: {last_login: '2024-01-16T11:30:00Z', login_count: 156},
created_at: '2024-01-02T11:30:00Z'
},
{
id: 3,
email: 'bob@example.com',
name: 'Bob Johnson',
age: 45,
is_active: false,
balance: 0,
roles: ['user', 'moderator'],
metadata: {last_login: '2023-12-20T09:15:00Z', login_count: 8},
created_at: '2024-01-03T09:15:00Z'
}
]
},
{
name: 'posts',
columns: {
title: 'TEXT',
content: 'TEXT',
author_id: 'INTEGER',
view_count: 'INTEGER',
like_count: 'INTEGER',
is_published: 'BOOLEAN',
is_featured: 'BOOLEAN',
tags: 'JSONB',
rating: 'REAL',
settings: 'JSONB',
created_at: 'TEXT',
updated_at: 'TEXT'
},
rows: [
{
id: 101,
title: 'First Post',
content: 'This is my first post!',
author_id: 1,
view_count: 245,
like_count: 18,
is_published: true,
is_featured: false,
tags: ['introduction', 'welcome'],
rating: 4.5,
settings: {allow_comments: true, notify_author: true},
created_at: '2024-01-01T12:00:00Z'
},
{
id: 102,
title: 'Hello World',
content: 'Welcome to my blog',
author_id: 2,
view_count: 1032,
like_count: 67,
is_published: true,
is_featured: true,
tags: ['blog', 'announcement', 'community'],
rating: 4.8,
settings: {allow_comments: true, notify_author: false},
created_at: '2024-01-02T14:30:00Z',
updated_at: '2024-01-05T09:20:00Z'
}
]
}
]
},
{
name: 'analytics-project',
tables: [
{
name: 'events',
columns: {
event_name: 'TEXT',
user_id: 'INTEGER',
user_agent: 'TEXT',
duration_ms: 'INTEGER',
is_bot: 'BOOLEAN',
coordinates: 'JSONB',
timestamp: 'TEXT'
},
rows: [
{
id: 5001,
event_name: 'page_view',
user_id: 1,
user_agent: 'Mozilla/5.0',
duration_ms: 3450,
is_bot: false,
coordinates: {latitude: 37.7749, longitude: -122.4194},
timestamp: '2024-01-01T08:00:00Z'
},
{
id: 5002,
event_name: 'click',
user_id: 2,
user_agent: 'Chrome/120.0',
is_bot: false,
coordinates: {latitude: 40.7128, longitude: -74.006},
timestamp: '2024-01-01T08:15:00Z'
}
]
},
{
name: 'metrics',
columns: {
metric_name: 'TEXT',
value: 'INTEGER',
percentage: 'REAL',
is_trending: 'BOOLEAN',
change_rate: 'REAL',
thresholds: 'JSONB',
recorded_at: 'TEXT'
},
rows: [
{
id: 1,
metric_name: 'total_visits',
value: 1250,
is_trending: true,
change_rate: 15.5,
thresholds: {warning: 1000, critical: 500},
recorded_at: '2024-01-01T00:00:00Z'
},
{
id: 2,
metric_name: 'bounce_rate',
value: 35,
percentage: 0.35,
is_trending: false,
change_rate: -2.3,
thresholds: {warning: 50, critical: 70},
recorded_at: '2024-01-01T00:00:00Z'
},
{
id: 3,
metric_name: 'avg_session_duration',
value: 180,
is_trending: true,
change_rate: 8.7,
thresholds: {warning: 120, critical: 60},
recorded_at: '2024-01-01T00:00:00Z'
}
]
}
]
}
]
})
};

fetch('https://api.klavis.ai/sandbox/supabase/{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({
projects: [
{
name: 'test-project',
tables: [
{
name: 'users',
columns: {
email: 'TEXT',
name: 'TEXT',
age: 'INTEGER',
is_active: 'BOOLEAN',
balance: 'REAL',
avatar_url: 'TEXT',
roles: 'JSONB',
metadata: 'JSONB',
created_at: 'TEXT'
},
rows: [
{
id: 1,
email: 'john@example.com',
name: 'John Doe',
age: 30,
is_active: true,
balance: 1250.5,
roles: ['admin', 'user'],
metadata: {last_login: '2024-01-15T10:00:00Z', login_count: 42},
created_at: '2024-01-01T10:00:00Z'
},
{
id: 2,
email: 'jane@example.com',
name: 'Jane Smith',
age: 28,
is_active: true,
balance: 3500.75,
avatar_url: 'https://example.com/avatars/jane.jpg',
roles: ['user'],
metadata: {last_login: '2024-01-16T11:30:00Z', login_count: 156},
created_at: '2024-01-02T11:30:00Z'
},
{
id: 3,
email: 'bob@example.com',
name: 'Bob Johnson',
age: 45,
is_active: false,
balance: 0,
roles: ['user', 'moderator'],
metadata: {last_login: '2023-12-20T09:15:00Z', login_count: 8},
created_at: '2024-01-03T09:15:00Z'
}
]
},
{
name: 'posts',
columns: {
title: 'TEXT',
content: 'TEXT',
author_id: 'INTEGER',
view_count: 'INTEGER',
like_count: 'INTEGER',
is_published: 'BOOLEAN',
is_featured: 'BOOLEAN',
tags: 'JSONB',
rating: 'REAL',
settings: 'JSONB',
created_at: 'TEXT',
updated_at: 'TEXT'
},
rows: [
{
id: 101,
title: 'First Post',
content: 'This is my first post!',
author_id: 1,
view_count: 245,
like_count: 18,
is_published: true,
is_featured: false,
tags: ['introduction', 'welcome'],
rating: 4.5,
settings: {allow_comments: true, notify_author: true},
created_at: '2024-01-01T12:00:00Z'
},
{
id: 102,
title: 'Hello World',
content: 'Welcome to my blog',
author_id: 2,
view_count: 1032,
like_count: 67,
is_published: true,
is_featured: true,
tags: ['blog', 'announcement', 'community'],
rating: 4.8,
settings: {allow_comments: true, notify_author: false},
created_at: '2024-01-02T14:30:00Z',
updated_at: '2024-01-05T09:20:00Z'
}
]
}
]
},
{
name: 'analytics-project',
tables: [
{
name: 'events',
columns: {
event_name: 'TEXT',
user_id: 'INTEGER',
user_agent: 'TEXT',
duration_ms: 'INTEGER',
is_bot: 'BOOLEAN',
coordinates: 'JSONB',
timestamp: 'TEXT'
},
rows: [
{
id: 5001,
event_name: 'page_view',
user_id: 1,
user_agent: 'Mozilla/5.0',
duration_ms: 3450,
is_bot: false,
coordinates: {latitude: 37.7749, longitude: -122.4194},
timestamp: '2024-01-01T08:00:00Z'
},
{
id: 5002,
event_name: 'click',
user_id: 2,
user_agent: 'Chrome/120.0',
is_bot: false,
coordinates: {latitude: 40.7128, longitude: -74.006},
timestamp: '2024-01-01T08:15:00Z'
}
]
},
{
name: 'metrics',
columns: {
metric_name: 'TEXT',
value: 'INTEGER',
percentage: 'REAL',
is_trending: 'BOOLEAN',
change_rate: 'REAL',
thresholds: 'JSONB',
recorded_at: 'TEXT'
},
rows: [
{
id: 1,
metric_name: 'total_visits',
value: 1250,
is_trending: true,
change_rate: 15.5,
thresholds: {warning: 1000, critical: 500},
recorded_at: '2024-01-01T00:00:00Z'
},
{
id: 2,
metric_name: 'bounce_rate',
value: 35,
percentage: 0.35,
is_trending: false,
change_rate: -2.3,
thresholds: {warning: 50, critical: 70},
recorded_at: '2024-01-01T00:00:00Z'
},
{
id: 3,
metric_name: 'avg_session_duration',
value: 180,
is_trending: true,
change_rate: 8.7,
thresholds: {warning: 120, critical: 60},
recorded_at: '2024-01-01T00:00:00Z'
}
]
}
]
}
]
})
};

fetch('https://api.klavis.ai/sandbox/supabase/{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 Supabase sandbox data structure

projects
SupabaseProject · object[]

List of Supabase projects

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