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

# Quickstart

> Send your first transactional email with the Dugble API

This guide takes you from a team token to a queued transactional email.

## Prerequisites

Before you begin, you need:

* A Dugble account and team
* A team token with the `email:send` permission
* A configured and verified sender domain, or a configured default sender
* `curl` or another HTTP client

<Note>
  Keep team tokens on your server. Never expose them in browser or mobile application code.
</Note>

## 1. Store your team token

```bash theme={null}
export DUGBLE_API_KEY="replace-with-your-team-token"
```

## 2. Send an email

Use a unique idempotency key for every logical send. Reusing the same key for a retry prevents the same logical request from being processed twice.

```bash theme={null}
curl --request POST \
  --url https://api.dugble.com/emails \
  --header "Authorization: Bearer $DUGBLE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: quickstart-$(date +%s)" \
  --data '{
    "to": "Ada Lovelace <ada@example.com>",
    "subject": "Hello from Dugble",
    "html": "<h1>Your Dugble integration works</h1><p>This message was queued through the API.</p>",
    "text": "Your Dugble integration works. This message was queued through the API."
  }'
```

A successful request returns `202 Accepted` with the Dugble message ID:

```json theme={null}
{
  "success": true,
  "data": {
    "object": "email",
    "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"
  }
}
```

`202 Accepted` means Dugble accepted the message for asynchronous delivery. It does not mean the recipient's mail server has delivered it.

## 3. Check delivery status

Use the returned message ID:

```bash theme={null}
curl --request GET \
  --url https://api.dugble.com/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 \
  --header "Authorization: Bearer $DUGBLE_API_KEY"
```

The retrieve response exposes the latest delivery state through `last_event`. The lifecycle can include `queued`, `processing`, `submitted`, `delivered`, `delayed`, `bounced`, `complained`, `rejected`, `failed`, or `canceled`.

## Next steps

<CardGroup cols={2}>
  <Card title="Email" icon="envelope" href="/docs/emails/introduction">
    Learn about recipients, content, scheduling, batches, headers, and delivery status.
  </Card>

  <Card title="Authentication" icon="key" href="/docs/authentication">
    Learn how team tokens and permissions protect API requests.
  </Card>

  <Card title="SMS" icon="message-sms" href="/docs/sms/introduction">
    Send transactional SMS using the same team-token model.
  </Card>

  <Card title="Sender domains" icon="globe" href="/docs/domains/introduction">
    Configure and authenticate the domains used for outbound email.
  </Card>
</CardGroup>

<Tip>
  Need help? Contact [support@dugble.com](mailto:support@dugble.com).
</Tip>
