Skip to main content
POST
/
sandbox
/
resend
/
{sandbox_id}
/
initialize
Initialize resend sandbox with data
curl --request POST \
  --url https://api.klavis.ai/sandbox/resend/{sandbox_id}/initialize \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "contacts": [
    {
      "email": "robert.johnson@techcorp.com",
      "first_name": "Robert",
      "last_name": "Johnson",
      "unsubscribed": false
    },
    {
      "email": "maria.garcia@innovate.io",
      "first_name": "Maria",
      "last_name": "Garcia",
      "unsubscribed": false
    },
    {
      "email": "david.lee@startup.com",
      "first_name": "David",
      "last_name": "Lee",
      "unsubscribed": false
    }
  ],
  "segments": [
    {
      "name": "Premium Customers",
      "broadcasts": [
        {
          "from": "onboarding@resend.dev",
          "subject": "Exclusive Premium Member Benefits This Month",
          "name": "Premium Benefits December",
          "html": "<h1>Premium Member Exclusive</h1><p>As a valued premium member, enjoy these exclusive benefits this month...</p><ul><li>20% off all products</li><li>Early access to new features</li><li>Priority support</li></ul>",
          "text": "Premium Member Exclusive - Enjoy 20% off all products, early access to new features, and priority support this month.",
          "status": "draft"
        }
      ]
    },
    {
      "name": "Newsletter Subscribers",
      "broadcasts": [
        {
          "from": "onboarding@resend.dev",
          "subject": "ACME Monthly Newsletter - December 2025",
          "name": "December Newsletter",
          "html": "<div><h1>December Newsletter</h1><h2>What's New This Month</h2><p>Here are the highlights from December...</p><ul><li>Product updates</li><li>Customer success stories</li><li>Upcoming events</li></ul></div>",
          "text": "December Newsletter - What's New This Month: Product updates, customer success stories, and upcoming events.",
          "reply_to": "feedback@acmecorp.com",
          "status": "draft"
        }
      ]
    },
    {
      "name": "Trial Users",
      "broadcasts": [
        {
          "from": "onboarding@resend.dev",
          "subject": "Getting Started with Your Free Trial",
          "name": "Trial Onboarding Sequence",
          "html": "<h1>Welcome to Your Free Trial!</h1><p>Let's get you started with some helpful resources...</p><div><h3>Quick Start Guide</h3><ol><li>Complete your profile</li><li>Explore the dashboard</li><li>Try our key features</li></ol></div>",
          "text": "Welcome to Your Free Trial! Quick Start Guide: 1) Complete your profile 2) Explore the dashboard 3) Try our key features",
          "status": "draft"
        }
      ]
    }
  ]
}
EOF
import requests

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

payload = {
"contacts": [
{
"email": "robert.johnson@techcorp.com",
"first_name": "Robert",
"last_name": "Johnson",
"unsubscribed": False
},
{
"email": "maria.garcia@innovate.io",
"first_name": "Maria",
"last_name": "Garcia",
"unsubscribed": False
},
{
"email": "david.lee@startup.com",
"first_name": "David",
"last_name": "Lee",
"unsubscribed": False
}
],
"segments": [
{
"name": "Premium Customers",
"broadcasts": [
{
"from": "onboarding@resend.dev",
"subject": "Exclusive Premium Member Benefits This Month",
"name": "Premium Benefits December",
"html": "<h1>Premium Member Exclusive</h1><p>As a valued premium member, enjoy these exclusive benefits this month...</p><ul><li>20% off all products</li><li>Early access to new features</li><li>Priority support</li></ul>",
"text": "Premium Member Exclusive - Enjoy 20% off all products, early access to new features, and priority support this month.",
"status": "draft"
}
]
},
{
"name": "Newsletter Subscribers",
"broadcasts": [
{
"from": "onboarding@resend.dev",
"subject": "ACME Monthly Newsletter - December 2025",
"name": "December Newsletter",
"html": "<div><h1>December Newsletter</h1><h2>What's New This Month</h2><p>Here are the highlights from December...</p><ul><li>Product updates</li><li>Customer success stories</li><li>Upcoming events</li></ul></div>",
"text": "December Newsletter - What's New This Month: Product updates, customer success stories, and upcoming events.",
"reply_to": "feedback@acmecorp.com",
"status": "draft"
}
]
},
{
"name": "Trial Users",
"broadcasts": [
{
"from": "onboarding@resend.dev",
"subject": "Getting Started with Your Free Trial",
"name": "Trial Onboarding Sequence",
"html": "<h1>Welcome to Your Free Trial!</h1><p>Let's get you started with some helpful resources...</p><div><h3>Quick Start Guide</h3><ol><li>Complete your profile</li><li>Explore the dashboard</li><li>Try our key features</li></ol></div>",
"text": "Welcome to Your Free Trial! Quick Start Guide: 1) Complete your profile 2) Explore the dashboard 3) Try our key features",
"status": "draft"
}
]
}
]
}
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({
contacts: [
{
email: 'robert.johnson@techcorp.com',
first_name: 'Robert',
last_name: 'Johnson',
unsubscribed: false
},
{
email: 'maria.garcia@innovate.io',
first_name: 'Maria',
last_name: 'Garcia',
unsubscribed: false
},
{
email: 'david.lee@startup.com',
first_name: 'David',
last_name: 'Lee',
unsubscribed: false
}
],
segments: [
{
name: 'Premium Customers',
broadcasts: [
{
from: 'onboarding@resend.dev',
subject: 'Exclusive Premium Member Benefits This Month',
name: 'Premium Benefits December',
html: '<h1>Premium Member Exclusive</h1><p>As a valued premium member, enjoy these exclusive benefits this month...</p><ul><li>20% off all products</li><li>Early access to new features</li><li>Priority support</li></ul>',
text: 'Premium Member Exclusive - Enjoy 20% off all products, early access to new features, and priority support this month.',
status: 'draft'
}
]
},
{
name: 'Newsletter Subscribers',
broadcasts: [
{
from: 'onboarding@resend.dev',
subject: 'ACME Monthly Newsletter - December 2025',
name: 'December Newsletter',
html: '<div><h1>December Newsletter</h1><h2>What\'s New This Month</h2><p>Here are the highlights from December...</p><ul><li>Product updates</li><li>Customer success stories</li><li>Upcoming events</li></ul></div>',
text: 'December Newsletter - What\'s New This Month: Product updates, customer success stories, and upcoming events.',
reply_to: 'feedback@acmecorp.com',
status: 'draft'
}
]
},
{
name: 'Trial Users',
broadcasts: [
{
from: 'onboarding@resend.dev',
subject: 'Getting Started with Your Free Trial',
name: 'Trial Onboarding Sequence',
html: '<h1>Welcome to Your Free Trial!</h1><p>Let\'s get you started with some helpful resources...</p><div><h3>Quick Start Guide</h3><ol><li>Complete your profile</li><li>Explore the dashboard</li><li>Try our key features</li></ol></div>',
text: 'Welcome to Your Free Trial! Quick Start Guide: 1) Complete your profile 2) Explore the dashboard 3) Try our key features',
status: 'draft'
}
]
}
]
})
};

fetch('https://api.klavis.ai/sandbox/resend/{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({
contacts: [
{
email: 'robert.johnson@techcorp.com',
first_name: 'Robert',
last_name: 'Johnson',
unsubscribed: false
},
{
email: 'maria.garcia@innovate.io',
first_name: 'Maria',
last_name: 'Garcia',
unsubscribed: false
},
{
email: 'david.lee@startup.com',
first_name: 'David',
last_name: 'Lee',
unsubscribed: false
}
],
segments: [
{
name: 'Premium Customers',
broadcasts: [
{
from: 'onboarding@resend.dev',
subject: 'Exclusive Premium Member Benefits This Month',
name: 'Premium Benefits December',
html: '<h1>Premium Member Exclusive</h1><p>As a valued premium member, enjoy these exclusive benefits this month...</p><ul><li>20% off all products</li><li>Early access to new features</li><li>Priority support</li></ul>',
text: 'Premium Member Exclusive - Enjoy 20% off all products, early access to new features, and priority support this month.',
status: 'draft'
}
]
},
{
name: 'Newsletter Subscribers',
broadcasts: [
{
from: 'onboarding@resend.dev',
subject: 'ACME Monthly Newsletter - December 2025',
name: 'December Newsletter',
html: '<div><h1>December Newsletter</h1><h2>What\'s New This Month</h2><p>Here are the highlights from December...</p><ul><li>Product updates</li><li>Customer success stories</li><li>Upcoming events</li></ul></div>',
text: 'December Newsletter - What\'s New This Month: Product updates, customer success stories, and upcoming events.',
reply_to: 'feedback@acmecorp.com',
status: 'draft'
}
]
},
{
name: 'Trial Users',
broadcasts: [
{
from: 'onboarding@resend.dev',
subject: 'Getting Started with Your Free Trial',
name: 'Trial Onboarding Sequence',
html: '<h1>Welcome to Your Free Trial!</h1><p>Let\'s get you started with some helpful resources...</p><div><h3>Quick Start Guide</h3><ol><li>Complete your profile</li><li>Explore the dashboard</li><li>Try our key features</li></ol></div>',
text: 'Welcome to Your Free Trial! Quick Start Guide: 1) Complete your profile 2) Explore the dashboard 3) Try our key features',
status: 'draft'
}
]
}
]
})
};

fetch('https://api.klavis.ai/sandbox/resend/{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 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
ResendEmail · object[] | null

List of standalone transactional emails

contacts
ResendContact · object[] | null

List of standalone contacts

segments
ResendSegment · object[] | null

List of segments with nested broadcasts

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