# Resend on boxd

> The universal API for sending emails.

- Page: https://boxd.sh/integrations/resend/
- CLI: `run resend` (62 commands, 5 marked common)
- SDK: `import { resend } from "@boxd/run"`; every parameter and response type is at `@boxd/run/resend`
- Triggers: none
- Connect: `run auth resend` (API key), or https://app.boxd.sh/integrations/detail/resend
- All integrations: https://boxd.sh/integrations/ (Markdown: https://boxd.sh/integrations/index.md)

## From the shell

```sh
run auth resend      # once: prints a link to connect your account
run resend           # list its commands
run resend list-all-contacts
```

Parameters are flags (`--flag value`); object and array parameters take a JSON string. Output is YAML, or JSON with `--json`. Calls use your own connection; `--scope <name>` uses a connection shared with your team.

## From a script

```ts
import { every, resend } from "@boxd/run";

every("1 hour", async () => {
  const result = await resend.listAllContacts({});
  console.log(result);
});
```

Run it with `run resend.run.ts`. Resend has no triggers; `every()` polls on a schedule, keeps the script running as a job, and wakes the machine when it is due.

## Commands

Required flags are listed; `run resend <command> --help` lists the optional ones. "common" marks what `run resend` shows without `--all`.

| Command | SDK method | Required flags | Optional | Description |
|---|---|---|---|---|
| `add-contact-to-segment` | `resend.addContactToSegment()` | `--contact-id` `--segment-id` | 0 | Add an existing contact to a segment in Resend |
| `cancel-email` | `resend.cancelEmail()` | `--id` | 0 | Cancel a scheduled email |
| `create-api-key` | `resend.createApiKey()` | `--name` | 2 | Create a new API key to authenticate communications with Resend |
| `create-audience` | `resend.createAudience()` | `--name` | 0 | Create a list of contacts |
| `create-contact` | `resend.createContact()` | `--audienceId` `--email` | 3 | Create a contact in Resend |
| `create-contact-property` | `resend.createContactProperty()` | `--key` `--type` | 1 | Create a new contact property in Resend |
| `create-contact-v2` ·common | `resend.createContactV2()` | `--email` | 6 | Create a new contact in Resend |
| `create-domain` | `resend.createDomain()` | `--name` | 1 | Create a domain through the Resend Email API |
| `create-template` | `resend.createTemplate()` | `--html` `--name` | 6 | Create a new email template in Resend |
| `create-topic` | `resend.createTopic()` | `--defaultSubscription` `--name` | 2 | Create a new topic to segment your audience |
| `create-webhook` | `resend.createWebhook()` | `--endpoint` `--events` | 0 | Create a webhook to receive real-time notifications about email events |
| `delete-api-key` | `resend.deleteApiKey()` | `--api-key-id` | 0 | Remove an existing API key from Resend |
| `delete-audience` | `resend.deleteAudience()` | `--audience-id` | 0 | Remove an existing audience |
| `delete-contact` | `resend.deleteContact()` | `--audienceId` | 2 | Delete a contact in Resend |
| `delete-contact-by-id` | `resend.deleteContactById()` | `--id` | 0 | Remove an existing contact by its ID |
| `delete-contact-property` | `resend.deleteContactProperty()` | `--contact-property-id` | 0 | Remove an existing contact property from Resend |
| `delete-domain` | `resend.deleteDomain()` | `--domain-id` | 0 | Delete a domain through the Resend Email API |
| `delete-segment` | `resend.deleteSegment()` | `--segment-id` | 0 | Remove an existing segment |
| `delete-template` | `resend.deleteTemplate()` | `--template-id` | 0 | Remove an existing template |
| `delete-topic` | `resend.deleteTopic()` | `--id` | 0 | Remove an existing topic in Resend |
| `delete-webhook` | `resend.deleteWebhook()` | `--webhook-id` | 0 | Remove an existing webhook |
| `duplicate-template` | `resend.duplicateTemplate()` | `--template-id` | 0 | Duplicate an existing template through the Resend Email API |
| `get-contact` ·common | `resend.getContact()` | `--contact-id` | 0 | Retrieve a single contact from Resend by ID or email |
| `get-contact-property` | `resend.getContactProperty()` | `--contact-property-id` | 0 | Retrieve a single contact property from Resend |
| `get-email-attachment` | `resend.getEmailAttachment()` | `--attachment-id` `--email-id` | 0 | Retrieve a single attachment from a sent email |
| `get-segment` | `resend.getSegment()` | `--segment-id` | 0 | Retrieve a single segment by its ID |
| `get-template` | `resend.getTemplate()` | `--template-id` | 0 | Retrieve a single template by ID or alias from Resend |
| `get-topic` | `resend.getTopic()` | `--id` | 0 | Retrieve a single topic by its ID in Resend |
| `get-webhook` | `resend.getWebhook()` | `--webhook-id` | 0 | Retrieve a single webhook for the authenticated user |
| `list-all-contacts` ·common | `resend.listAllContacts()` | — | 3 | Retrieve a list of all contacts from Resend |
| `list-api-keys` | `resend.listApiKeys()` | — | 3 | Retrieve a list of API keys for the authenticated user |
| `list-audiences` | `resend.listAudiences()` | — | 3 | List all audiences |
| `list-broadcasts` | `resend.listBroadcasts()` | — | 3 | Retrieve a list of broadcasts |
| `list-contact-properties` | `resend.listContactProperties()` | — | 3 | Retrieve a list of contact properties from Resend |
| `list-contact-segments` | `resend.listContactSegments()` | `--id` | 3 | Retrieve a list of segments that a contact is part of |
| `list-contact-topics` | `resend.listContactTopics()` | `--contact-id` | 3 | Retrieve a list of topic subscriptions for a contact in Resend |
| `list-contacts` | `resend.listContacts()` | `--audienceId` | 3 | List contacts in Resend |
| `list-domains` | `resend.listDomains()` | — | 0 | List all domains |
| `list-email-attachments` | `resend.listEmailAttachments()` | `--email-id` | 3 | Retrieve a list of attachments from a sent email |
| `list-emails` | `resend.listEmails()` | — | 3 | Retrieve a list of emails sent by your team |
| `list-received-emails` | `resend.listReceivedEmails()` | — | 3 | Retrieve a list of received emails for the authenticated user |
| `list-segments` | `resend.listSegments()` | — | 3 | Retrieve a list of segments from Resend |
| `list-templates` | `resend.listTemplates()` | — | 3 | Retrieve a list of templates from Resend |
| `list-topics` | `resend.listTopics()` | — | 3 | Retrieve a list of topics for the authenticated user |
| `list-webhooks` | `resend.listWebhooks()` | — | 3 | Retrieve a list of webhooks for the authenticated user |
| `publish-template` | `resend.publishTemplate()` | `--template-id` | 0 | Publish a template through the Resend Email API |
| `remove-contact-from-segment` | `resend.removeContactFromSegment()` | `--contact-id` `--segment-id` | 0 | Remove an existing contact from a segment |
| `retrieve-audience` | `resend.retrieveAudience()` | `--audience-id` | 0 | Retrieve a single audience |
| `retrieve-contact` | `resend.retrieveContact()` | `--audienceId` `--id` | 0 | Retrieve a contact in Resend |
| `retrieve-domain` | `resend.retrieveDomain()` | `--domain-id` | 0 | Retrieve a single domain |
| `retrieve-email` | `resend.retrieveEmail()` | `--email-id` | 0 | Retrieve a single email |
| `send-batch-emails` ·common | `resend.sendBatchEmails()` | `--emails` | 1 | Trigger up to 100 batch emails at once |
| `send-email` ·common | `resend.sendEmail()` | `--from` `--subject` `--to` | 8 | Send an email using Resend |
| `update-broadcast` | `resend.updateBroadcast()` | `--id` | 9 | Update an existing broadcast in Resend |
| `update-contact` | `resend.updateContact()` | `--id-or-email` | 3 | Update an existing contact in Resend by ID or email |
| `update-contact-property` | `resend.updateContactProperty()` | `--contact-property-id` | 1 | Update an existing contact property in Resend |
| `update-domain` | `resend.updateDomain()` | `--domain-id` | 3 | Update an existing domain |
| `update-email` | `resend.updateEmail()` | `--id` `--scheduled-at` | 0 | Update a scheduled email |
| `update-template` | `resend.updateTemplate()` | `--id` | 8 | Update an existing email template in Resend |
| `update-topic` | `resend.updateTopic()` | `--id` `--name` | 0 | Update an existing topic in Resend |
| `update-webhook` | `resend.updateWebhook()` | `--webhook-id` | 3 | Update an existing webhook configuration |
| `verify-domain` | `resend.verifyDomain()` | `--domain-id` | 0 | Verify a domain through the Resend Email API |

## Docs

- [run CLI](https://docs.boxd.sh/cli/run): Call connected integrations from the shell, connect new ones, and run automations.
- [Quickstart](https://docs.boxd.sh/guides/integrations/quickstart): Connect an integration, call it from the shell, and turn a script into an automation.
- [Connections](https://docs.boxd.sh/guides/integrations/connections): Connect an account once, for yourself or for your whole organization.
- [Scripts](https://docs.boxd.sh/guides/automations/scripts): Typed integrations, triggers, schedules and state in a .run.ts file.
- [Jobs](https://docs.boxd.sh/guides/automations/jobs): How a script becomes a background job: states, retries, sleep and wake.
- [Beyond the catalog](https://docs.boxd.sh/guides/automations/beyond-the-catalog): Reach your own APIs, databases and cloud accounts from a script.
