https://api.sendbaba.com/v1
Enterprise Email API

Build with SendBaba API

Powerful, reliable email infrastructure for developers. Send transactional emails, manage campaigns, and track everything in real-time with our simple REST API.

Get Started Get API Key
99.9%
Uptime
<50ms
Response
10M+
Daily Emails
98%
Deliverability

Authentication

Authenticate your API requests using Bearer tokens

Include your API key in the Authorization header of every request:

HTTP Header
Authorization: Bearer sb_live_your_api_key_here

Keep Your Key Secure

Never expose API keys in client-side code or public repositories. Use environment variables.

API Key Types

PrefixEnvironmentDescription
sb_live_ProductionLive emails are sent to recipients
sb_test_SandboxEmails logged but not delivered

Quick Start

Send your first email in under 2 minutes

curl -X POST https://api.sendbaba.com/v1/emails/send \
  -H "Authorization: Bearer sb_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "you@yourdomain.com",
    "to": "recipient@example.com", 
    "subject": "Hello from SendBaba!",
    "html": "<h1>Welcome!</h1><p>Your first email.</p>"
  }'
import requests

response = requests.post(
    "https://api.sendbaba.com/v1/emails/send",
    headers={
        "Authorization": "Bearer sb_live_your_api_key",
        "Content-Type": "application/json"
    },
    json={
        "from": "you@yourdomain.com",
        "to": "recipient@example.com",
        "subject": "Hello from SendBaba!",
        "html": "<h1>Welcome!</h1>"
    }
)

print(response.json())
const response = await fetch('https://api.sendbaba.com/v1/emails/send', {
    method: 'POST',
    headers: {
        'Authorization': 'Bearer sb_live_your_api_key',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        from: 'you@yourdomain.com',
        to: 'recipient@example.com',
        subject: 'Hello from SendBaba!',
        html: '<h1>Welcome!</h1>'
    })
});

const data = await response.json();
console.log(data);
<?php
$ch = curl_init('https://api.sendbaba.com/v1/emails/send');

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer sb_live_your_api_key',
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'from' => 'you@yourdomain.com',
        'to' => 'recipient@example.com',
        'subject' => 'Hello from SendBaba!',
        'html' => '<h1>Welcome!</h1>'
    ])
]);

$response = curl_exec($ch);
print_r(json_decode($response));
package main

import (
    "bytes"
    "encoding/json"
    "net/http"
)

func main() {
    payload := map[string]string{
        "from":    "you@yourdomain.com",
        "to":      "recipient@example.com",
        "subject": "Hello from SendBaba!",
        "html":    "<h1>Welcome!</h1>",
    }
    
    body, _ := json.Marshal(payload)
    req, _ := http.NewRequest("POST", 
        "https://api.sendbaba.com/v1/emails/send", 
        bytes.NewBuffer(body))
    
    req.Header.Set("Authorization", "Bearer sb_live_your_api_key")
    req.Header.Set("Content-Type", "application/json")
    
    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()
}

SendBaba Send Email

Send a single transactional email

POST /v1/emails/send Send transactional email

Request Body

ParameterTypeRequiredDescription
fromstringRequiredSender email address
tostring | arrayRequiredRecipient email(s)
subjectstringRequiredEmail subject line
htmlstringOptionalHTML body content
textstringOptionalPlain text body
reply_tostringOptionalReply-to address
ccarrayOptionalCC recipients
bccarrayOptionalBCC recipients
headersobjectOptionalCustom email headers
tagsarrayOptionalTags for analytics
metadataobjectOptionalCustom metadata (returned in webhooks)

Response

202 Accepted
JSON
{
    "success": true,
    "message_id": "msg_abc123xyz789",
    "status": "queued"
}

Batch Send

Send personalized emails to multiple recipients in one request

POST /v1/emails/batch Send up to 1000 emails per request
Request Body
{
    "from": "newsletter@yourdomain.com",
    "subject": "Hello !",
    "html": "<h1>Hi </h1><p>Your code: </p>",
    "recipients": [
        {
            "email": "john@example.com",
            "data": { "first_name": "John", "code": "ABC123" }
        },
        {
            "email": "jane@example.com",
            "data": { "first_name": "Jane", "code": "XYZ789" }
        }
    ]
}

Merge Tags

Use syntax for personalization. Variables are replaced per-recipient from the data object.

Campaign API

Create and manage email campaigns programmatically

POST /v1/campaigns Create a new campaign
Request Body
{
    "name": "January Newsletter",
    "subject": "🎉 New Year, New Features!",
    "from_email": "news@yourdomain.com",
    "from_name": "Your Company",
    "html_content": "<h1>Happy New Year!</h1>...",
    "segment_id": "seg_active_users",
    "schedule_at": "2024-01-15T09:00:00Z"
}
POST /v1/campaigns/{id}/send Send a campaign immediately

Send a draft campaign immediately to all recipients in the target segment.

cURL
curl -X POST https://api.sendbaba.com/v1/campaigns/camp_123/send \
  -H "Authorization: Bearer sb_live_your_api_key"
GET /v1/campaigns/{id}/stats Get campaign statistics
Response
{
    "campaign_id": "camp_123",
    "sent": 15420,
    "delivered": 15380,
    "opened": 4250,
    "clicked": 892,
    "bounced": 40,
    "unsubscribed": 12,
    "open_rate": 27.6,
    "click_rate": 5.8
}

SMTP Relay

Use our SMTP servers for applications that don't support REST APIs

SMTP Host

smtp.sendbaba.com

Port (TLS)

587

Port (SSL)

465

Encryption

TLS / SSL

Authentication

SettingValue
UsernameYour API key (sb_live_xxx...)
PasswordYour API key (same as username)
AuthenticationLOGIN or PLAIN
const nodemailer = require('nodemailer');

const transporter = nodemailer.createTransport({
    host: 'smtp.sendbaba.com',
    port: 587,
    secure: false,
    auth: {
        user: 'sb_live_your_api_key',
        pass: 'sb_live_your_api_key'
    }
});

await transporter.sendMail({
    from: 'you@yourdomain.com',
    to: 'recipient@example.com',
    subject: 'Hello!',
    html: '<h1>Welcome</h1>'
});
use PHPMailer\PHPMailer\PHPMailer;

$mail = new PHPMailer(true);

$mail->isSMTP();
$mail->Host = 'smtp.sendbaba.com';
$mail->SMTPAuth = true;
$mail->Username = 'sb_live_your_api_key';
$mail->Password = 'sb_live_your_api_key';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;

$mail->setFrom('you@yourdomain.com');
$mail->addAddress('recipient@example.com');
$mail->Subject = 'Hello!';
$mail->Body = '<h1>Welcome</h1>';

$mail->send();
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart

msg = MIMEMultipart('alternative')
msg['Subject'] = 'Hello!'
msg['From'] = 'you@yourdomain.com'
msg['To'] = 'recipient@example.com'

html = '<h1>Welcome</h1>'
msg.attach(MIMEText(html, 'html'))

with smtplib.SMTP('smtp.sendbaba.com', 587) as server:
    server.starttls()
    server.login('sb_live_your_api_key', 'sb_live_your_api_key')
    server.send_message(msg)

Webhooks

Receive real-time notifications for email events

Event Types

EventDescriptionTrigger
email.sentEmail sent to recipient serverImmediate
email.deliveredEmail delivered to inboxReal-time
email.openedRecipient opened the emailOn open
email.clickedRecipient clicked a linkOn click
email.bouncedEmail bouncedReal-time
email.complainedMarked as spamReal-time
email.unsubscribedRecipient unsubscribedOn action
Webhook Payload
{
    "event": "email.delivered",
    "timestamp": "2024-01-15T10:30:00Z",
    "data": {
        "message_id": "msg_abc123xyz789",
        "recipient": "john@example.com",
        "subject": "Welcome!",
        "tags": ["onboarding"],
        "metadata": {
            "user_id": "usr_123"
        }
    }
}

Error Handling

Standard HTTP response codes and error formats

CodeStatusDescription
200OKRequest successful
202AcceptedRequest queued for processing
400Bad RequestInvalid parameters or payload
401UnauthorizedInvalid or missing API key
403ForbiddenInsufficient permissions
404Not FoundResource doesn't exist
429Too Many RequestsRate limit exceeded
500Server ErrorInternal error, retry later
Error Response
{
    "success": false,
    "error": {
        "code": "invalid_recipient",
        "message": "The recipient email address is invalid",
        "param": "to"
    }
}

Rate Limits

API rate limits by plan

PlanRequests/MinEmails/HourEmails/Day
Free Trial10100500
Starter601,00010,000
Business3005,00050,000
Enterprise1,000+CustomCustom

Rate Limit Headers

Check X-RateLimit-Remaining and X-RateLimit-Reset headers in responses.