# Endpoints

> E-mails, events, domains, templates, webhooks, suppressions, inbound and keys.

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

For agents: Mail API endpoints: POST /emails, POST /emails/batch, GET /emails/{id}, POST /emails/{id}/cancel, GET /events; domains POST/GET/check/DELETE; templates list/create/get/put/publish/rollback/render; webhooks (replay), suppressions, inbound rules and messages, keys.

## E-mails

| Method and path                                   | Does                                       |
| ------------------------------------------------- | ------------------------------------------ |
| `POST /emails`                                    | Send one e-mail → `202 { id, suppressed }` |
| `POST /emails/batch`                              | Up to 100 e-mails → ids                    |
| `GET /emails/{id}`                                | The e-mail, its status and its events      |
| `POST /emails/{id}/cancel`                        | Cancel a scheduled e-mail                  |
| `GET /events?to=&tag=&case=&type=&since=&cursor=` | Search events                              |

## Domains

| Method and path                       | Does                             |
| ------------------------------------- | -------------------------------- |
| `POST /domains`                       | `{ name }` → the records to add  |
| `GET /domains`, `GET /domains/{name}` | Domains, records and their state |
| `POST /domains/{name}/check`          | Check the records now            |
| `DELETE /domains/{name}`              | Remove a domain                  |

## Templates

| Method and path                                                     | Does                                        |
| ------------------------------------------------------------------- | ------------------------------------------- |
| `GET /templates`, `POST /templates`                                 | List, create                                |
| `GET /templates/{name}`, `PUT /templates/{name}`                    | Read, save a new draft version              |
| `POST /templates/{name}/publish`, `POST /templates/{name}/rollback` | Publish, go back to `{ version }`           |
| `POST /templates/{name}/render`                                     | `{ data, locale }` → subject, HTML and text |

## Webhooks, suppressions, inbound and keys

| Method and path                                                                   | Does                 |
| --------------------------------------------------------------------------------- | -------------------- |
| `GET\|POST /webhooks`, `DELETE /webhooks/{id}`, `POST /webhooks/{id}/replay`      | Webhooks             |
| `GET\|POST /suppressions`, `DELETE /suppressions/{address}`                       | The suppression list |
| `GET\|POST /inbound/rules`, `DELETE /inbound/rules/{id}`, `GET /inbound/messages` | Inbound              |
| `GET\|POST /keys`, `DELETE /keys/{id}`                                            | Keys                 |

The OpenAPI document is in the engine's repository, at `spec/openapi.yaml`.
