# API reference

> The Mail API: addresses, authentication, errors and limits.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://mail.docs.sypnia.com/api/

For agents: Mail API at https://mail.api.sypnia.com/v1; Bearer key with scopes send, smtp, read, admin (never in browser); error shape {error {code, message}}; codes 400 invalid_request/too_many_recipients/invalid_template_data, 401, 403 forbidden/sending_paused, 404 not_found/template_not_found, 409, 413, 415, 422 domain_not_verified/all_suppressed, 429 rate_limited retry-after, 402 insufficient_credits.

API: `https://mail.api.sypnia.com/v1` **\[Cloud]**, or your engine's address **\[Engine]**.

## Authentication

`Authorization: Bearer <key>`. Keys belong to a project and have scopes: `send` (send and cancel), `smtp` (the relay), `read` (events, templates, suppressions), `admin` (everything, including domains, webhooks and keys). A key never goes in a browser.

## Errors

```json
{ "error": { "code": "domain_not_verified", "message": "laespiga.co is not verified in this project. Run: mail domains check laespiga.co" } }
```

| Status | Codes                                                             |
| ------ | ----------------------------------------------------------------- |
| 400    | `invalid_request`, `too_many_recipients`, `invalid_template_data` |
| 401    | `unauthorized`                                                    |
| 403    | `forbidden`, `sending_paused`                                     |
| 404    | `not_found`, `template_not_found`                                 |
| 409    | `already_exists`                                                  |
| 413    | `too_large`                                                       |
| 415    | `type_not_allowed`                                                |
| 422    | `domain_not_verified`, `all_suppressed`                           |
| 429    | `rate_limited` (with `retry-after`)                               |
| 402    | `insufficient_credits`                                            |

- [Endpoints](/api/endpoints/): E-mails, events, domains, templates, webhooks, suppressions, inbound and keys.
