> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sendbaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Send emails with cURL

> Send your first email from any shell, and see exactly what the API expects and returns.

## Prerequisites

* A Sendbaze [API key](https://docs.sendbaze.com/get-started/create-api-key.md)
* A [verified domain](https://docs.sendbaze.com/get-started/add-domain.md). A test key works without one, and so does the [shared test address](https://docs.sendbaze.com/get-started/test-without-a-domain.md) for emails to yourself.

## Send an email

```bash theme={"dark"}
curl https://api.sendbaze.com/v1/emails \
  -H "Authorization: Bearer $SENDBAZE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Yourshop <orders@yourshop.co.za>",
    "to": "thandi@example.com",
    "subject": "Your order #1042 has shipped",
    "html": "<p>Tracking: <b>CG123456789ZA</b></p>"
  }'
```

```json Response theme={"dark"}
{ "id": "em_01j9x7k2r4m8q3v5n6b7c8d9e0", "status": "queued", "mode": "live" }
```

## Check what happened

```bash theme={"dark"}
curl https://api.sendbaze.com/v1/emails/em_01j9x7k2r4m8q3v5n6b7c8d9e0 \
  -H "Authorization: Bearer $SENDBAZE_API_KEY"
```

```json Response theme={"dark"}
{
  "id": "em_01j9x7k2r4m8q3v5n6b7c8d9e0",
  "channel": "email",
  "class": "transactional",
  "status": "delivered",
  "to": "thandi@example.com",
  "from": "Yourshop <orders@yourshop.co.za>",
  "subject": "Your order #1042 has shipped",
  "tags": [],
  "error": null,
  "createdAt": "2026-09-22T08:14:02.114Z",
  "sentAt": "2026-09-22T08:14:02.688Z",
  "deliveredAt": "2026-09-22T08:14:04.201Z",
  "attachments": [],
  "events": [
    { "type": "queued", "occurredAt": "2026-09-22T08:14:02.114Z" },
    { "type": "sent", "occurredAt": "2026-09-22T08:14:02.688Z", "detail": { "provider": "ses" } },
    { "type": "delivered", "occurredAt": "2026-09-22T08:14:04.201Z" }
  ]
}
```

## Retry safely

Add an `Idempotency-Key`. Repeating the exact same request within 24 hours returns the original id instead of sending twice.

```bash theme={"dark"}
curl https://api.sendbaze.com/v1/emails \
  -H "Authorization: Bearer $SENDBAZE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1042-shipped" \
  -d '{ "from": "orders@yourshop.co.za", "to": "thandi@example.com", "subject": "Shipped", "text": "Tracking: CG123456789ZA" }'
```

## See an error

Send a bad address to see the error envelope. Every error has a stable `code` and, for validation problems, a `fields` map keyed by the path of each bad field.

```bash theme={"dark"}
curl https://api.sendbaze.com/v1/emails \
  -H "Authorization: Bearer $SENDBAZE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "from": "orders@yourshop.co.za", "to": ["ok@example.com", "nope"], "subject": "Hi", "text": "Hi" }'
```

```json Response (422) theme={"dark"}
{
  "error": {
    "code": "validation_error",
    "message": "The request has invalid fields.",
    "docs": "https://docs.sendbaze.com/errors#validation_error",
    "fields": { "to.1": ["must be a valid email address"] }
  }
}
```

> [card] [API reference](https://docs.sendbaze.com/api-reference/introduction.md)
>
> Every endpoint, with a playground you can call from the page.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.