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

# Introduction

> Complete reference for the Lettr REST API, with resource-oriented URLs, JSON requests and responses, Bearer authentication, and HTTP codes.

The Lettr API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

## Base URL

```
https://app.lettr.com/api/
```

## Authentication

Authenticate requests using an API key in the Authorization header:

```bash theme={null}
curl https://app.lettr.com/api/emails \
  -H "Authorization: Bearer lttr_xxxxxxxxxxxx"
```

## Request Format

Send JSON-encoded bodies with the appropriate Content-Type header:

```bash theme={null}
curl -X POST https://app.lettr.com/api/emails \
  -H "Authorization: Bearer lttr_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"from": "you@yourdomain.com", "to": ["recipient@example.com"], "subject": "Hello", "html": "<p>Hello!</p>"}'
```

## Response Format

**Success response (200):**

```json theme={null}
{
  "message": "Email queued for delivery.",
  "data": {
    "request_id": "12345678901234567890",
    "accepted": 1,
    "rejected": 0
  }
}
```

**Error response (400, 502):**

```json theme={null}
{
  "message": "The sender domain is not configured or approved for sending.",
  "error_code": "unconfigured_domain"
}
```

**Validation error response (422):**

```json theme={null}
{
  "message": "Validation failed.",
  "error_code": "validation_error",
  "errors": {
    "from": ["The sender email address is required."],
    "to": ["At least one recipient email address is required."]
  }
}
```

## HTTP Status Codes

| Code | Description |
| - | - |
| `200` | Success - Email queued for delivery |
| `400` | Bad Request - Domain configuration error |
| `401` | Unauthorized - Invalid or missing API key |
| `403` | Forbidden - The API key lacks the scope, or the sender domain isn't allowed for the key |
| `409` | Conflict - The resource already exists, or is still in use |
| `422` | Unprocessable Entity - Validation failed, or the campaign can't be sent yet |
| `429` | Too Many Requests - Rate limit or sending quota exceeded |
| `500` | Internal Server Error - Unexpected error on Lettr's side; retry later |
| `502` | Bad Gateway - Upstream transmission failed |
| `503` | Service Unavailable - The API key couldn't be verified right now; retry after `Retry-After` |

## Error Codes

| Code | HTTP Status | Description |
| - | - | - |
| `validation_error` | 422 | Request validation failed. Check the `errors` object for field-specific messages. |
| `invalid_domain` | 400 | The sender domain could not be determined from the email address. |
| `unconfigured_domain` | 400 | The sender domain is not configured or approved for sending. |
| `send_error` | 400 | General error during email send preparation. |
| `insufficient_scope` | 403 | The API key doesn't have the scope this endpoint needs. |
| `domain_not_allowed` | 403 | The sender domain isn't one of the API key's allowed sending domains. |
| `resource_already_exists` | 409 | The resource already exists — for example a sending domain your team has already added. |
| `list_in_use` | 409 | The audience list cannot be deleted because segments are scoped to it. The message names them. |
| `campaign_not_sendable` | 422 | The campaign can't be sent or scheduled: it isn't a draft, it's missing a subject, sender or content, a sender's domain isn't verified for your team, the audience has no subscribed contacts, or your team has more contacts than its plan allows. The message says which. |
| `rate_limit_exceeded` | 429 | Too many API requests. Slow down and retry after the `Retry-After` period. |
| `quota_exceeded` | 429 | Monthly sending quota exceeded. Upgrade your plan to continue sending. |
| `daily_quota_exceeded` | 429 | Daily sending quota exceeded (free tier). Try again tomorrow. |
| `internal_error` | 500 | An unexpected error while creating, sending or scheduling a campaign. Retry later. |
| `transmission_failed` | 502 | Email transmission to the upstream provider failed. |
| `auth_unavailable` | 503 | Lettr couldn't verify your API key because of a temporary problem on its side. This doesn't mean the key is invalid (an invalid key returns `401`). Retry after the `Retry-After` delay, currently 5 seconds. |

## Send Email Reference

### Subject

The `subject` field is conditionally required:

* **Required** when sending with `html` or `text` content directly.
* **Optional** when `template_slug` is provided — if omitted, Lettr uses the template's stored subject. If the template has no subject set, the template name is used instead.
* If provided alongside a `template_slug`, the `subject` **overrides** the template's subject. This is useful for A/B testing or dynamic subject lines.

Maximum length: 998 characters.

### Options

The `options` object controls tracking and email classification:

| Option | Type | Default | Description |
| - | - | - | - |
| `transactional` | boolean | `true` | Whether this is a transactional email. Set to `false` for marketing emails. |
| `open_tracking` | boolean | `true` | Track email opens |
| `click_tracking` | boolean | `true` | Track link clicks |

To disable tracking through the HTTP API, set `options.open_tracking` and `options.click_tracking` to `false` in the JSON request body. These options work independently; omitting either keeps that setting enabled.

The `X-Lettr-Track-Opens` and `X-Lettr-Track-Clicks` headers control tracking only when sending over SMTP. For API requests, use the `options` fields rather than HTTP headers or the custom email `headers` object. See [Tracking](https://docs.lettr.com/learn/sending/tracking.md) for API and SMTP examples.

> [!NOTE]
>
> Since `transactional` defaults to `true`, you only need to explicitly set it when sending marketing emails (`transactional: false`).

### Custom Headers

The `headers` field lets you add custom email headers to your message. Pass an object where each key is the header name and each value is the header value.

**Limits:**

* Maximum **10** custom headers per email
* Maximum **998** characters per header value

```json theme={null}
{
  "headers": {
    "X-My-Header": "custom-value",
    "X-Campaign-ID": "spring-2026"
  }
}
```

> [!WARNING]
>
> The following headers are **blocked** and cannot be set via the `headers` field — Lettr manages them automatically:
>
> `From`, `To`, `Cc`, `Bcc`, `Reply-To`, `Subject`, `Date`, `Message-ID`, `MIME-Version`, `Content-Type`, `Content-Transfer-Encoding`, `DKIM-Signature`, `Return-Path`, `Received`, `List-Unsubscribe`, `List-Unsubscribe-Post`

## API Endpoints

> [card] [Send Email](https://docs.lettr.com/api-reference/emails/send-email.md)
>
> Send emails to one or more recipients

> [card] [Templates](https://docs.lettr.com/api-reference/templates/list-templates.md)
>
> Manage templates, merge tags, and rendered HTML

> [card] [Domains](https://docs.lettr.com/api-reference/domains/list-domains.md)
>
> Create, verify, and manage sending domains

> [card] [Webhooks](https://docs.lettr.com/api-reference/webhooks/list-webhooks.md)
>
> View webhook configurations


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