# OpenSend API

Transactional and marketing email. 202 means queued, not delivered. Test keys simulate sending.

- [Interactive documentation](/docs)
- [OpenAPI 3.1 JSON](/openapi.json)
- [Agent index](/llms.txt)
- TypeScript package: `opensend-js`

## Auth

- [List MCP connections](/docs/operations/listMcpConnections.md) — `GET /v1/mcp-connections`
- [Revoke MCP connection](/docs/operations/revokeMcpConnection.md) — `POST /v1/mcp-connections/{id}/revoke`
- [Get current identity](/docs/operations/getCurrentIdentity.md) — `GET /v1/me`
- [List agent tokens](/docs/operations/listAgentTokens.md) — `GET /v1/agent-tokens`
- [Create agent token](/docs/operations/createAgentToken.md) — `POST /v1/agent-tokens`
- [Revoke agent token](/docs/operations/revokeAgentToken.md) — `POST /v1/agent-tokens/{id}/revoke`

## ApiKeys

- [List api keys](/docs/operations/listApiKeys.md) — `GET /v1/api-keys`
- [Create api key](/docs/operations/createApiKey.md) — `POST /v1/api-keys`
- [Revoke api key](/docs/operations/revokeApiKey.md) — `POST /v1/api-keys/{id}/revoke`

## Audience

- [List contacts](/docs/operations/listContacts.md) — `GET /v1/contacts`
- [Create contact](/docs/operations/createContact.md) — `POST /v1/contacts`
- [Get contact](/docs/operations/getContact.md) — `GET /v1/contacts/{id}`
- [Update contact](/docs/operations/updateContact.md) — `PATCH /v1/contacts/{id}`
- [Delete contact](/docs/operations/deleteContact.md) — `DELETE /v1/contacts/{id}`
- [List contact lists](/docs/operations/listContactLists.md) — `GET /v1/lists`
- [Create contact list](/docs/operations/createContactList.md) — `POST /v1/lists`
- [Get contact list](/docs/operations/getContactList.md) — `GET /v1/lists/{id}`
- [Update contact list](/docs/operations/updateContactList.md) — `PATCH /v1/lists/{id}`
- [Delete contact list](/docs/operations/deleteContactList.md) — `DELETE /v1/lists/{id}`
- [List list members](/docs/operations/listListMembers.md) — `GET /v1/lists/{id}/members`
- [Add list members](/docs/operations/addListMembers.md) — `POST /v1/lists/{id}/members`
- [Remove list member](/docs/operations/removeListMember.md) — `DELETE /v1/lists/{id}/members/{contactId}`
- [List segments](/docs/operations/listSegments.md) — `GET /v1/segments`
- [Create segment](/docs/operations/createSegment.md) — `POST /v1/segments`
- [Get segment](/docs/operations/getSegment.md) — `GET /v1/segments/{id}`
- [Update segment](/docs/operations/updateSegment.md) — `PATCH /v1/segments/{id}`
- [Delete segment](/docs/operations/deleteSegment.md) — `DELETE /v1/segments/{id}`
- [Preview segment](/docs/operations/previewSegment.md) — `POST /v1/segments/{id}/preview`
- [List contact imports](/docs/operations/listContactImports.md) — `GET /v1/contact-imports`
- [Preview contact import](/docs/operations/previewContactImport.md) — `POST /v1/contact-imports`
- [Get contact import](/docs/operations/getContactImport.md) — `GET /v1/contact-imports/{id}`
- [Commit contact import](/docs/operations/commitContactImport.md) — `POST /v1/contact-imports/{id}/commit`
- [Query audience](/docs/operations/queryAudience.md) — `POST /v1/audience-query/query`
- [Plan audience mutation](/docs/operations/planAudienceMutation.md) — `POST /v1/audience-query/plan`
- [Apply audience plan](/docs/operations/applyAudiencePlan.md) — `POST /v1/audience-query/apply`

## Consent

- [List contact consent events](/docs/operations/listContactConsentEvents.md) — `GET /v1/contacts/{id}/consent`
- [Update contact consent](/docs/operations/updateContactConsent.md) — `POST /v1/contacts/{id}/consent`
- [Unsubscribe by link](/docs/operations/unsubscribeByLink.md) — `GET /unsubscribe/{token}`
- [Unsubscribe one click](/docs/operations/unsubscribeOneClick.md) — `POST /unsubscribe/{token}`

## Templates

- [List campaign templates](/docs/operations/listCampaignTemplates.md) — `GET /v1/templates`
- [Create campaign template](/docs/operations/createCampaignTemplate.md) — `POST /v1/templates`
- [Get campaign template](/docs/operations/getCampaignTemplate.md) — `GET /v1/templates/{id}`
- [Update campaign template](/docs/operations/updateCampaignTemplate.md) — `PATCH /v1/templates/{id}`
- [Delete campaign template](/docs/operations/deleteCampaignTemplate.md) — `DELETE /v1/templates/{id}`
- [Publish campaign template](/docs/operations/publishCampaignTemplate.md) — `POST /v1/templates/{id}/publish`
- [Preview campaign template](/docs/operations/previewCampaignTemplate.md) — `GET /v1/templates/{id}/preview`
- [Render campaign template preview image](/docs/operations/renderCampaignTemplatePreviewImage.md) — `GET /v1/templates/{id}/preview-image`
- [Set campaign template archived](/docs/operations/setCampaignTemplateArchived.md) — `PATCH /v1/templates/{id}/archive`
- [Upload template asset](/docs/operations/uploadTemplateAsset.md) — `POST /v1/template-assets`
- [Import template image](/docs/operations/importTemplateImage.md) — `POST /v1/template-assets/import`
- [Get template asset](/docs/operations/getTemplateAsset.md) — `GET /v1/template-assets/{id}`
- [Delete template asset](/docs/operations/deleteTemplateAsset.md) — `DELETE /v1/template-assets/{id}`
- [Get template asset content](/docs/operations/getTemplateAssetContent.md) — `GET /v1/template-assets/{id}/content`

## Emails

- [Send email](/docs/operations/sendEmail.md) — `POST /v1/emails/send`
- [Send email batch](/docs/operations/sendEmailBatch.md) — `POST /v1/emails/batch`
- [List emails](/docs/operations/listEmails.md) — `GET /v1/emails`
- [Get email](/docs/operations/getEmail.md) — `GET /v1/emails/{id}`
- [Get email content](/docs/operations/getEmailContent.md) — `GET /v1/emails/{id}/content`
- [List email events](/docs/operations/listEmailEvents.md) — `GET /v1/emails/{id}/events`

## Attachments

- [Upload attachment](/docs/operations/uploadAttachment.md) — `POST /v1/attachments`
- [Get attachment](/docs/operations/getAttachment.md) — `GET /v1/attachments/{id}`
- [Delete attachment](/docs/operations/deleteAttachment.md) — `DELETE /v1/attachments/{id}`
- [Get attachment content](/docs/operations/getAttachmentContent.md) — `GET /v1/attachments/{id}/content`

## Campaigns

- [List campaigns](/docs/operations/listCampaigns.md) — `GET /v1/campaigns`
- [Create campaign](/docs/operations/createCampaign.md) — `POST /v1/campaigns`
- [Get campaign](/docs/operations/getCampaign.md) — `GET /v1/campaigns/{id}`
- [Update campaign](/docs/operations/updateCampaign.md) — `PATCH /v1/campaigns/{id}`
- [Delete campaign](/docs/operations/deleteCampaign.md) — `DELETE /v1/campaigns/{id}`
- [Get campaign stats](/docs/operations/getCampaignStats.md) — `GET /v1/campaigns/{id}/stats`
- [Get campaign content guide](/docs/operations/getCampaignContentGuide.md) — `GET /v1/campaign-content-guide`
- [Preview campaign](/docs/operations/previewCampaign.md) — `GET /v1/campaigns/{id}/preview`
- [Render campaign preview image](/docs/operations/renderCampaignPreviewImage.md) — `GET /v1/campaigns/{id}/preview-image`
- [Get campaign state](/docs/operations/getCampaignState.md) — `GET /v1/campaigns/{id}/state`
- [Set campaign archived](/docs/operations/setCampaignArchived.md) — `PATCH /v1/campaigns/{id}/archive`
- [Test campaign](/docs/operations/testCampaign.md) — `POST /v1/campaigns/{id}/test`
- [Start campaign review](/docs/operations/startCampaignReview.md) — `POST /v1/campaigns/{id}/reviews`
- [Get campaign review](/docs/operations/getCampaignReview.md) — `GET /v1/campaigns/{id}/reviews/{reviewId}`
- [Send campaign](/docs/operations/sendCampaign.md) — `POST /v1/campaigns/{id}/send`
- [Schedule campaign](/docs/operations/scheduleCampaign.md) — `POST /v1/campaigns/{id}/schedule`
- [Cancel campaign](/docs/operations/cancelCampaign.md) — `POST /v1/campaigns/{id}/cancel`
- [Pause campaign](/docs/operations/pauseCampaign.md) — `POST /v1/campaigns/{id}/pause`
- [Resume campaign](/docs/operations/resumeCampaign.md) — `POST /v1/campaigns/{id}/resume`
- [Set campaign pacing](/docs/operations/setCampaignPacing.md) — `POST /v1/campaigns/{id}/pacing`

## Settings

- [Get workspace settings](/docs/operations/getWorkspaceSettings.md) — `GET /v1/settings/workspace`
- [Update workspace settings](/docs/operations/updateWorkspaceSettings.md) — `PATCH /v1/settings/workspace`
- [Get ses settings](/docs/operations/getSesSettings.md) — `GET /v1/settings/ses`

## Domains

- [List domains](/docs/operations/listDomains.md) — `GET /v1/domains`
- [Create domain](/docs/operations/createDomain.md) — `POST /v1/domains`
- [Configure domain mail from](/docs/operations/configureDomainMailFrom.md) — `POST /v1/domains/{id}/mail-from`
- [Get domain](/docs/operations/getDomain.md) — `GET /v1/domains/{id}`
- [Verify domain](/docs/operations/verifyDomain.md) — `POST /v1/domains/{id}/verify`

## Webhooks

- [List webhooks](/docs/operations/listWebhooks.md) — `GET /v1/webhooks`
- [Create webhook](/docs/operations/createWebhook.md) — `POST /v1/webhooks`
- [Get webhook](/docs/operations/getWebhook.md) — `GET /v1/webhooks/{id}`
- [Update webhook](/docs/operations/updateWebhook.md) — `PATCH /v1/webhooks/{id}`
- [Delete webhook](/docs/operations/deleteWebhook.md) — `DELETE /v1/webhooks/{id}`
- [Reveal webhook secret](/docs/operations/revealWebhookSecret.md) — `GET /v1/webhooks/{id}/secret`
- [Rotate webhook secret](/docs/operations/rotateWebhookSecret.md) — `POST /v1/webhooks/{id}/rotate-secret`
- [Test webhook](/docs/operations/testWebhook.md) — `POST /v1/webhooks/{id}/test`
- [List webhook deliveries](/docs/operations/listWebhookDeliveries.md) — `GET /v1/webhooks/{id}/deliveries`
- [Get webhook delivery](/docs/operations/getWebhookDelivery.md) — `GET /v1/webhooks/{id}/deliveries/{deliveryId}`
- [Retry webhook delivery](/docs/operations/retryWebhookDelivery.md) — `POST /v1/webhooks/{id}/deliveries/{deliveryId}/retry`

## Events

- [Receive ses sns event](/docs/operations/receiveSesSnsEvent.md) — `POST /v1/events/ses`

## Metrics

- [Get metrics](/docs/operations/getMetrics.md) — `GET /v1/metrics`

## Regions

- [List regions](/docs/operations/listRegions.md) — `GET /v1/regions`
- [Configure region](/docs/operations/configureRegion.md) — `PUT /v1/regions/{region}`
- [Discover region](/docs/operations/discoverRegion.md) — `GET /v1/regions/{region}/discovery`
- [Provision region](/docs/operations/provisionRegion.md) — `POST /v1/regions/{region}/provision`
- [Configure region auto validation](/docs/operations/configureRegionAutoValidation.md) — `PUT /v1/regions/{region}/auto-validation`

## Mailbox domains

- [Mailbox list domains](/docs/operations/mailboxListDomains.md) — `GET /mailbox/v1/domains`
- [Mailbox get domain](/docs/operations/mailboxGetDomain.md) — `GET /mailbox/v1/domains/{id}`
- [Mailbox update domain](/docs/operations/mailboxUpdateDomain.md) — `PATCH /mailbox/v1/domains/{id}`
- [Mailbox check domain](/docs/operations/mailboxCheckDomain.md) — `POST /mailbox/v1/domains/{id}/check`
- [Mailbox enable domain](/docs/operations/mailboxEnableDomain.md) — `POST /mailbox/v1/domains/{id}/enable`
- [Mailbox disable domain](/docs/operations/mailboxDisableDomain.md) — `POST /mailbox/v1/domains/{id}/disable`
- [Mailbox list subdomains](/docs/operations/mailboxListSubdomains.md) — `GET /mailbox/v1/domains/{id}/subdomains`
- [Mailbox create subdomain](/docs/operations/mailboxCreateSubdomain.md) — `POST /mailbox/v1/domains/{id}/subdomains`
- [Mailbox get subdomain](/docs/operations/mailboxGetSubdomain.md) — `GET /mailbox/v1/domains/{id}/subdomains/{subdomainId}`
- [Mailbox update subdomain](/docs/operations/mailboxUpdateSubdomain.md) — `PATCH /mailbox/v1/domains/{id}/subdomains/{subdomainId}`
- [Mailbox remove subdomain](/docs/operations/mailboxRemoveSubdomain.md) — `DELETE /mailbox/v1/domains/{id}/subdomains/{subdomainId}`

## Mailboxes

- [Mailbox list](/docs/operations/mailboxList.md) — `GET /mailbox/v1/mailboxes`
- [Mailbox create](/docs/operations/mailboxCreate.md) — `POST /mailbox/v1/mailboxes`
- [Mailbox get](/docs/operations/mailboxGet.md) — `GET /mailbox/v1/mailboxes/{mailboxId}`
- [Mailbox update](/docs/operations/mailboxUpdate.md) — `PATCH /mailbox/v1/mailboxes/{mailboxId}`
- [Mailbox delete](/docs/operations/mailboxDelete.md) — `DELETE /mailbox/v1/mailboxes/{mailboxId}`

## Mailbox threads

- [Mailbox list threads](/docs/operations/mailboxListThreads.md) — `GET /mailbox/v1/mailboxes/{mailboxId}/threads`
- [Mailbox get thread](/docs/operations/mailboxGetThread.md) — `GET /mailbox/v1/mailboxes/{mailboxId}/threads/{threadId}`
- [Mailbox update thread](/docs/operations/mailboxUpdateThread.md) — `PATCH /mailbox/v1/mailboxes/{mailboxId}/threads/{threadId}`
- [Mailbox delete thread](/docs/operations/mailboxDeleteThread.md) — `DELETE /mailbox/v1/mailboxes/{mailboxId}/threads/{threadId}`
- [Mailbox update threads](/docs/operations/mailboxUpdateThreads.md) — `POST /mailbox/v1/mailboxes/{mailboxId}/threads/batch`
- [Mailbox reply to thread](/docs/operations/mailboxReplyToThread.md) — `POST /mailbox/v1/mailboxes/{mailboxId}/threads/{threadId}/reply`

## Mailbox messages

- [Mailbox list messages](/docs/operations/mailboxListMessages.md) — `GET /mailbox/v1/mailboxes/{mailboxId}/messages`
- [Mailbox send message](/docs/operations/mailboxSendMessage.md) — `POST /mailbox/v1/mailboxes/{mailboxId}/messages`
- [Mailbox get message](/docs/operations/mailboxGetMessage.md) — `GET /mailbox/v1/mailboxes/{mailboxId}/messages/{messageId}`
- [Mailbox update message](/docs/operations/mailboxUpdateMessage.md) — `PATCH /mailbox/v1/mailboxes/{mailboxId}/messages/{messageId}`
- [Mailbox update messages](/docs/operations/mailboxUpdateMessages.md) — `POST /mailbox/v1/mailboxes/{mailboxId}/messages/batch`
- [Mailbox list labels](/docs/operations/mailboxListLabels.md) — `GET /mailbox/v1/mailboxes/{mailboxId}/labels`
- [Mailbox list contacts](/docs/operations/mailboxListContacts.md) — `GET /mailbox/v1/mailboxes/{mailboxId}/contacts`
- [Mailbox get raw message](/docs/operations/mailboxGetRawMessage.md) — `GET /mailbox/v1/mailboxes/{mailboxId}/messages/{messageId}/raw`
- [Mailbox get attachment](/docs/operations/mailboxGetAttachment.md) — `GET /mailbox/v1/mailboxes/{mailboxId}/attachments/{attachmentId}`
- [Mailbox upload attachment](/docs/operations/mailboxUploadAttachment.md) — `POST /mailbox/v1/mailboxes/{mailboxId}/attachments`
- [Mailbox reply to message](/docs/operations/mailboxReplyToMessage.md) — `POST /mailbox/v1/mailboxes/{mailboxId}/messages/{messageId}/reply`
- [Mailbox forward message](/docs/operations/mailboxForwardMessage.md) — `POST /mailbox/v1/mailboxes/{mailboxId}/messages/{messageId}/forward`
- [Mailbox list stored messages](/docs/operations/mailboxListStoredMessages.md) — `GET /mailbox/v1/messages`
- [Mailbox get stored message](/docs/operations/mailboxGetStoredMessage.md) — `GET /mailbox/v1/messages/{id}`
- [Mailbox list unrouted](/docs/operations/mailboxListUnrouted.md) — `GET /mailbox/v1/unrouted`

## Mailbox events

- [Mailbox list events](/docs/operations/mailboxListEvents.md) — `GET /mailbox/v1/mailboxes/{mailboxId}/events`
- [Mailbox list all events](/docs/operations/mailboxListAllEvents.md) — `GET /mailbox/v1/events`

## Mailbox keys

- [Mailbox list keys](/docs/operations/mailboxListKeys.md) — `GET /mailbox/v1/keys`
- [Mailbox create key](/docs/operations/mailboxCreateKey.md) — `POST /mailbox/v1/keys`
- [Mailbox revoke key](/docs/operations/mailboxRevokeKey.md) — `POST /mailbox/v1/keys/{id}/revoke`

## Mailbox webhooks

- [Mailbox list webhooks](/docs/operations/mailboxListWebhooks.md) — `GET /mailbox/v1/webhooks`
- [Mailbox create webhook](/docs/operations/mailboxCreateWebhook.md) — `POST /mailbox/v1/webhooks`
- [Mailbox get webhook](/docs/operations/mailboxGetWebhook.md) — `GET /mailbox/v1/webhooks/{id}`
- [Mailbox update webhook](/docs/operations/mailboxUpdateWebhook.md) — `PATCH /mailbox/v1/webhooks/{id}`
- [Mailbox delete webhook](/docs/operations/mailboxDeleteWebhook.md) — `DELETE /mailbox/v1/webhooks/{id}`
- [Mailbox rotate webhook secret](/docs/operations/mailboxRotateWebhookSecret.md) — `POST /mailbox/v1/webhooks/{id}/rotate-secret`
- [Mailbox list webhook deliveries](/docs/operations/mailboxListWebhookDeliveries.md) — `GET /mailbox/v1/webhooks/{id}/deliveries`

## List MCP connections

`GET /v1/mcp-connections`



Operation ID: `listMcpConnections`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listMcpConnections } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listMcpConnections({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/mcp-connections' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Revoke MCP connection

`POST /v1/mcp-connections/{id}/revoke`



Operation ID: `revokeMcpConnection`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { revokeMcpConnection } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await revokeMcpConnection({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/mcp-connections/resource_123/revoke' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get current identity

`GET /v1/me`



Operation ID: `getCurrentIdentity`



### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getCurrentIdentity } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getCurrentIdentity({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/me' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List agent tokens

`GET /v1/agent-tokens`



Operation ID: `listAgentTokens`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |
| `includeInactive` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listAgentTokens } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listAgentTokens({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/agent-tokens' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Create agent token

`POST /v1/agent-tokens`

Creates a nonrefreshable, short-lived API token for temporary uncommitted scripts. Requires an MCP OAuth principal and cannot delegate permissions beyond that originating approval. Manage tokens cannot administer credentials.

Operation ID: `createAgentToken`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `permissions` | string[] | yes |  |
| `environment` | string | yes |  |
| `expiresInSeconds` | integer | yes |  |
| `domains` | string[] | no |  |
| `purpose` | string | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { createAgentToken } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await createAgentToken({
  client,
  body: {
    "permissions": [
      "read"
    ],
    "environment": "live",
    "expiresInSeconds": 30,
    "domains": [],
    "purpose": "Your message is ready."
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/agent-tokens' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "permissions": [
    "read"
  ],
  "environment": "live",
  "expiresInSeconds": 30,
  "domains": [],
  "purpose": "Your message is ready."
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Revoke agent token

`POST /v1/agent-tokens/{id}/revoke`



Operation ID: `revokeAgentToken`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { revokeAgentToken } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await revokeAgentToken({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/agent-tokens/resource_123/revoke' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List api keys

`GET /v1/api-keys`



Operation ID: `listApiKeys`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |
| `includeRevoked` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listApiKeys } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listApiKeys({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/api-keys' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Create api key

`POST /v1/api-keys`



Operation ID: `createApiKey`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `environment` | string | no |  |
| `permissions` | string[] | no |  |
| `domains` | string[] | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { createApiKey } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await createApiKey({
  client,
  body: {
    "name": "Example",
    "environment": "live",
    "permissions": [
      "send"
    ],
    "domains": []
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/api-keys' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Example",
  "environment": "live",
  "permissions": [
    "send"
  ],
  "domains": []
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Revoke api key

`POST /v1/api-keys/{id}/revoke`



Operation ID: `revokeApiKey`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { revokeApiKey } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await revokeApiKey({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/api-keys/resource_123/revoke' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List contacts

`GET /v1/contacts`

Active contacts with current list IDs. Search is a case-insensitive literal email/name substring. Consent and suppression filters are independent.

Operation ID: `listContacts`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |
| `search` | query | string | no |  |
| `email` | query | string | no | Exact, case-insensitive email match. Uses the unique email index; prefer it over search for one address. |
| `consent` | query | string | no |  |
| `suppressed` | query | string | no |  |
| `listId` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listContacts } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listContacts({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/contacts' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Create contact

`POST /v1/contacts`



Operation ID: `createContact`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `email` | string | yes |  |
| `name` | string | no |  |
| `properties` | object | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { createContact } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await createContact({
  client,
  body: {
    "email": "recipient@example.com",
    "properties": {}
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/contacts' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "email": "recipient@example.com",
  "properties": {}
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get contact

`GET /v1/contacts/{id}`



Operation ID: `getContact`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getContact } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getContact({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/contacts/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Update contact

`PATCH /v1/contacts/{id}`



Operation ID: `updateContact`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string or null | no |  |
| `properties` | object | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { updateContact } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await updateContact({
  client,
  path: {
    "id": "resource_123"
  },
  body: {},
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/v1/contacts/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Delete contact

`DELETE /v1/contacts/{id}`

Remove contact profile and memberships, retaining minimal consent/suppression to prevent accidental re-enrollment.

Operation ID: `deleteContact`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { deleteContact } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await deleteContact({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request DELETE \
  --url 'https://opensend.anoma.ly/v1/contacts/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List contact consent events

`GET /v1/contacts/{id}/consent`



Operation ID: `listContactConsentEvents`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listContactConsentEvents } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listContactConsentEvents({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/contacts/resource_123/consent' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Update contact consent

`POST /v1/contacts/{id}/consent`

Set marketing subscription status. Source, policy version, evidence and occurrence time are optional audit context; OpenSend records the actor and current time when omitted. Does not lift delivery suppression. Imports/profile edits cannot establish consent.

Operation ID: `updateContactConsent`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | string | yes |  |
| `source` | string | no |  |
| `policyVersion` | string | no |  |
| `evidence` | string | no |  |
| `occurredAt` | string | no |  |
| `confirmResubscribe` | boolean | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { updateContactConsent } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await updateContactConsent({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "status": "subscribed",
    "confirmResubscribe": false
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/contacts/resource_123/consent' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "status": "subscribed",
  "confirmResubscribe": false
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List contact lists

`GET /v1/lists`



Operation ID: `listContactLists`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |
| `search` | query | string | no |  |
| `counts` | query | string | no | false skips member counts (counts is null), for pickers that only need names. Counting scans every membership of each list. |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listContactLists } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listContactLists({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/lists' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Create contact list

`POST /v1/lists`



Operation ID: `createContactList`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `description` | string | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { createContactList } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await createContactList({
  client,
  body: {
    "name": "Example",
    "description": ""
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/lists' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Example",
  "description": ""
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get contact list

`GET /v1/lists/{id}`



Operation ID: `getContactList`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getContactList } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getContactList({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/lists/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Update contact list

`PATCH /v1/lists/{id}`



Operation ID: `updateContactList`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | no |  |
| `description` | string | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { updateContactList } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await updateContactList({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "description": ""
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/v1/lists/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "description": ""
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Delete contact list

`DELETE /v1/lists/{id}`



Operation ID: `deleteContactList`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { deleteContactList } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await deleteContactList({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request DELETE \
  --url 'https://opensend.anoma.ly/v1/lists/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List list members

`GET /v1/lists/{id}/members`



Operation ID: `listListMembers`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |
| `search` | query | string | no |  |
| `email` | query | string | no | Exact, case-insensitive email match. Uses the unique email index; prefer it over search for one address. |
| `consent` | query | string | no |  |
| `suppressed` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listListMembers } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listListMembers({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/lists/resource_123/members' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Add list members

`POST /v1/lists/{id}/members`



Operation ID: `addListMembers`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `contactIds` | string[] | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { addListMembers } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await addListMembers({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "contactIds": [
      "contact_123"
    ]
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/lists/resource_123/members' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "contactIds": [
    "contact_123"
  ]
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Remove list member

`DELETE /v1/lists/{id}/members/{contactId}`



Operation ID: `removeListMember`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `contactId` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { removeListMember } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await removeListMember({
  client,
  path: {
    "id": "resource_123",
    "contactId": "contact_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request DELETE \
  --url 'https://opensend.anoma.ly/v1/lists/resource_123/members/contact_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List segments

`GET /v1/segments`



Operation ID: `listSegments`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |
| `search` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listSegments } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listSegments({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/segments' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Create segment

`POST /v1/segments`



Operation ID: `createSegment`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `rule` | object or object or object | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { createSegment } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await createSegment({
  client,
  body: {
    "name": "Example",
    "rule": {
      "field": "email",
      "operator": "eq",
      "value": "example"
    }
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/segments' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Example",
  "rule": {
    "field": "email",
    "operator": "eq",
    "value": "example"
  }
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get segment

`GET /v1/segments/{id}`



Operation ID: `getSegment`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getSegment } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getSegment({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/segments/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Update segment

`PATCH /v1/segments/{id}`



Operation ID: `updateSegment`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | no |  |
| `rule` | object or object or object | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { updateSegment } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await updateSegment({
  client,
  path: {
    "id": "resource_123"
  },
  body: {},
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/v1/segments/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Delete segment

`DELETE /v1/segments/{id}`



Operation ID: `deleteSegment`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { deleteSegment } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await deleteSegment({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request DELETE \
  --url 'https://opensend.anoma.ly/v1/segments/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Preview segment

`POST /v1/segments/{id}/preview`

Bounded to 1000 matches. Unknown observation history is never classified as inactive. Counts separate suppressed and other non-consenting contacts.

Operation ID: `previewSegment`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `listId` | string | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { previewSegment } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await previewSegment({
  client,
  path: {
    "id": "resource_123"
  },
  body: {},
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/segments/resource_123/preview' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List contact imports

`GET /v1/contact-imports`



Operation ID: `listContactImports`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listContactImports } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listContactImports({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/contact-imports' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Preview contact import

`POST /v1/contact-imports`

Persist a preview before commit. Feature limit: 5 MiB UTF-8 CSV, 50,000 rows, 100 columns. Map headers explicitly. Valid rows can commit alongside a retained row-error report; imports never modify consent or suppression.

Operation ID: `previewContactImport`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `csv` | string | yes |  |
| `listId` | string | no |  |
| `mapping` | object | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { previewContactImport } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await previewContactImport({
  client,
  body: {
    "csv": "example",
    "mapping": {
      "email": "recipient@example.com"
    }
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/contact-imports' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "csv": "example",
  "mapping": {
    "email": "recipient@example.com"
  }
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get contact import

`GET /v1/contact-imports/{id}`



Operation ID: `getContactImport`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getContactImport } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getContactImport({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/contact-imports/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Commit contact import

`POST /v1/contact-imports/{id}/commit`



Operation ID: `commitContactImport`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { commitContactImport } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await commitContactImport({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/contact-imports/resource_123/commit' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Query audience

`POST /v1/audience-query/query`

Execute a bounded read-only AudienceQL SELECT against the virtual contacts schema.

Operation ID: `queryAudience`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `statement` | string | yes | AudienceQL statement. Supported: SELECT fields\|count(*) FROM contacts [WHERE ...] [LIMIT n]; UPDATE contacts SET name\|consent\|properties.key = value WHERE ...; ADD contacts TO LIST 'name-or-id' WHERE ...; REMOVE contacts FROM LIST 'name-or-id' WHERE .... WHERE supports AND with =, !=, CONTAINS, IS NULL, IS NOT NULL and timestamp comparisons over id, email, name, consent, suppressed, list, segment, lastOpenAt, lastClickAt and properties.key. No raw tables, joins, comments or semicolons. |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { queryAudience } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await queryAudience({
  client,
  body: {
    "statement": "example"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/audience-query/query' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "statement": "example"
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Plan audience mutation

`POST /v1/audience-query/plan`

Create a 15-minute immutable plan for a bounded AudienceQL bulk mutation. Does not modify contacts or memberships.

Operation ID: `planAudienceMutation`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `statement` | string | yes | AudienceQL statement. Supported: SELECT fields\|count(*) FROM contacts [WHERE ...] [LIMIT n]; UPDATE contacts SET name\|consent\|properties.key = value WHERE ...; ADD contacts TO LIST 'name-or-id' WHERE ...; REMOVE contacts FROM LIST 'name-or-id' WHERE .... WHERE supports AND with =, !=, CONTAINS, IS NULL, IS NOT NULL and timestamp comparisons over id, email, name, consent, suppressed, list, segment, lastOpenAt, lastClickAt and properties.key. No raw tables, joins, comments or semicolons. |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { planAudienceMutation } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await planAudienceMutation({
  client,
  body: {
    "statement": "example"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/audience-query/plan' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "statement": "example"
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Apply audience plan

`POST /v1/audience-query/apply`

Apply an immutable AudienceQL plan once. Prior opt-outs require confirmResubscribe.

Operation ID: `applyAudiencePlan`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `planId` | string | yes |  |
| `confirmResubscribe` | boolean | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { applyAudiencePlan } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await applyAudiencePlan({
  client,
  body: {
    "planId": "plan_123",
    "confirmResubscribe": false
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/audience-query/apply' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "planId": "plan_123",
  "confirmResubscribe": false
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List campaign templates

`GET /v1/templates`



Operation ID: `listCampaignTemplates`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |
| `search` | query | string | no |  |
| `archived` | query | string | no |  |
| `publishedOnly` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listCampaignTemplates } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listCampaignTemplates({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/templates' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Create campaign template

`POST /v1/templates`



Operation ID: `createCampaignTemplate`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `description` | string | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { createCampaignTemplate } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await createCampaignTemplate({
  client,
  body: {
    "name": "Example",
    "description": ""
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/templates' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Example",
  "description": ""
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get campaign template

`GET /v1/templates/{id}`



Operation ID: `getCampaignTemplate`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getCampaignTemplate } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getCampaignTemplate({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/templates/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Update campaign template

`PATCH /v1/templates/{id}`



Operation ID: `updateCampaignTemplate`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `revision` | integer | yes |  |
| `draft` | object | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { updateCampaignTemplate } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await updateCampaignTemplate({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "revision": 1,
    "draft": {
      "name": "Example",
      "description": "",
      "subject": "",
      "replyTo": [],
      "attachments": []
    }
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/v1/templates/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "revision": 1,
  "draft": {
    "name": "Example",
    "description": "",
    "subject": "",
    "replyTo": [],
    "attachments": []
  }
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Delete campaign template

`DELETE /v1/templates/{id}`



Operation ID: `deleteCampaignTemplate`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { deleteCampaignTemplate } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await deleteCampaignTemplate({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request DELETE \
  --url 'https://opensend.anoma.ly/v1/templates/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Publish campaign template

`POST /v1/templates/{id}/publish`



Operation ID: `publishCampaignTemplate`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `revision` | integer | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { publishCampaignTemplate } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await publishCampaignTemplate({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "revision": 1
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/templates/resource_123/publish' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "revision": 1
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Preview campaign template

`GET /v1/templates/{id}/preview`



Operation ID: `previewCampaignTemplate`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `published` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { previewCampaignTemplate } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await previewCampaignTemplate({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/templates/resource_123/preview' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Render campaign template preview image

`GET /v1/templates/{id}/preview-image`

Renders a template draft or published revision as a full-page PNG. Inline template assets are embedded, so agents can verify the result without browser automation.

Operation ID: `renderCampaignTemplatePreviewImage`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `published` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { renderCampaignTemplatePreviewImage } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await renderCampaignTemplatePreviewImage({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/templates/resource_123/preview-image' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Set campaign template archived

`PATCH /v1/templates/{id}/archive`



Operation ID: `setCampaignTemplateArchived`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `archived` | boolean | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { setCampaignTemplateArchived } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await setCampaignTemplateArchived({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "archived": false
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/v1/templates/resource_123/archive' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "archived": false
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Upload template asset

`POST /v1/template-assets`



Operation ID: `uploadTemplateAsset`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filename` | string | yes |  |
| `contentType` | string | no |  |
| `disposition` | string | no |  |
| `contentId` | string | no |  |
| `content` | string | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { uploadTemplateAsset } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await uploadTemplateAsset({
  client,
  body: {
    "filename": "Example",
    "contentType": "application/octet-stream",
    "disposition": "attachment",
    "content": "example"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/template-assets' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "filename": "Example",
  "contentType": "application/octet-stream",
  "disposition": "attachment",
  "content": "example"
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Import template image

`POST /v1/template-assets/import`

Downloads a public HTTPS PNG, JPEG, GIF or WebP into private global template assets. Add asset.id to draft.attachments and use src in an img block. This is preferred over hotlinking and requires no browser automation or base64 in model context.

Operation ID: `importTemplateImage`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string | yes |  |
| `filename` | string | no |  |
| `contentId` | string | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { importTemplateImage } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await importTemplateImage({
  client,
  body: {
    "url": "https://example.com/webhook"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/template-assets/import' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "url": "https://example.com/webhook"
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get template asset

`GET /v1/template-assets/{id}`



Operation ID: `getTemplateAsset`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getTemplateAsset } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getTemplateAsset({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/template-assets/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Delete template asset

`DELETE /v1/template-assets/{id}`



Operation ID: `deleteTemplateAsset`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { deleteTemplateAsset } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await deleteTemplateAsset({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request DELETE \
  --url 'https://opensend.anoma.ly/v1/template-assets/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get template asset content

`GET /v1/template-assets/{id}/content`



Operation ID: `getTemplateAssetContent`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getTemplateAssetContent } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getTemplateAssetContent({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/template-assets/resource_123/content' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Send email

`POST /v1/emails/send`



Operation ID: `sendEmail`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Optional. Makes retries safe. Repeating a request with the same key and the same body returns the original result without performing the write again; a concurrent duplicate waits for the first request and returns its result. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT. Keys are scoped to the API key, environment and request path, and are retained indefinitely. Without a key, every request is processed, so a retried send can deliver twice. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string | yes |  |
| `fromName` | string | no |  |
| `to` | string or string[] | yes |  |
| `cc` | string[] | no |  |
| `bcc` | string[] | no |  |
| `replyTo` | string[] | no |  |
| `region` | string | no | Defaults to the installation’s persisted default region when omitted. |
| `kind` | string | no |  |
| `subject` | string | no |  |
| `html` | string | no |  |
| `text` | string | no |  |
| `template` | object | no | Uses native SES stored-template rendering and snapshots its rendered MIME. SES does not automatically escape HTML; callers must escape untrusted HTML-context values. Test keys do not contact SES or render the template. |
| `metadata` | object | no | Caller correlation fields retained in delivery webhook data.metadata. |
| `inReplyTo` | string | no | Message-ID of the email being answered; adds the In-Reply-To header. |
| `references` | string[] | no | Ordered Message-IDs in the conversation; adds the References header. |
| `attachments` | string[] | no |  |
| `tracking` | boolean | no |  |
| `screen` | boolean | no | Ask the installation’s content classifier (Jev) whether this message is unsolicited advertising smuggled into a transactional template, e.g. an ad placed in a user-supplied name. Screened messages that look like spam are rejected before delivery with error code CONTENT_REJECTED_SPAM and a reject event; nothing reaches the provider. Live transactional messages only; ignored for marketing and in the test environment. Skipped (and logged) when the installation has no classifier configured. |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { sendEmail } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await sendEmail({
  client,
  body: {
    "from": "sender@example.com",
    "to": "recipient@example.com",
    "cc": [],
    "bcc": [],
    "replyTo": [],
    "kind": "transactional",
    "metadata": {},
    "references": [],
    "attachments": [],
    "subject": "Hello from OpenSend",
    "text": "Your message is ready."
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/emails/send' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "from": "sender@example.com",
  "to": "recipient@example.com",
  "cc": [],
  "bcc": [],
  "replyTo": [],
  "kind": "transactional",
  "metadata": {},
  "references": [],
  "attachments": [],
  "subject": "Hello from OpenSend",
  "text": "Your message is ready."
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Send email batch

`POST /v1/emails/batch`



Operation ID: `sendEmailBatch`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Optional. Makes retries safe. Repeating a request with the same key and the same body returns the original result without performing the write again; a concurrent duplicate waits for the first request and returns its result. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT. Keys are scoped to the API key, environment and request path, and are retained indefinitely. Without a key, every request is processed, so a retried send can deliver twice. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `emails` | object[] | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { sendEmailBatch } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await sendEmailBatch({
  client,
  body: {
    "emails": [
      {
        "from": "sender@example.com",
        "to": "recipient@example.com",
        "cc": [],
        "bcc": [],
        "replyTo": [],
        "kind": "transactional",
        "metadata": {},
        "references": [],
        "attachments": [],
        "subject": "Hello from OpenSend",
        "text": "Your message is ready."
      }
    ]
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/emails/batch' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "emails": [
    {
      "from": "sender@example.com",
      "to": "recipient@example.com",
      "cc": [],
      "bcc": [],
      "replyTo": [],
      "kind": "transactional",
      "metadata": {},
      "references": [],
      "attachments": [],
      "subject": "Hello from OpenSend",
      "text": "Your message is ready."
    }
  ]
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List emails

`GET /v1/emails`



Operation ID: `listEmails`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |
| `campaignId` | query | string | no |  |
| `status` | query | string | no |  |
| `region` | query | string | no |  |
| `kind` | query | string | no |  |
| `search` | query | string | no |  |
| `from` | query | string | no |  |
| `to` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listEmails } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listEmails({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/emails' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get email

`GET /v1/emails/{id}`



Operation ID: `getEmail`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getEmail } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getEmail({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/emails/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get email content

`GET /v1/emails/{id}/content`

Manage keys receive full snapshots. Other readers receive app unsubscribe tokens redacted from subject/HTML/text and raw MIME withheld (null), since MIME encodings can conceal capabilities. Other transactional bearer links are not sanitized; grant content-read access only to trusted integrations.

Operation ID: `getEmailContent`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getEmailContent } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getEmailContent({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/emails/resource_123/content' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List email events

`GET /v1/emails/{id}/events`



Operation ID: `listEmailEvents`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listEmailEvents } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listEmailEvents({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/emails/resource_123/events' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Upload attachment

`POST /v1/attachments`



Operation ID: `uploadAttachment`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Optional. Makes retries safe. Repeating a request with the same key and the same body returns the original result without performing the write again; a concurrent duplicate waits for the first request and returns its result. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT. Keys are scoped to the API key, environment and request path, and are retained indefinitely. Without a key, every request is processed, so a retried send can deliver twice. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filename` | string | yes |  |
| `contentType` | string | no |  |
| `content` | string | yes | Standard padded base64; no data URLs. Maximum decoded bytes: 8 MiB. |
| `disposition` | string | no |  |
| `contentId` | string | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { uploadAttachment } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await uploadAttachment({
  client,
  body: {
    "filename": "Example",
    "contentType": "application/octet-stream",
    "content": "example",
    "disposition": "attachment"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/attachments' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "filename": "Example",
  "contentType": "application/octet-stream",
  "content": "example",
  "disposition": "attachment"
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get attachment

`GET /v1/attachments/{id}`



Operation ID: `getAttachment`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getAttachment } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getAttachment({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/attachments/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Delete attachment

`DELETE /v1/attachments/{id}`



Operation ID: `deleteAttachment`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { deleteAttachment } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await deleteAttachment({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request DELETE \
  --url 'https://opensend.anoma.ly/v1/attachments/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get attachment content

`GET /v1/attachments/{id}/content`

Returns the private attachment as canonical base64 JSON, scoped like its metadata. At most 8 MiB decoded; never a public object URL or executable inline response.

Operation ID: `getAttachmentContent`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getAttachmentContent } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getAttachmentContent({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/attachments/resource_123/content' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List campaigns

`GET /v1/campaigns`

Returns bounded campaign metadata summaries. Fetch an individual campaign for its full editable draft; list drafts omit bodies, defaults, attachments and audience exclusions.

Operation ID: `listCampaigns`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |
| `region` | query | string | no |  |
| `status` | query | string | no |  |
| `archived` | query | string | no | False lists active campaigns; true lists archived campaigns only. |
| `search` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listCampaigns } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listCampaigns({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/campaigns' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Create campaign

`POST /v1/campaigns`

Create a campaign; only a name is required. templateId copies an active published global template, including its content and assets, into this environment as an independent draft. Omitted region uses the installation default. Returns a dashboard URL so an agent and user can continue editing together.

Operation ID: `createCampaign`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Optional. Makes retries safe. Repeating a request with the same key and the same body returns the original result without performing the write again; a concurrent duplicate waits for the first request and returns its result. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT. Keys are scoped to the API key, environment and request path, and are retained indefinitely. Without a key, every request is processed, so a retried send can deliver twice. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `from` | string or string | no |  |
| `fromName` | string | no |  |
| `previewText` | string | no | Optional preheader text. Inserted as escaped hidden text into each outgoing HTML snapshot; draft HTML is unchanged. When set, supply HTML without its own duplicate preheader. |
| `replyTo` | string[] | no |  |
| `region` | string | no | Defaults to the installation’s persisted default region when omitted. |
| `subject` | string or string | no |  |
| `attachments` | string[] | no |  |
| `tracking` | boolean | no |  |
| `audience` | object | no |  |
| `defaults` | object | no |  |
| `html` | string | no | Block HTML: h1-h3, p, ul/ol, blockquote, pre>code, hr, img, buttons, columns and styled sections with inline formatting. A constrained email-safe style attribute supports color, typography, spacing, borders, radius and dimensions; arbitrary CSS remains rejected. No wrappers, tables, class or id. Call getContentGuide in MCP or GET /v1/campaign-content-guide for the full vocabulary and examples. |
| `templateId` | string | no | Copies the active published revision of this global campaign template into a new independent campaign draft. |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { createCampaign } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await createCampaign({
  client,
  body: {
    "name": "Example",
    "from": "sender@example.com",
    "replyTo": [],
    "subject": "Hello from OpenSend",
    "attachments": [],
    "audience": {},
    "defaults": {}
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/campaigns' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Example",
  "from": "sender@example.com",
  "replyTo": [],
  "subject": "Hello from OpenSend",
  "attachments": [],
  "audience": {},
  "defaults": {}
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get campaign

`GET /v1/campaigns/{id}`



Operation ID: `getCampaign`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getCampaign } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getCampaign({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Update campaign

`PATCH /v1/campaigns/{id}`

Replace the whole draft at the current revision. Read the campaign first: html is block HTML that people may have edited in the dashboard composer, so send the complete updated html rather than a fragment. Rejected content names the unsupported tag or attribute.

Operation ID: `updateCampaign`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `revision` | integer | yes |  |
| `draft` | object | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { updateCampaign } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await updateCampaign({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "revision": 1,
    "draft": {
      "name": "Example",
      "from": "sender@example.com",
      "replyTo": [],
      "subject": "Hello from OpenSend",
      "attachments": [],
      "tracking": true,
      "audience": {},
      "defaults": {}
    }
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "revision": 1,
  "draft": {
    "name": "Example",
    "from": "sender@example.com",
    "replyTo": [],
    "subject": "Hello from OpenSend",
    "attachments": [],
    "tracking": true,
    "audience": {},
    "defaults": {}
  }
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Delete campaign

`DELETE /v1/campaigns/{id}`



Operation ID: `deleteCampaign`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { deleteCampaign } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await deleteCampaign({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request DELETE \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get campaign stats

`GET /v1/campaigns/{id}/stats`

Lifetime campaign delivery and unique open/click statistics, progress, tracking setting and rates with numeric numerators/denominators. Counts distinct emails across all stored feedback, not event occurrences. Delivery/bounce/complaint rates use accepted emails; open/click rates use delivered emails. Rates are fractions, null for zero denominators or test mode; engagement rates are also null with tracking disabled. Delivered means receiving-server acceptance, not inbox placement. Engagement includes bots/privacy proxies. Completed means dispatch finished; asynchronous feedback can still change totals.

Operation ID: `getCampaignStats`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getCampaignStats } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getCampaignStats({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/stats' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get campaign content guide

`GET /v1/campaign-content-guide`

The complete campaign and template content vocabulary, personalization syntax, restrictions and examples as Markdown. Read it once before writing or editing html.

Operation ID: `getCampaignContentGuide`



### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getCampaignContentGuide } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getCampaignContentGuide({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/campaign-content-guide' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Preview campaign

`GET /v1/campaigns/{id}/preview`

Renders the saved draft’s block HTML as the styled email and its plain-text alternative, without personalization or the unsubscribe footer. Placeholders remain visible as {{name}}.

Operation ID: `previewCampaign`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { previewCampaign } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await previewCampaign({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/preview' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Render campaign preview image

`GET /v1/campaigns/{id}/preview-image`

Renders the saved campaign draft as a full-page, 720 px wide PNG for visual review. Inline CID images are embedded; remote HTTPS images are loaded by the isolated renderer.

Operation ID: `renderCampaignPreviewImage`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { renderCampaignPreviewImage } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await renderCampaignPreviewImage({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/preview-image' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get campaign state

`GET /v1/campaigns/{id}/state`

Compact authenticated state for draft sync polling; fetch the full campaign with getCampaign when state changes. Compare all returned fields, not only revision: review, archive and status changes need not increment the draft revision. Omits draft content and delivery counts.

Operation ID: `getCampaignState`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getCampaignState } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getCampaignState({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/state' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Set campaign archived

`PATCH /v1/campaigns/{id}/archive`

Archive a campaign to hide it from default lists, or restore it. Preserves its content, revision, delivery status and history. Scheduled or sending campaigns must finish or be canceled before archiving. Archived campaigns cannot be edited, reviewed, tested or sent until restored.

Operation ID: `setCampaignArchived`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `archived` | boolean | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { setCampaignArchived } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await setCampaignArchived({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "archived": false
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/archive' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "archived": false
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Test campaign

`POST /v1/campaigns/{id}/test`



Operation ID: `testCampaign`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `Idempotency-Key` | header | string | no | Optional. Makes retries safe. Repeating a request with the same key and the same body returns the original result without performing the write again; a concurrent duplicate waits for the first request and returns its result. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT. Keys are scoped to the API key, environment and request path, and are retained indefinitely. Without a key, every request is processed, so a retried send can deliver twice. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `to` | string | yes |  |
| `data` | object | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { testCampaign } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await testCampaign({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "to": "recipient@example.com",
    "data": {}
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/test' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "to": "recipient@example.com",
  "data": {}
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Start campaign review

`POST /v1/campaigns/{id}/reviews`

Start durable preparation for up to 2,000,000 matching contacts. Captures one fixed audience snapshot, then validates every message in bounded jobs. Poll getCampaignReview until ready before asking for send confirmation.

Operation ID: `startCampaignReview`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `Idempotency-Key` | header | string | no | Optional. Makes retries safe. Repeating a request with the same key and the same body returns the original result without performing the write again; a concurrent duplicate waits for the first request and returns its result. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT. Keys are scoped to the API key, environment and request path, and are retained indefinitely. Without a key, every request is processed, so a retried send can deliver twice. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `revision` | integer | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { startCampaignReview } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await startCampaignReview({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "revision": 1
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/reviews' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "revision": 1
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get campaign review

`GET /v1/campaigns/{id}/reviews/{reviewId}`

Read fixed audience counts and durable preparation progress. A ready review is usable only while it remains the campaign’s current review and revision.

Operation ID: `getCampaignReview`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `reviewId` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getCampaignReview } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getCampaignReview({
  client,
  path: {
    "id": "resource_123",
    "reviewId": "review_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/reviews/review_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Send campaign

`POST /v1/campaigns/{id}/send`

Accept the current revision for durable background delivery. Omit reviewId to snapshot and validate the complete audience automatically before any provider attempt; supply an existing completed reviewId to reuse it. The 202 count is accepted recipient intents, not SES acceptance or delivery.

Operation ID: `sendCampaign`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `Idempotency-Key` | header | string | no | Optional. Makes retries safe. Repeating a request with the same key and the same body returns the original result without performing the write again; a concurrent duplicate waits for the first request and returns its result. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT. Keys are scoped to the API key, environment and request path, and are retained indefinitely. Without a key, every request is processed, so a retried send can deliver twice. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `reviewId` | string | no | Optional completed review. Omit to snapshot and validate the current revision automatically before delivery. |
| `revision` | integer | yes |  |
| `pacing` | object | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { sendCampaign } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await sendCampaign({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "revision": 1
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/send' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "revision": 1
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Schedule campaign

`POST /v1/campaigns/{id}/schedule`

Accept the current revision for durable scheduled delivery. Omit reviewId to snapshot and validate automatically; no recipient is materialized or sent before scheduledAt. The 202 count is accepted recipient intents.

Operation ID: `scheduleCampaign`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `Idempotency-Key` | header | string | no | Optional. Makes retries safe. Repeating a request with the same key and the same body returns the original result without performing the write again; a concurrent duplicate waits for the first request and returns its result. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT. Keys are scoped to the API key, environment and request path, and are retained indefinitely. Without a key, every request is processed, so a retried send can deliver twice. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `reviewId` | string | no | Optional completed review. Omit to snapshot and validate the current revision automatically before delivery. |
| `revision` | integer | yes |  |
| `pacing` | object | no |  |
| `scheduledAt` | string | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { scheduleCampaign } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await scheduleCampaign({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "revision": 1,
    "scheduledAt": "2026-09-18T19:00:00Z"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/schedule' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "revision": 1,
  "scheduledAt": "2026-09-18T19:00:00Z"
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Cancel campaign

`POST /v1/campaigns/{id}/cancel`



Operation ID: `cancelCampaign`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `Idempotency-Key` | header | string | no | Optional. Makes retries safe. Repeating a request with the same key and the same body returns the original result without performing the write again; a concurrent duplicate waits for the first request and returns its result. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT. Keys are scoped to the API key, environment and request path, and are retained indefinitely. Without a key, every request is processed, so a retried send can deliver twice. |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { cancelCampaign } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await cancelCampaign({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/cancel' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Pause campaign

`POST /v1/campaigns/{id}/pause`

Stop releasing new recipients. Queued mail (a few seconds of the send rate) still dispatches. Resume continues from the same position; cancel still works while paused.

Operation ID: `pauseCampaign`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

Type: `object`

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { pauseCampaign } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await pauseCampaign({
  client,
  path: {
    "id": "resource_123"
  },
  body: {},
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/pause' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Resume campaign

`POST /v1/campaigns/{id}/resume`

Continue releasing recipients from where a paused campaign stopped. After an automatic pause, the next health check runs 30 minutes later.

Operation ID: `resumeCampaign`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

Type: `object`

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { resumeCampaign } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await resumeCampaign({
  client,
  path: {
    "id": "resource_123"
  },
  body: {},
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/resume' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Set campaign pacing

`POST /v1/campaigns/{id}/pacing`

Change the daily cap or automatic pause of a scheduled or sending campaign, for example to raise 50,000 to 100,000 per day. Takes effect on the next release.

Operation ID: `setCampaignPacing`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `perDay` | integer or null | yes |  |
| `autoPause` | boolean | no | Omit to keep the current setting. |
| `rateShare` | number | no | Omit to keep the current setting. |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { setCampaignPacing } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await setCampaignPacing({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "perDay": 100
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/campaigns/resource_123/pacing' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "perDay": 100
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get workspace settings

`GET /v1/settings/workspace`



Operation ID: `getWorkspaceSettings`



### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getWorkspaceSettings } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getWorkspaceSettings({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/settings/workspace' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Update workspace settings

`PATCH /v1/settings/workspace`



Operation ID: `updateWorkspaceSettings`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { updateWorkspaceSettings } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await updateWorkspaceSettings({
  client,
  body: {
    "name": "Example"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/v1/settings/workspace' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Example"
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get ses settings

`GET /v1/settings/ses`



Operation ID: `getSesSettings`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `region` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getSesSettings } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getSesSettings({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/settings/ses' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List domains

`GET /v1/domains`

Refreshes at most 10 identities, sequentially with one second between SES reads. Use refresh=false for cached sender selection without AWS calls. Default page size is 5; use individual domain detail for a single live refresh. Concurrent refresh clients may still encounter account-level throttling.

Operation ID: `listDomains`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |
| `region` | query | string | no |  |
| `refresh` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listDomains } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listDomains({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/domains' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Create domain

`POST /v1/domains`



Operation ID: `createDomain`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `region` | string | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { createDomain } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await createDomain({
  client,
  body: {
    "name": "Example",
    "region": "us-east-1"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/domains' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Example",
  "region": "us-east-1"
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Configure domain mail from

`POST /v1/domains/{id}/mail-from`

Configure a custom SES MAIL FROM subdomain with fallback to the default amazonses.com MAIL FROM value while DNS is unavailable.

Operation ID: `configureDomainMailFrom`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `mailFromDomain` | string | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { configureDomainMailFrom } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await configureDomainMailFrom({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "mailFromDomain": "example"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/domains/resource_123/mail-from' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "mailFromDomain": "example"
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get domain

`GET /v1/domains/{id}`



Operation ID: `getDomain`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getDomain } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getDomain({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/domains/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Verify domain

`POST /v1/domains/{id}/verify`



Operation ID: `verifyDomain`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { verifyDomain } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await verifyDomain({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/domains/resource_123/verify' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List webhooks

`GET /v1/webhooks`



Operation ID: `listWebhooks`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listWebhooks } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listWebhooks({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/webhooks' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Create webhook

`POST /v1/webhooks`



Operation ID: `createWebhook`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string | yes |  |
| `description` | string | no |  |
| `eventTypes` | string[] | no |  |
| `regions` | array or null | no |  |
| `paused` | boolean | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { createWebhook } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await createWebhook({
  client,
  body: {
    "url": "https://example.com/webhook",
    "description": "",
    "eventTypes": [
      "email.sent",
      "email.delivered",
      "email.bounced",
      "email.complained",
      "email.rejected",
      "email.rendering_failed",
      "email.delivery_delayed"
    ],
    "paused": false
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/webhooks' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "url": "https://example.com/webhook",
  "description": "",
  "eventTypes": [
    "email.sent",
    "email.delivered",
    "email.bounced",
    "email.complained",
    "email.rejected",
    "email.rendering_failed",
    "email.delivery_delayed"
  ],
  "paused": false
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get webhook

`GET /v1/webhooks/{id}`



Operation ID: `getWebhook`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getWebhook } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getWebhook({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/webhooks/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Update webhook

`PATCH /v1/webhooks/{id}`



Operation ID: `updateWebhook`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string | no |  |
| `description` | string | no |  |
| `eventTypes` | string[] | no |  |
| `regions` | array or null | no |  |
| `paused` | boolean | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { updateWebhook } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await updateWebhook({
  client,
  path: {
    "id": "resource_123"
  },
  body: {},
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/v1/webhooks/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Delete webhook

`DELETE /v1/webhooks/{id}`



Operation ID: `deleteWebhook`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { deleteWebhook } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await deleteWebhook({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request DELETE \
  --url 'https://opensend.anoma.ly/v1/webhooks/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Reveal webhook secret

`GET /v1/webhooks/{id}/secret`



Operation ID: `revealWebhookSecret`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { revealWebhookSecret } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await revealWebhookSecret({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/webhooks/resource_123/secret' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Rotate webhook secret

`POST /v1/webhooks/{id}/rotate-secret`



Operation ID: `rotateWebhookSecret`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { rotateWebhookSecret } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await rotateWebhookSecret({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/webhooks/resource_123/rotate-secret' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Test webhook

`POST /v1/webhooks/{id}/test`



Operation ID: `testWebhook`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { testWebhook } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await testWebhook({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/webhooks/resource_123/test' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List webhook deliveries

`GET /v1/webhooks/{id}/deliveries`



Operation ID: `listWebhookDeliveries`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listWebhookDeliveries } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listWebhookDeliveries({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/webhooks/resource_123/deliveries' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get webhook delivery

`GET /v1/webhooks/{id}/deliveries/{deliveryId}`



Operation ID: `getWebhookDelivery`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `deliveryId` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getWebhookDelivery } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getWebhookDelivery({
  client,
  path: {
    "id": "resource_123",
    "deliveryId": "delivery_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/webhooks/resource_123/deliveries/delivery_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Retry webhook delivery

`POST /v1/webhooks/{id}/deliveries/{deliveryId}/retry`



Operation ID: `retryWebhookDelivery`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `deliveryId` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { retryWebhookDelivery } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await retryWebhookDelivery({
  client,
  path: {
    "id": "resource_123",
    "deliveryId": "delivery_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/webhooks/resource_123/deliveries/delivery_123/retry' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Receive ses sns event

`POST /v1/events/ses`



Operation ID: `receiveSesSnsEvent`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `Type` | string | yes |  |
| `MessageId` | string | yes |  |
| `TopicArn` | string | yes |  |
| `Message` | string | yes |  |
| `Timestamp` | string | yes |  |
| `SignatureVersion` | string | yes |  |
| `Signature` | string | yes |  |
| `SigningCertURL` | string | yes |  |
| `Subject` | string | no |  |
| `SubscribeURL` | string | no |  |
| `Token` | string | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { receiveSesSnsEvent } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await receiveSesSnsEvent({
  client,
  body: {
    "Type": "Notification",
    "MessageId": "message_123",
    "TopicArn": "example",
    "Message": "example",
    "Timestamp": "2026-09-18T19:00:00Z",
    "SignatureVersion": "1",
    "Signature": "example",
    "SigningCertURL": "https://example.com/webhook"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/events/ses' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "Type": "Notification",
  "MessageId": "message_123",
  "TopicArn": "example",
  "Message": "example",
  "Timestamp": "2026-09-18T19:00:00Z",
  "SignatureVersion": "1",
  "Signature": "example",
  "SigningCertURL": "https://example.com/webhook"
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Unsubscribe by link

`GET /unsubscribe/{token}`



Operation ID: `unsubscribeByLink`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `token` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { unsubscribeByLink } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await unsubscribeByLink({
  client,
  path: {
    "token": "example"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/unsubscribe/example' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Confirmation page; GET never changes consent (link scanners prefetch footer links). | — |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Unsubscribe one click

`POST /unsubscribe/{token}`



Operation ID: `unsubscribeOneClick`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `token` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { unsubscribeOneClick } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await unsubscribeOneClick({
  client,
  path: {
    "token": "example"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/unsubscribe/example' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Marketing consent is now unsubscribed (RFC 8058 one-click or the confirmation form). | — |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Get metrics

`GET /v1/metrics`

Operational created-cohort metrics, not invoicing or provider reputation. Dashboard sessions may receive results cached for up to 60 seconds; API keys, MCP and agent tokens always get fresh results. Selects emails created in [from,to), scoped by email region and stream. Outcomes use current email state and all recorded events, including events after to; this is not a historical state snapshot. Each outcome counts distinct emails, so replays do not inflate counts and outcomes may overlap. Accepted (bucket sent) means evidence of provider acceptance, not merely queued/created. Daily UTC creation buckets contain count=created emails. Granularity defaults to day; granularity=hour additionally returns hourly UTC creation buckets with canonical ISO dates such as 2026-09-12T01:00:00.000Z, while preserving daily buckets and totals. Absent buckets mean zero created emails and zero outcomes; no moving averages are applied. Engagement is observed, not verified human activity.

Operation ID: `getMetrics`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `region` | query | string | no |  |
| `from` | query | string | no |  |
| `to` | query | string | no |  |
| `stream` | query | string | no |  |
| `granularity` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { getMetrics } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await getMetrics({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/metrics' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## List regions

`GET /v1/regions`

Lists persisted region settings and cached discovery/job status without AWS calls. The environment default only seeds installation settings during migration.

Operation ID: `listRegions`



### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { listRegions } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await listRegions({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/regions' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Configure region

`PUT /v1/regions/{region}`

Enable/disable a region or choose the default. Changes are shared by live and test modes; requires unrestricted live management access. Disabling never deletes AWS resources or historical mail.

Operation ID: `configureRegion`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `region` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | no |  |
| `makeDefault` | boolean | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { configureRegion } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await configureRegion({
  client,
  path: {
    "region": "us-east-1"
  },
  body: {},
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PUT \
  --url 'https://opensend.anoma.ly/v1/regions/us-east-1' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Discover region

`GET /v1/regions/{region}/discovery`

Read-only AWS discovery. Caches observations in PostgreSQL for 15 minutes; refresh=true forces AWS reads. Never creates resources or subscribes endpoints. Credential or public-origin changes invalidate the cache.

Operation ID: `discoverRegion`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `region` | path | string | yes |  |
| `refresh` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { discoverRegion } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await discoverRegion({
  client,
  path: {
    "region": "us-east-1"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/v1/regions/us-east-1/discovery' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Provision region

`POST /v1/regions/{region}/provision`

Explicitly queue idempotent setup of OpenSend-owned SES configuration sets, SNS topic/policy/event destinations and signed HTTPS subscription. Never sends email, changes DNS, or grants SES production approval. Repeated requests reuse the active job; inspect listRegions and discovery for completion and remaining blockers.

Operation ID: `provisionRegion`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `region` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `confirm` | boolean | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { provisionRegion } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await provisionRegion({
  client,
  path: {
    "region": "us-east-1"
  },
  body: {
    "confirm": true
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/v1/regions/us-east-1/provision' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "confirm": true
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Configure region auto validation

`PUT /v1/regions/{region}/auto-validation`

Set SES Auto Validation for one OpenSend-owned configuration set. This changes real AWS behavior and requires unrestricted live management access plus explicit confirmation.

Operation ID: `configureRegionAutoValidation`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `region` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `stream` | string | yes |  |
| `mode` | string | yes |  |
| `confirm` | boolean | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { configureRegionAutoValidation } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await configureRegionAutoValidation({
  client,
  path: {
    "region": "us-east-1"
  },
  body: {
    "stream": "transactional",
    "mode": "off",
    "confirm": true
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PUT \
  --url 'https://opensend.anoma.ly/v1/regions/us-east-1/auto-validation' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "stream": "transactional",
  "mode": "off",
  "confirm": true
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list domains

`GET /mailbox/v1/domains`



Operation ID: `mailboxListDomains`



### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxListDomains } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxListDomains({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/domains' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox get domain

`GET /mailbox/v1/domains/{id}`



Operation ID: `mailboxGetDomain`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxGetDomain } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxGetDomain({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/domains/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox update domain

`PATCH /mailbox/v1/domains/{id}`



Operation ID: `mailboxUpdateDomain`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `catchAll` | string | no |  |
| `acceptSubdomains` | boolean | no | Whether the receipt rule also matches every subdomain (.example.com). Turned on by the first subdomain and kept on after that. |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxUpdateDomain } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxUpdateDomain({
  client,
  path: {
    "id": "resource_123"
  },
  body: {},
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/mailbox/v1/domains/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox check domain

`POST /mailbox/v1/domains/{id}/check`

Reads public DNS and reports who currently receives mail for the domain. Updates the receiving status when inbound is enabled. Never changes DNS or AWS.

Operation ID: `mailboxCheckDomain`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxCheckDomain } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxCheckDomain({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/domains/resource_123/check' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox enable domain

`POST /mailbox/v1/domains/{id}/enable`

Checks that the domain is verified in SES and that its MX records will not take mail from another provider, then queues setup: an OpenSend S3 bucket, SNS topic and a catch-all SES receipt rule for the domain. Publish the returned MX record to start receiving. Use force=true to take over a domain whose mail another provider receives today.

Operation ID: `mailboxEnableDomain`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `catchAll` | string | no |  |
| `force` | boolean | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxEnableDomain } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxEnableDomain({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "force": false
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/domains/resource_123/enable' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "force": false
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox disable domain

`POST /mailbox/v1/domains/{id}/disable`

Removes the domain from the OpenSend receipt rule. Mailboxes and stored messages are kept.

Operation ID: `mailboxDisableDomain`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxDisableDomain } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxDisableDomain({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/domains/resource_123/disable' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list subdomains

`GET /mailbox/v1/domains/{id}/subdomains`



Operation ID: `mailboxListSubdomains`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `status` | query | string | no |  |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxListSubdomains } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxListSubdomains({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/domains/resource_123/subdomains' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox create subdomain

`POST /mailbox/v1/domains/{id}/subdomains`

Starts receiving mail for name.example.com under a receiving example.com, with no DNS change or SES verification per subdomain. The first subdomain adds the wildcard recipient (.example.com) to the receipt rule, which takes up to a minute; later ones are live immediately. Publish the returned *.example.com MX record once. Mailboxes can then be created on the subdomain. Re-adding a removed subdomain restores it.

Operation ID: `mailboxCreateSubdomain`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | A label (acme) or the full host (acme.example.com). |
| `catchAll` | string | no | Mail for an address with no mailbox: store keeps it as unrouted (default); create_mailbox makes one. |
| `metadata` | object | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxCreateSubdomain } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxCreateSubdomain({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "name": "Example",
    "catchAll": "create_mailbox",
    "metadata": {}
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/domains/resource_123/subdomains' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Example",
  "catchAll": "create_mailbox",
  "metadata": {}
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox get subdomain

`GET /mailbox/v1/domains/{id}/subdomains/{subdomainId}`



Operation ID: `mailboxGetSubdomain`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `subdomainId` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxGetSubdomain } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxGetSubdomain({
  client,
  path: {
    "id": "resource_123",
    "subdomainId": "subdomain_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/domains/resource_123/subdomains/subdomain_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox update subdomain

`PATCH /mailbox/v1/domains/{id}/subdomains/{subdomainId}`



Operation ID: `mailboxUpdateSubdomain`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `subdomainId` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `catchAll` | string | no |  |
| `metadata` | object | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxUpdateSubdomain } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxUpdateSubdomain({
  client,
  path: {
    "id": "resource_123",
    "subdomainId": "subdomain_123"
  },
  body: {},
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/mailbox/v1/domains/resource_123/subdomains/subdomain_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox remove subdomain

`DELETE /mailbox/v1/domains/{id}/subdomains/{subdomainId}`

New mail to the subdomain is dropped at ingest. Its mailboxes and stored messages are kept, and adding the subdomain again restores it. The parent keeps its wildcard recipient, so adding subdomains later is instant; turn it off with PATCH /domains/{id} acceptSubdomains=false.

Operation ID: `mailboxRemoveSubdomain`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `subdomainId` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxRemoveSubdomain } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxRemoveSubdomain({
  client,
  path: {
    "id": "resource_123",
    "subdomainId": "subdomain_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request DELETE \
  --url 'https://opensend.anoma.ly/mailbox/v1/domains/resource_123/subdomains/subdomain_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list

`GET /mailbox/v1/mailboxes`

Mailbox keys see only the mailboxes they are scoped to.

Operation ID: `mailboxList`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domain` | query | string | no |  |
| `origin` | query | string | no |  |
| `q` | query | string | no |  |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxList } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxList({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox create

`POST /mailbox/v1/mailboxes`

The address must be on a domain with receiving enabled. Mail already stored for the address, its aliases or rules is linked to the new mailbox.

Operation ID: `mailboxCreate`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `address` | string | yes |  |
| `displayName` | string or null | no |  |
| `aliases` | string[] | no |  |
| `rules` | string[] | no | Wildcard address patterns, e.g. support+*@acme.com or *@help.acme.com. |
| `metadata` | object | no |  |
| `sendLimits` | object | no | Override outbound limits. Defaults: perHour 100, perDay 1000, perRecipientPerHour 20, perThreadPer10Minutes 10. 0 blocks sending. |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxCreate } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxCreate({
  client,
  body: {
    "address": "example",
    "aliases": [],
    "rules": [],
    "metadata": {}
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "address": "example",
  "aliases": [],
  "rules": [],
  "metadata": {}
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox get

`GET /mailbox/v1/mailboxes/{mailboxId}`



Operation ID: `mailboxGet`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxGet } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxGet({
  client,
  path: {
    "mailboxId": "mailbox_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox update

`PATCH /mailbox/v1/mailboxes/{mailboxId}`

aliases and rules replace the current lists. The primary address cannot change.

Operation ID: `mailboxUpdate`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `displayName` | string or null | no |  |
| `aliases` | string[] | no |  |
| `rules` | string[] | no | Wildcard address patterns, e.g. support+*@acme.com or *@help.acme.com. |
| `metadata` | object | no |  |
| `sendLimits` | object | no | Override outbound limits. Defaults: perHour 100, perDay 1000, perRecipientPerHour 20, perThreadPer10Minutes 10. 0 blocks sending. |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxUpdate } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxUpdate({
  client,
  path: {
    "mailboxId": "mailbox_123"
  },
  body: {
    "aliases": [],
    "rules": [],
    "metadata": {}
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "aliases": [],
  "rules": [],
  "metadata": {}
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox delete

`DELETE /mailbox/v1/mailboxes/{mailboxId}`

Deletes the mailbox, its addresses and its per-mailbox state. Stored messages are kept; future mail to its addresses follows the domain catch-all setting.

Operation ID: `mailboxDelete`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxDelete } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxDelete({
  client,
  path: {
    "mailboxId": "mailbox_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request DELETE \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list threads

`GET /mailbox/v1/mailboxes/{mailboxId}/threads`

Newest activity first. view: inbox (Not archived, trashed or spam), archive (Archived), starred (Starred), trash (Trashed), spam (Spam), all (Everything except trash). q runs a full-text search over subject, sender and body.

Operation ID: `mailboxListThreads`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `view` | query | string | no |  |
| `unread` | query | string | no |  |
| `label` | query | string | no |  |
| `q` | query | string | no |  |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxListThreads } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxListThreads({
  client,
  path: {
    "mailboxId": "mailbox_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/threads' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox get thread

`GET /mailbox/v1/mailboxes/{mailboxId}/threads/{threadId}`

Messages this mailbox can see, oldest first, with plain text and reply text. Set includeHtml=true for HTML bodies.

Operation ID: `mailboxGetThread`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `threadId` | path | string | yes |  |
| `includeHtml` | query | string | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxGetThread } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxGetThread({
  client,
  path: {
    "mailboxId": "mailbox_123",
    "threadId": "thread_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/threads/thread_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox update thread

`PATCH /mailbox/v1/mailboxes/{mailboxId}/threads/{threadId}`

read=false marks the latest inbound message unread.

Operation ID: `mailboxUpdateThread`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `threadId` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `read` | boolean | no |  |
| `archived` | boolean | no |  |
| `starred` | boolean | no |  |
| `trashed` | boolean | no |  |
| `spam` | boolean | no |  |
| `addLabels` | string[] | no |  |
| `removeLabels` | string[] | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxUpdateThread } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxUpdateThread({
  client,
  path: {
    "mailboxId": "mailbox_123",
    "threadId": "thread_123"
  },
  body: {},
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/threads/thread_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox delete thread

`DELETE /mailbox/v1/mailboxes/{mailboxId}/threads/{threadId}`

Removes the conversation from this mailbox permanently. Other mailboxes and the stored messages are unaffected. Use trashed=true for a recoverable delete.

Operation ID: `mailboxDeleteThread`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `threadId` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxDeleteThread } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxDeleteThread({
  client,
  path: {
    "mailboxId": "mailbox_123",
    "threadId": "thread_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request DELETE \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/threads/thread_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox update threads

`POST /mailbox/v1/mailboxes/{mailboxId}/threads/batch`



Operation ID: `mailboxUpdateThreads`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `threadIds` | string[] | yes |  |
| `changes` | object | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxUpdateThreads } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxUpdateThreads({
  client,
  path: {
    "mailboxId": "mailbox_123"
  },
  body: {
    "threadIds": [
      "thread_123"
    ],
    "changes": {}
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/threads/batch' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "threadIds": [
    "thread_123"
  ],
  "changes": {}
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list messages

`GET /mailbox/v1/mailboxes/{mailboxId}/messages`

Newest first, without bodies.

Operation ID: `mailboxListMessages`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `direction` | query | string | no |  |
| `unread` | query | string | no |  |
| `label` | query | string | no |  |
| `threadId` | query | string | no |  |
| `q` | query | string | no |  |
| `since` | query | string | no |  |
| `until` | query | string | no |  |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxListMessages } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxListMessages({
  client,
  path: {
    "mailboxId": "mailbox_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/messages' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox send message

`POST /mailbox/v1/mailboxes/{mailboxId}/messages`

Starts a new conversation. Sent through OpenSend’s transactional pipeline (suppression, SES configuration set, delivery tracking) with open/click tracking off. Supports the Idempotency-Key header. Per-mailbox limits apply (see sendLimits).

Operation ID: `mailboxSendMessage`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `Idempotency-Key` | header | string | no | Optional. Makes retries safe. Repeating a request with the same key and the same body returns the original result without performing the write again; a concurrent duplicate waits for the first request and returns its result. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT. Keys are scoped to the API key, environment and request path, and are retained indefinitely. Without a key, every request is processed, so a retried send can deliver twice. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string | no | Send as the primary address (default) or one of the mailbox aliases. |
| `text` | string | no |  |
| `html` | string | no |  |
| `attachments` | object or object[] | no | Up to 20 files, 8 MiB combined. Types: PDF, text, CSV, JSON, images, ICS and Office documents. |
| `replyTo` | string[] | no |  |
| `headers` | object[] | no |  |
| `autoSubmitted` | string | no | Adds an RFC 3834 Auto-Submitted header so other automated systems do not reply to this message. |
| `to` | string[] | yes |  |
| `cc` | string[] | no |  |
| `bcc` | string[] | no |  |
| `subject` | string | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxSendMessage } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxSendMessage({
  client,
  path: {
    "mailboxId": "mailbox_123"
  },
  body: {
    "attachments": [],
    "replyTo": [],
    "headers": [],
    "to": [
      "recipient@example.com"
    ],
    "cc": [],
    "bcc": [],
    "subject": "Hello from OpenSend"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/messages' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "attachments": [],
  "replyTo": [],
  "headers": [],
  "to": [
    "recipient@example.com"
  ],
  "cc": [],
  "bcc": [],
  "subject": "Hello from OpenSend"
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox get message

`GET /mailbox/v1/mailboxes/{mailboxId}/messages/{messageId}`

Full message with HTML, headers and attachment metadata. Reading does not mark it read; PATCH read=true does.

Operation ID: `mailboxGetMessage`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `messageId` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxGetMessage } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxGetMessage({
  client,
  path: {
    "mailboxId": "mailbox_123",
    "messageId": "message_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/messages/message_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox update message

`PATCH /mailbox/v1/mailboxes/{mailboxId}/messages/{messageId}`



Operation ID: `mailboxUpdateMessage`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `messageId` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `read` | boolean | no |  |
| `addLabels` | string[] | no |  |
| `removeLabels` | string[] | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxUpdateMessage } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxUpdateMessage({
  client,
  path: {
    "mailboxId": "mailbox_123",
    "messageId": "message_123"
  },
  body: {},
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/messages/message_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox update messages

`POST /mailbox/v1/mailboxes/{mailboxId}/messages/batch`



Operation ID: `mailboxUpdateMessages`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `messageIds` | string[] | yes |  |
| `changes` | object | yes |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxUpdateMessages } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxUpdateMessages({
  client,
  path: {
    "mailboxId": "mailbox_123"
  },
  body: {
    "messageIds": [
      "message_123"
    ],
    "changes": {}
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/messages/batch' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "messageIds": [
    "message_123"
  ],
  "changes": {}
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list labels

`GET /mailbox/v1/mailboxes/{mailboxId}/labels`

Every label on this mailbox’s threads or messages, with counts. Labels are created by applying them.

Operation ID: `mailboxListLabels`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxListLabels } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxListLabels({
  client,
  path: {
    "mailboxId": "mailbox_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/labels' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list contacts

`GET /mailbox/v1/mailboxes/{mailboxId}/contacts`

Everyone this mailbox has corresponded with, derived from its mail: people it sent to, people who wrote to it, and others on those messages. Spam and the mailbox’s own addresses are left out. Automated and no-reply senders are excluded unless includeAutomated=true.

Operation ID: `mailboxListContacts`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `q` | query | string | no | Match address or name. |
| `sort` | query | string | no |  |
| `includeAutomated` | query | string | no |  |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxListContacts } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxListContacts({
  client,
  path: {
    "mailboxId": "mailbox_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/contacts' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox get raw message

`GET /mailbox/v1/mailboxes/{mailboxId}/messages/{messageId}/raw`

Returns a short-lived S3 link to the original .eml. Raw messages are kept for 90 days.

Operation ID: `mailboxGetRawMessage`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `messageId` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxGetRawMessage } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxGetRawMessage({
  client,
  path: {
    "mailboxId": "mailbox_123",
    "messageId": "message_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/messages/message_123/raw' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox get attachment

`GET /mailbox/v1/mailboxes/{mailboxId}/attachments/{attachmentId}`

Attachment metadata with a short-lived S3 download link.

Operation ID: `mailboxGetAttachment`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `attachmentId` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxGetAttachment } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxGetAttachment({
  client,
  path: {
    "mailboxId": "mailbox_123",
    "attachmentId": "attachment_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/attachments/attachment_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox upload attachment

`POST /mailbox/v1/mailboxes/{mailboxId}/attachments`

Stores a file (base64, 8 MiB) and returns an attachment_… ID for the attachments field of send, reply and forward. Unused uploads are deleted after 30 days.

Operation ID: `mailboxUploadAttachment`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filename` | string | yes |  |
| `content` | string | yes |  |
| `contentType` | string | no |  |
| `disposition` | string | no |  |
| `contentId` | string | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxUploadAttachment } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxUploadAttachment({
  client,
  path: {
    "mailboxId": "mailbox_123"
  },
  body: {
    "filename": "Example",
    "content": "example",
    "contentType": "application/octet-stream",
    "disposition": "attachment"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/attachments' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "filename": "Example",
  "content": "example",
  "contentType": "application/octet-stream",
  "disposition": "attachment"
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox reply to message

`POST /mailbox/v1/mailboxes/{mailboxId}/messages/{messageId}/reply`

Replies in the same conversation with In-Reply-To and References set. Replies go to Reply-To (or From) of an inbound message, or to the original recipients of your own sent message. Automated originals (auto-replies, bounces, bulk) and no-reply recipients are refused unless allowAutomated=true. Supports Idempotency-Key.

Operation ID: `mailboxReplyToMessage`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `messageId` | path | string | yes |  |
| `Idempotency-Key` | header | string | no | Optional. Makes retries safe. Repeating a request with the same key and the same body returns the original result without performing the write again; a concurrent duplicate waits for the first request and returns its result. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT. Keys are scoped to the API key, environment and request path, and are retained indefinitely. Without a key, every request is processed, so a retried send can deliver twice. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string | no | Send as the primary address (default) or one of the mailbox aliases. |
| `text` | string | no |  |
| `html` | string | no |  |
| `attachments` | object or object[] | no | Up to 20 files, 8 MiB combined. Types: PDF, text, CSV, JSON, images, ICS and Office documents. |
| `replyTo` | string[] | no |  |
| `headers` | object[] | no |  |
| `autoSubmitted` | string | no | Adds an RFC 3834 Auto-Submitted header so other automated systems do not reply to this message. |
| `replyAll` | boolean | no | Also copy everyone else on the original message. |
| `to` | string[] | no | Override the computed recipients. |
| `cc` | string[] | no |  |
| `bcc` | string[] | no |  |
| `subject` | string | no | Defaults to "Re: <original subject>". |
| `quote` | boolean | no | Append the original message as quoted text. |
| `allowAutomated` | boolean | no | Reply even when the original is automated or the recipient is a no-reply address. |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxReplyToMessage } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxReplyToMessage({
  client,
  path: {
    "mailboxId": "mailbox_123",
    "messageId": "message_123"
  },
  body: {
    "attachments": [],
    "replyTo": [],
    "headers": [],
    "replyAll": false,
    "bcc": [],
    "quote": false,
    "allowAutomated": false
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/messages/message_123/reply' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "attachments": [],
  "replyTo": [],
  "headers": [],
  "replyAll": false,
  "bcc": [],
  "quote": false,
  "allowAutomated": false
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox reply to thread

`POST /mailbox/v1/mailboxes/{mailboxId}/threads/{threadId}/reply`

Replies to the newest inbound message in the conversation (or the newest message if none is inbound). Same options as replying to a message.

Operation ID: `mailboxReplyToThread`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `threadId` | path | string | yes |  |
| `Idempotency-Key` | header | string | no | Optional. Makes retries safe. Repeating a request with the same key and the same body returns the original result without performing the write again; a concurrent duplicate waits for the first request and returns its result. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT. Keys are scoped to the API key, environment and request path, and are retained indefinitely. Without a key, every request is processed, so a retried send can deliver twice. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string | no | Send as the primary address (default) or one of the mailbox aliases. |
| `text` | string | no |  |
| `html` | string | no |  |
| `attachments` | object or object[] | no | Up to 20 files, 8 MiB combined. Types: PDF, text, CSV, JSON, images, ICS and Office documents. |
| `replyTo` | string[] | no |  |
| `headers` | object[] | no |  |
| `autoSubmitted` | string | no | Adds an RFC 3834 Auto-Submitted header so other automated systems do not reply to this message. |
| `replyAll` | boolean | no | Also copy everyone else on the original message. |
| `to` | string[] | no | Override the computed recipients. |
| `cc` | string[] | no |  |
| `bcc` | string[] | no |  |
| `subject` | string | no | Defaults to "Re: <original subject>". |
| `quote` | boolean | no | Append the original message as quoted text. |
| `allowAutomated` | boolean | no | Reply even when the original is automated or the recipient is a no-reply address. |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxReplyToThread } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxReplyToThread({
  client,
  path: {
    "mailboxId": "mailbox_123",
    "threadId": "thread_123"
  },
  body: {
    "attachments": [],
    "replyTo": [],
    "headers": [],
    "replyAll": false,
    "bcc": [],
    "quote": false,
    "allowAutomated": false
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/threads/thread_123/reply' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "attachments": [],
  "replyTo": [],
  "headers": [],
  "replyAll": false,
  "bcc": [],
  "quote": false,
  "allowAutomated": false
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox forward message

`POST /mailbox/v1/mailboxes/{mailboxId}/messages/{messageId}/forward`

Sends the original message with its headers summarized under an optional note, in the same conversation. Original attachments are included by default. Supports Idempotency-Key.

Operation ID: `mailboxForwardMessage`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `messageId` | path | string | yes |  |
| `Idempotency-Key` | header | string | no | Optional. Makes retries safe. Repeating a request with the same key and the same body returns the original result without performing the write again; a concurrent duplicate waits for the first request and returns its result. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT. Keys are scoped to the API key, environment and request path, and are retained indefinitely. Without a key, every request is processed, so a retried send can deliver twice. |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string | no | Send as the primary address (default) or one of the mailbox aliases. |
| `text` | string | no |  |
| `html` | string | no |  |
| `attachments` | object or object[] | no | Up to 20 files, 8 MiB combined. Types: PDF, text, CSV, JSON, images, ICS and Office documents. |
| `replyTo` | string[] | no |  |
| `headers` | object[] | no |  |
| `autoSubmitted` | string | no | Adds an RFC 3834 Auto-Submitted header so other automated systems do not reply to this message. |
| `to` | string[] | yes |  |
| `cc` | string[] | no |  |
| `bcc` | string[] | no |  |
| `subject` | string | no | Defaults to "Fwd: <original subject>". |
| `includeAttachments` | boolean | no | Attach the original attachments (8 MiB combined). |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxForwardMessage } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxForwardMessage({
  client,
  path: {
    "mailboxId": "mailbox_123",
    "messageId": "message_123"
  },
  body: {
    "attachments": [],
    "replyTo": [],
    "headers": [],
    "to": [
      "recipient@example.com"
    ],
    "cc": [],
    "bcc": [],
    "includeAttachments": true
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/messages/message_123/forward' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "attachments": [],
  "replyTo": [],
  "headers": [],
  "to": [
    "recipient@example.com"
  ],
  "cc": [],
  "bcc": [],
  "includeAttachments": true
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `202` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list events

`GET /mailbox/v1/mailboxes/{mailboxId}/events`

Ordered, gap-free event log for one mailbox. Use wait (up to 30 seconds) to long-poll instead of receiving webhooks. Events are kept for 30 days.

Operation ID: `mailboxListEvents`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `mailboxId` | path | string | yes |  |
| `after` | query | string | no | Cursor from a previous response. Omit to start at the current end of the log. |
| `wait` | query | integer or null | no | Seconds to wait for new events when none are ready (long-poll). |
| `types` | query | string | no | Comma-separated event types. |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxListEvents } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxListEvents({
  client,
  path: {
    "mailboxId": "mailbox_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/mailboxes/mailbox_123/events' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list all events

`GET /mailbox/v1/events`



Operation ID: `mailboxListAllEvents`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `after` | query | string | no | Cursor from a previous response. Omit to start at the current end of the log. |
| `wait` | query | integer or null | no | Seconds to wait for new events when none are ready (long-poll). |
| `types` | query | string | no | Comma-separated event types. |
| `limit` | query | integer | no |  |
| `mailboxIds` | query | string | no | Comma-separated mailbox IDs to include. |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxListAllEvents } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxListAllEvents({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/events' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list keys

`GET /mailbox/v1/keys`



Operation ID: `mailboxListKeys`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `includeRevoked` | query | string | no |  |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxListKeys } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxListKeys({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/keys' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox create key

`POST /mailbox/v1/keys`

Scope the key to specific mailboxes, or omit mailboxIds for every mailbox. read lists and reads mail, send sends and replies, modify changes read/archive/label state. The secret is returned once.

Operation ID: `mailboxCreateKey`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `mailboxIds` | string[] | no |  |
| `permissions` | string[] | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxCreateKey } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxCreateKey({
  client,
  body: {
    "name": "Example",
    "permissions": [
      "read",
      "send",
      "modify"
    ]
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/keys' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Example",
  "permissions": [
    "read",
    "send",
    "modify"
  ]
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox revoke key

`POST /mailbox/v1/keys/{id}/revoke`



Operation ID: `mailboxRevokeKey`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxRevokeKey } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxRevokeKey({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/keys/resource_123/revoke' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list webhooks

`GET /mailbox/v1/webhooks`



Operation ID: `mailboxListWebhooks`



### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxListWebhooks } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxListWebhooks({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/webhooks' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox create webhook

`POST /mailbox/v1/webhooks`

Deliveries are signed with Standard Webhooks headers (Webhook-Id, Webhook-Timestamp, Webhook-Signature) and retried with backoff. The endpoint host must be in the deployment webhook allowlist. The signing secret is returned once.

Operation ID: `mailboxCreateWebhook`


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string | yes |  |
| `description` | string | no |  |
| `eventTypes` | string[] | no |  |
| `mailboxIds` | array or null | no | Only events for these mailboxes; null for all. |
| `paused` | boolean | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxCreateWebhook } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxCreateWebhook({
  client,
  body: {
    "url": "https://example.com/webhook",
    "description": "",
    "eventTypes": [
      "message.received"
    ],
    "mailboxIds": null,
    "paused": false
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/webhooks' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "url": "https://example.com/webhook",
  "description": "",
  "eventTypes": [
    "message.received"
  ],
  "mailboxIds": null,
  "paused": false
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | value |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox get webhook

`GET /mailbox/v1/webhooks/{id}`



Operation ID: `mailboxGetWebhook`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxGetWebhook } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxGetWebhook({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/webhooks/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox update webhook

`PATCH /mailbox/v1/webhooks/{id}`



Operation ID: `mailboxUpdateWebhook`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string | no |  |
| `description` | string | no |  |
| `eventTypes` | string[] | no |  |
| `mailboxIds` | array or null | no | Only events for these mailboxes; null for all. |
| `paused` | boolean | no |  |

### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxUpdateWebhook } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxUpdateWebhook({
  client,
  path: {
    "id": "resource_123"
  },
  body: {
    "description": "",
    "eventTypes": [
      "message.received"
    ],
    "mailboxIds": null,
    "paused": false
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request PATCH \
  --url 'https://opensend.anoma.ly/mailbox/v1/webhooks/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "description": "",
  "eventTypes": [
    "message.received"
  ],
  "mailboxIds": null,
  "paused": false
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox delete webhook

`DELETE /mailbox/v1/webhooks/{id}`



Operation ID: `mailboxDeleteWebhook`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxDeleteWebhook } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxDeleteWebhook({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request DELETE \
  --url 'https://opensend.anoma.ly/mailbox/v1/webhooks/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox rotate webhook secret

`POST /mailbox/v1/webhooks/{id}/rotate-secret`



Operation ID: `mailboxRotateWebhookSecret`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxRotateWebhookSecret } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxRotateWebhookSecret({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://opensend.anoma.ly/mailbox/v1/webhooks/resource_123/rotate-secret' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list webhook deliveries

`GET /mailbox/v1/webhooks/{id}/deliveries`



Operation ID: `mailboxListWebhookDeliveries`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxListWebhookDeliveries } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxListWebhookDeliveries({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/webhooks/resource_123/deliveries' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list stored messages

`GET /mailbox/v1/messages`

All received (or sent) messages across every mailbox, including unrouted mail. Newest first, without bodies.

Operation ID: `mailboxListStoredMessages`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `direction` | query | string | no |  |
| `region` | query | string | no |  |
| `mailboxId` | query | string | no |  |
| `q` | query | string | no |  |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxListStoredMessages } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxListStoredMessages({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/messages' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox get stored message

`GET /mailbox/v1/messages/{id}`

Full message with headers, the mailboxes it belongs to, and short-lived download links for attachments and the original MIME.

Operation ID: `mailboxGetStoredMessage`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxGetStoredMessage } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxGetStoredMessage({
  client,
  path: {
    "id": "resource_123"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/messages/resource_123' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |

---

## Mailbox list unrouted

`GET /mailbox/v1/unrouted`

Mail for addresses on a domain whose catch-all is set to store. Creating a mailbox for the address claims it.

Operation ID: `mailboxListUnrouted`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `address` | query | string | no |  |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from 'opensend-js/client';
import { mailboxListUnrouted } from 'opensend-js';

const client = createClient({
  baseUrl: 'https://opensend.anoma.ly',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.OPENSEND_API_KEY
    : undefined,
});

const result = await mailboxListUnrouted({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://opensend.anoma.ly/mailbox/v1/unrouted' \
  --header "Authorization: Bearer $OPENSEND_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400` | Request failed; use error.code and requestId to diagnose. | object |
| `401` | Request failed; use error.code and requestId to diagnose. | object |
| `403` | Request failed; use error.code and requestId to diagnose. | object |
| `404` | Request failed; use error.code and requestId to diagnose. | object |
| `409` | Request failed; use error.code and requestId to diagnose. | object |
| `413` | Request failed; use error.code and requestId to diagnose. | object |
| `422` | Request failed; use error.code and requestId to diagnose. | object |
| `429` | Request failed; use error.code and requestId to diagnose. | object |
| `500` | Request failed; use error.code and requestId to diagnose. | object |
| `503` | Request failed; use error.code and requestId to diagnose. | object |
