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

# StackShift Mail API

> Customer Mail delivery, streams, audiences, campaigns, encrypted exports, inbound, events, and operations.

Customer Mail delivery, streams, audiences, campaigns, encrypted exports, inbound, events, and operations. Base URL: `https://api.stackshift.cloud/v1`

Authentication: `bearer`. Every operation below is traced to an official SDK source file listed in the generated coverage report.

| Method   | SDK route                                                    | SDK method                            | Request type                                                                                | Response type                                                  |
| -------- | ------------------------------------------------------------ | ------------------------------------- | ------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| `POST`   | `/mail/send`                                                 | `MailClient.send`                     | `MailSendInput`                                                                             | `MailSendResponse`                                             |
| `POST`   | `/mail/send-template`                                        | `MailClient.sendTemplate`             | `MailSendTemplateInput`                                                                     | `MailSendTemplateResponse`                                     |
| `GET`    | `/mail/limits`                                               | `MailLimitsClient.get`                | `None`                                                                                      | `MailLimits`                                                   |
| `GET`    | `/mail/reputation`                                           | `MailReputationClient.get`            | `None`                                                                                      | `MailReputation`                                               |
| `GET`    | `/mail/reputation/events`                                    | `MailReputationEventsClient.list`     | `MailReputationEventListOptions`                                                            | `MailReputationEventListResult`                                |
| `POST`   | `/mail/templates`                                            | `MailTemplatesClient.create`          | `MailTemplateCreateInput`                                                                   | `MailTemplate`                                                 |
| `GET`    | `/mail/templates`                                            | `MailTemplatesClient.list`            | `MailTemplateListOptions`                                                                   | `MailTemplateListResult`                                       |
| `GET`    | `/mail/templates/{templateIdOrSlug}`                         | `MailTemplatesClient.get`             | `string`                                                                                    | `MailTemplateDetail`                                           |
| `PATCH`  | `/mail/templates/{templateId}`                               | `MailTemplatesClient.update`          | `MailTemplateUpdateInput`                                                                   | `MailTemplate`                                                 |
| `DELETE` | `/mail/templates/{templateId}`                               | `MailTemplatesClient.delete`          | `string`                                                                                    | `void`                                                         |
| `GET`    | `/mail/templates/{templateId}/versions`                      | `MailTemplatesClient.versions`        | `string`                                                                                    | `{ data: MailTemplateVersion[] }`                              |
| `GET`    | `/mail/templates/{templateId}/versions/{versionId}`          | `MailTemplatesClient.getVersion`      | `string`                                                                                    | `MailTemplateVersion`                                          |
| `POST`   | `/mail/templates/{templateId}/versions/{versionId}/activate` | `MailTemplatesClient.activateVersion` | `string`                                                                                    | `MailTemplate`                                                 |
| `POST`   | `/mail/templates/{templateId}/preview`                       | `MailTemplatesClient.preview`         | `MailTemplatePreviewInput`                                                                  | `MailTemplatePreview`                                          |
| `POST`   | `/mail/templates/{templateId}/diagnostics`                   | `MailTemplatesClient.diagnostics`     | `MailTemplateDiagnosticInput`                                                               | `MailTemplateDiagnosticResult`                                 |
| `POST`   | `/mail/templates/{templateId}/test-send`                     | `MailTemplatesClient.testSend`        | `MailTemplateTestSendInput`                                                                 | `MailTemplateTestSendResponse`                                 |
| `POST`   | `/mail/domains`                                              | `MailDomainsClient.create`            | `string`                                                                                    | `MailDomain`                                                   |
| `GET`    | `/mail/domains`                                              | `MailDomainsClient.list`              | `None`                                                                                      | `MailDomainListResult`                                         |
| `GET`    | `/mail/domains/{domainId}`                                   | `MailDomainsClient.get`               | `string`                                                                                    | `MailDomain`                                                   |
| `POST`   | `/mail/domains/{domainId}/verify`                            | `MailDomainsClient.verify`            | `string`                                                                                    | `MailDomain`                                                   |
| `DELETE` | `/mail/domains/{domainId}`                                   | `MailDomainsClient.delete`            | `string`                                                                                    | `void`                                                         |
| `GET`    | `/mail/messages`                                             | `MailMessagesClient.list`             | `MailMessageListOptions`                                                                    | `MailMessageListResult`                                        |
| `GET`    | `/mail/messages/{messageId}`                                 | `MailMessagesClient.get`              | `string`                                                                                    | `MailMessage`                                                  |
| `GET`    | `/mail/messages/{messageId}/attempts`                        | `MailMessagesClient.attempts`         | `string`                                                                                    | `{ data: MailSendAttempt[] }`                                  |
| `GET`    | `/mail/messages/{messageId}/logs`                            | `MailMessagesClient.logs`             | `string`                                                                                    | `{ data: MailLog[] }`                                          |
| `GET`    | `/mail/messages/{messageId}/bounces`                         | `MailMessagesClient.bounces`          | `string`                                                                                    | `{ data: MailBounce[] }`                                       |
| `GET`    | `/mail/suppressions`                                         | `MailSuppressionsClient.list`         | `MailSuppressionListOptions`                                                                | `MailSuppressionListResult`                                    |
| `POST`   | `/mail/suppressions`                                         | `MailSuppressionsClient.create`       | `MailSuppressionCreateInput`                                                                | `MailSuppression`                                              |
| `DELETE` | `/mail/suppressions/{suppressionId}`                         | `MailSuppressionsClient.delete`       | `string`                                                                                    | `void`                                                         |
| `GET`    | `/mail/bounces`                                              | `MailBouncesClient.list`              | `MailBounceListOptions`                                                                     | `MailBounceListResult`                                         |
| `POST`   | `/mail/otp/send`                                             | `MailOtpClient.send`                  | `MailOtpSendInput`                                                                          | `MailOtpSendResponse`                                          |
| `POST`   | `/mail/otp/verify`                                           | `MailOtpClient.verify`                | `MailOtpVerifyInput`                                                                        | `MailOtpVerifyResponse`                                        |
| `GET`    | `/mail/otp/challenges`                                       | `MailOtpChallengesClient.list`        | `MailOtpChallengeListOptions`                                                               | `MailOtpChallengeListResult`                                   |
| `GET`    | `/mail/otp/challenges/{challengeId}`                         | `MailOtpChallengesClient.get`         | `string`                                                                                    | `MailOtpChallenge`                                             |
| `POST`   | `/mail/otp/challenges/{challengeId}/cancel`                  | `MailOtpChallengesClient.cancel`      | `string`                                                                                    | `MailOtpChallenge`                                             |
| `POST`   | `/mail/scheduled`                                            | `MailScheduledClient.create`          | `MailScheduledCreateInput`                                                                  | `MailScheduledMessage`                                         |
| `GET`    | `/mail/scheduled`                                            | `MailScheduledClient.list`            | `None`                                                                                      | `{ data: MailScheduledMessage[] }`                             |
| `GET`    | `/mail/scheduled/{id}`                                       | `MailScheduledClient.get`             | `string`                                                                                    | `MailScheduledMessage`                                         |
| `POST`   | `/mail/scheduled/{id}/cancel`                                | `MailScheduledClient.cancel`          | `string`                                                                                    | `MailScheduledMessage`                                         |
| `POST`   | `/mail/batch`                                                | `MailBatchClient.send`                | `MailBatchSendInput`                                                                        | `MailBatch`                                                    |
| `POST`   | `/mail/batch-template`                                       | `MailBatchClient.sendTemplate`        | `MailBatchTemplateInput`                                                                    | `MailBatch`                                                    |
| `GET`    | `/mail/batches`                                              | `MailBatchClient.list`                | `None`                                                                                      | `{ data: MailBatch[] }`                                        |
| `GET`    | `/mail/batches/{id}`                                         | `MailBatchClient.get`                 | `string`                                                                                    | `MailBatch`                                                    |
| `GET`    | `/mail/batches/{id}/items`                                   | `MailBatchClient.items`               | `string`                                                                                    | `{ data: MailBatchItem[] }`                                    |
| `POST`   | `/mail/inbound/domains`                                      | `MailInboundDomainsClient.create`     | `string`                                                                                    | `MailInboundDomain`                                            |
| `GET`    | `/mail/inbound/domains`                                      | `MailInboundDomainsClient.list`       | `None`                                                                                      | `{ data: MailInboundDomain[] }`                                |
| `POST`   | `/mail/inbound/domains/{id}/verify`                          | `MailInboundDomainsClient.verify`     | `string`                                                                                    | `MailInboundDomain`                                            |
| `GET`    | `/mail/inbound/messages`                                     | `MailInboundMessagesClient.list`      | `None`                                                                                      | `{ data: MailInboundMessage[] }`                               |
| `GET`    | `/mail/inbound/messages/{id}`                                | `MailInboundMessagesClient.get`       | `string`                                                                                    | `MailInboundMessage`                                           |
| `GET`    | `/mail/analytics`                                            | `MailAnalyticsClient.get`             | `MailAnalyticsInput`                                                                        | `MailAnalytics`                                                |
| `GET`    | `/mail/events`                                               | `MailEventsClient.list`               | `MailEventListOptions`                                                                      | `MailEventListResult`                                          |
| `GET`    | `/mail/events/{eventId}`                                     | `MailEventsClient.get`                | `string`                                                                                    | `MailEvent`                                                    |
| `POST`   | `/mail/webhooks`                                             | `MailWebhooksClient.create`           | `MailWebhookCreateInput`                                                                    | `MailWebhookCreateResponse`                                    |
| `GET`    | `/mail/webhooks`                                             | `MailWebhooksClient.list`             | `MailWebhookListOptions`                                                                    | `MailWebhookListResult`                                        |
| `GET`    | `/mail/webhooks/{webhookId}`                                 | `MailWebhooksClient.get`              | `string`                                                                                    | `MailWebhook`                                                  |
| `PATCH`  | `/mail/webhooks/{webhookId}`                                 | `MailWebhooksClient.update`           | `MailWebhookUpdateInput`                                                                    | `MailWebhook`                                                  |
| `POST`   | `/mail/webhooks/{webhookId}/rotate-secret`                   | `MailWebhooksClient.rotateSecret`     | `string`                                                                                    | `{ secret: string }`                                           |
| `DELETE` | `/mail/webhooks/{webhookId}`                                 | `MailWebhooksClient.delete`           | `string`                                                                                    | `void`                                                         |
| `GET`    | `/mail/webhooks/{webhookId}/deliveries`                      | `MailWebhooksClient.deliveries`       | `string`                                                                                    | `{ data: MailWebhookDelivery[]; nextCursor?: string \| null }` |
| `GET`    | `/mail/webhook-deliveries/{deliveryId}`                      | `MailWebhooksClient.getDelivery`      | `string`                                                                                    | `MailWebhookDeliveryDetail`                                    |
| `POST`   | `/mail/webhook-deliveries/{deliveryId}/retry`                | `MailWebhooksClient.retryDelivery`    | `string`                                                                                    | `MailWebhookDelivery`                                          |
| `POST`   | `/mail/webhooks/{webhookId}/replay`                          | `MailWebhooksClient.replay`           | `MailWebhookReplayInput`                                                                    | `MailWebhookReplay`                                            |
| `GET`    | `/mail/messages/{messageId}/timeline`                        | `MailWebhooksClient.replay`           | `string`                                                                                    | `{ data: MailTimelineItem[] }`                                 |
| `POST`   | `/mail/streams`                                              | `MailStreamsClient.create`            | `MailMessageStreamCreateInput`                                                              | `MailMessageStream`                                            |
| `GET`    | `/mail/streams`                                              | `MailStreamsClient.list`              | `None`                                                                                      | `MailMessageStreamListResult`                                  |
| `POST`   | `/mail/audiences`                                            | `MailAudiencesClient.create`          | `{ name: string; description?: string; }`                                                   | `MailAudience`                                                 |
| `GET`    | `/mail/audiences`                                            | `MailAudiencesClient.list`            | `None`                                                                                      | `{ data: MailAudience[] }`                                     |
| `GET`    | `/mail/audiences/{id}`                                       | `MailAudiencesClient.get`             | `string`                                                                                    | `MailAudience`                                                 |
| `GET`    | `/mail/audiences/{id}/members`                               | `MailAudiencesClient.members`         | `string`                                                                                    | `{ data: MailAudienceMember[] }`                               |
| `POST`   | `/mail/audiences/{id}/imports`                               | `MailAudiencesClient.import`          | `string`                                                                                    | `{ imported: number; skipped: number }`                        |
| `POST`   | `/mail/campaigns`                                            | `MailCampaignsClient.create`          | `{ name: string; audienceId: string; template: string; versionId?: string; from: string; }` | `MailCampaign`                                                 |
| `GET`    | `/mail/campaigns`                                            | `MailCampaignsClient.list`            | `None`                                                                                      | `{ data: MailCampaign[] }`                                     |
| `GET`    | `/mail/campaigns/{id}`                                       | `MailCampaignsClient.get`             | `string`                                                                                    | `MailCampaign`                                                 |
| `POST`   | `/mail/campaigns/{id}/send`                                  | `MailCampaignsClient.send`            | `string`                                                                                    | `MailCampaign`                                                 |
| `POST`   | `/mail/exports`                                              | `MailExportsClient.create`            | `MailExportCreateInput`                                                                     | `MailExport`                                                   |
| `GET`    | `/mail/exports`                                              | `MailExportsClient.list`              | `None`                                                                                      | `{ data: MailExport[] }`                                       |
| `GET`    | `/mail/exports/{id}`                                         | `MailExportsClient.get`               | `string`                                                                                    | `MailExport`                                                   |

## Error envelope

Non-2xx responses use the StackShift response envelope. Check `success: false`, then read the structured `error` value and HTTP status. SDK clients surface the status, code, message, and details through their native error type.

## Examples

These static examples show the verified route and authentication boundary. Use the official SDK method shown in each heading so serialization and response unwrapping remain consistent with the contract.

### `GET /mail/limits`

```bash theme={null}
curl -X GET "https://api.stackshift.cloud/v1/mail/limits"   -H "Authorization: Bearer $STACKSHIFT_API_KEY"
```

The SDK serializes any supported query options for this operation.

Response:

```json theme={null}
{
  "success": true,
  "data": "example"
}
```

### `POST /mail/send`

```bash theme={null}
curl -X POST "https://api.stackshift.cloud/v1/mail/send"   -H "Authorization: Bearer $STACKSHIFT_API_KEY"   -H "Content-Type: application/json"   --data '{"from":"example","to":"example","subject":"example"}'
```

The request body is derived from `MailSendInput` in the official SDK contract.

Response:

```json theme={null}
{
  "success": true,
  "data": "example"
}
```
