Skip to main content
POST
/
sandbox
/
woocommerce
/
{sandbox_id}
/
initialize
Initialize woocommerce sandbox with data
curl --request POST \
  --url https://api.klavis.ai/sandbox/woocommerce/{sandbox_id}/initialize \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "products": [
    {
      "name": "[Sandbox] Premium Quality Tee",
      "type": "simple",
      "regular_price": "29.99",
      "description": "A high quality t-shirt for testing purposes.",
      "short_description": "Test Tee",
      "status": "publish",
      "manage_stock": false
    },
    {
      "name": "[Sandbox] Cool Hoodie",
      "type": "simple",
      "regular_price": "59.99",
      "description": "Warm and cozy hoodie.",
      "short_description": "Hoodie",
      "status": "publish",
      "manage_stock": false
    }
  ],
  "customers": [
    {
      "email": "john.doe@example.com",
      "first_name": "John",
      "last_name": "Doe",
      "username": "johndoe",
      "billing": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US",
        "email": "john.doe@example.com",
        "phone": "(555) 555-5555"
      },
      "shipping": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "",
        "address_1": "969 Market",
        "address_2": "",
        "city": "San Francisco",
        "state": "CA",
        "postcode": "94103",
        "country": "US"
      }
    }
  ],
  "orders": [
    {
      "customer_index": 0,
      "status": "processing",
      "payment_method": "bacs",
      "payment_method_title": "Direct Bank Transfer",
      "line_items": [
        {
          "product_index": 0,
          "quantity": 2
        },
        {
          "product_index": 1,
          "quantity": 1
        }
      ]
    }
  ]
}
'
import requests

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

payload = {
"products": [
{
"name": "[Sandbox] Premium Quality Tee",
"type": "simple",
"regular_price": "29.99",
"description": "A high quality t-shirt for testing purposes.",
"short_description": "Test Tee",
"status": "publish",
"manage_stock": False
},
{
"name": "[Sandbox] Cool Hoodie",
"type": "simple",
"regular_price": "59.99",
"description": "Warm and cozy hoodie.",
"short_description": "Hoodie",
"status": "publish",
"manage_stock": False
}
],
"customers": [
{
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"username": "johndoe",
"billing": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "969 Market",
"address_2": "",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US",
"email": "john.doe@example.com",
"phone": "(555) 555-5555"
},
"shipping": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "969 Market",
"address_2": "",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US"
}
}
],
"orders": [
{
"customer_index": 0,
"status": "processing",
"payment_method": "bacs",
"payment_method_title": "Direct Bank Transfer",
"line_items": [
{
"product_index": 0,
"quantity": 2
},
{
"product_index": 1,
"quantity": 1
}
]
}
]
}
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({
products: [
{
name: '[Sandbox] Premium Quality Tee',
type: 'simple',
regular_price: '29.99',
description: 'A high quality t-shirt for testing purposes.',
short_description: 'Test Tee',
status: 'publish',
manage_stock: false
},
{
name: '[Sandbox] Cool Hoodie',
type: 'simple',
regular_price: '59.99',
description: 'Warm and cozy hoodie.',
short_description: 'Hoodie',
status: 'publish',
manage_stock: false
}
],
customers: [
{
email: 'john.doe@example.com',
first_name: 'John',
last_name: 'Doe',
username: 'johndoe',
billing: {
first_name: 'John',
last_name: 'Doe',
company: '',
address_1: '969 Market',
address_2: '',
city: 'San Francisco',
state: 'CA',
postcode: '94103',
country: 'US',
email: 'john.doe@example.com',
phone: '(555) 555-5555'
},
shipping: {
first_name: 'John',
last_name: 'Doe',
company: '',
address_1: '969 Market',
address_2: '',
city: 'San Francisco',
state: 'CA',
postcode: '94103',
country: 'US'
}
}
],
orders: [
{
customer_index: 0,
status: 'processing',
payment_method: 'bacs',
payment_method_title: 'Direct Bank Transfer',
line_items: [{product_index: 0, quantity: 2}, {product_index: 1, quantity: 1}]
}
]
})
};

fetch('https://api.klavis.ai/sandbox/woocommerce/{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({
products: [
{
name: '[Sandbox] Premium Quality Tee',
type: 'simple',
regular_price: '29.99',
description: 'A high quality t-shirt for testing purposes.',
short_description: 'Test Tee',
status: 'publish',
manage_stock: false
},
{
name: '[Sandbox] Cool Hoodie',
type: 'simple',
regular_price: '59.99',
description: 'Warm and cozy hoodie.',
short_description: 'Hoodie',
status: 'publish',
manage_stock: false
}
],
customers: [
{
email: 'john.doe@example.com',
first_name: 'John',
last_name: 'Doe',
username: 'johndoe',
billing: {
first_name: 'John',
last_name: 'Doe',
company: '',
address_1: '969 Market',
address_2: '',
city: 'San Francisco',
state: 'CA',
postcode: '94103',
country: 'US',
email: 'john.doe@example.com',
phone: '(555) 555-5555'
},
shipping: {
first_name: 'John',
last_name: 'Doe',
company: '',
address_1: '969 Market',
address_2: '',
city: 'San Francisco',
state: 'CA',
postcode: '94103',
country: 'US'
}
}
],
orders: [
{
customer_index: 0,
status: 'processing',
payment_method: 'bacs',
payment_method_title: 'Direct Bank Transfer',
line_items: [{product_index: 0, quantity: 2}, {product_index: 1, quantity: 1}]
}
]
})
};

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

Products and customers are created first, then orders are created with proper references.

products
WooCommerceProduct · object[] | null

List of products to create

customers
WooCommerceCustomer · object[] | null

List of customers to create

orders
WooCommerceOrder · object[] | null

List of orders to create

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