# SendDart — full documentation > Developer documentation and local blog guides for SendDart (https://www.senddart.com), generated from the same source as the HTML pages. See https://www.senddart.com/llms.txt for the index and https://www.senddart.com/blogs for current CMS articles. # Introduction > SendDart is a developer email platform: send transactional and marketing email from your own verified domain over a clean REST API, with delivery tracking, webhooks, audiences, and campaigns. SendDart lets you send email from **your own domain** through a simple REST API. You verify a domain (SPF, DKIM, DMARC), create an API key, and send — with full delivery, bounce, complaint, open, and click tracking surfaced through the dashboard and webhooks. The API is a **clean, drop-in REST API**: predictable resources (`emails`, `domains`, `audiences`, `contacts`, `campaigns`, `api-keys`), consistent request/response fields, and a uniform `{ statusCode, name, message }` error format. ## What you can do - **Send transactional email** — `POST /emails` with HTML/text, attachments, custom headers, scheduling, and idempotency. - **Verify sending domains** — generate and check SPF/DKIM/DMARC DNS records, toggle open/click tracking per domain. - **Manage audiences & contacts** — build contact lists with subscribe/unsubscribe state. - **Send campaigns** — marketing email to an audience, with per-contact unsubscribe and performance tracking. - **Receive events** — delivery, bounce, complaint, open, and click events via signed webhooks and the per-email log. ## How sending works 1. **Add and verify a domain** — Add your domain in the dashboard and publish the SPF/DKIM/DMARC records it generates. See [Managing domains](https://www.senddart.com/docs/domains/managing). 2. **Create an API key** — Generate an `mb_` API key in the dashboard. See [Authentication](https://www.senddart.com/docs/authentication). 3. **Send your first email** — Call `POST /emails` from your verified domain. See the [Quickstart](https://www.senddart.com/docs/quickstart). 4. **Track results** — Watch delivery/open/click events in the dashboard and via [webhooks](https://www.senddart.com/docs/webhooks/overview). > **Note:** New here? Start with the [Quickstart](https://www.senddart.com/docs/quickstart) — it sends a real email in under five minutes. --- # Quickstart > Send your first email with the SendDart API in a few minutes. ## Prerequisites 1. A **verified domain** — add one under Domains and publish its DNS records. ([guide](https://www.senddart.com/docs/domains/managing)) 2. An **API key** — create one under API Keys. It starts with `mb_` and is shown once. ([guide](https://www.senddart.com/docs/authentication)) ## Install the SDK Install the official SDK for your language — Node.js, Python, Ruby, PHP, Go, Rust, Java, .NET, or the CLI. Every install command is listed on [SDKs](https://www.senddart.com/docs/resources/sdks). The Node.js examples throughout these docs use the `senddart` npm package; each example also has tabs for the other packages and a dependency-free cURL tab if you prefer no SDK at all. ```sh npm install senddart # Node.js pip install senddart # Python composer require senddart/senddart # PHP ``` ## Send an email Replace `mb_xxxxxxxxx` with your API key and use a `from` address on your verified domain. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from SendDart", "html": "

Your first email 🎉

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Hello from SendDart", "html": "

Your first email 🎉

" }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Hello from SendDart", 'html' => "

Your first email 🎉

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Hello from SendDart", "html": "

Your first email 🎉

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Hello from SendDart", Html: "

Your first email 🎉

", }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Hello from SendDart", ) .with_html("

Your first email 🎉

"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Hello from SendDart") .html("

Your first email 🎉

") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Hello from SendDart", HtmlBody = "

Your first email 🎉

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from SendDart", "html": "

Your first email 🎉

" }' ``` **CLI** ```bash senddart emails send \ --from 'Acme ' \ --to 'delivered@test.senddart.com' \ --subject 'Hello from SendDart' \ --html '

Your first email 🎉

' ``` ## Response A successful send returns the email `id` you can use to [retrieve the email](https://www.senddart.com/docs/api/emails-get) or correlate webhook events. ```json { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` > **Warning:** If you get `validation_error` about the domain not being verified, finish the DNS verification first — emails can only be sent from a verified domain you own (or a subdomain of one). ## Test addresses To simulate delivery events without sending to a real inbox (and without damaging your domain reputation), send to one of these reserved test recipients: | Address | Simulates | | --- | --- | | `delivered@test.senddart.com` | A successful delivery. | | `bounced@test.senddart.com` | A hard bounce. | | `complained@test.senddart.com` | A spam complaint. | | `suppressed@test.senddart.com` | A recipient on the suppression list. | ## Avoid duplicates with an idempotency key To safely retry a send without delivering the same email twice, pass an `Idempotency-Key` header. A repeated request with the same key within the window returns the original result instead of sending again. - Must be **unique per logical request**. - Keys expire after **24 hours**. - Maximum length **255 characters**. - Recommended pattern: `/` — for example `welcome-user/123456789`. ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: welcome-user/123456789' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from SendDart", "html": "

Your first email 🎉

" }' ``` ## Next steps - [Schedule an email](https://www.senddart.com/docs/emails/schedule) for later delivery. - [Add attachments](https://www.senddart.com/docs/emails/attachments) or [custom headers](https://www.senddart.com/docs/emails/headers). - [Send a batch](https://www.senddart.com/docs/emails/batch) of up to 100 emails in one request. - [Receive webhooks](https://www.senddart.com/docs/webhooks/overview) for delivery and engagement events. --- # Authentication > Authenticate every API request with a Bearer API key. The SendDart API authenticates with an API key sent as a Bearer token. Keys are created **in the dashboard** under **API Keys** — see [Create an API key](https://www.senddart.com/docs/create-an-api-key). The full key is shown **once** at creation and stored only as a hash afterward. ## Base URL The API is built on **REST** principles and is served over **HTTPS only** — plain HTTP is not supported. Every request goes to the same base URL: ```text https://www.senddart.com/api ``` ## Authorization header Add an `Authorization` header whose value is `Bearer ` followed by your API key: ```bash Authorization: Bearer mb_xxxxxxxxx ``` > **Warning:** Treat API keys like passwords. Never commit them or expose them in client-side code — call the API from your server. ## User-Agent header Every API request must also include a `User-Agent` header. Requests without one are rejected with a `403`, even when the API key is valid. Most HTTP clients set this automatically, but if you build requests by hand, set it explicitly: ```text User-Agent: my-app/1.0 ``` > **Warning:** If you get a `403` despite a valid API key, a missing `User-Agent` header is the most likely cause. ## Permissions Each key has a permission level: | Permission | Can do | | --- | --- | | **full_access** | Send email **and** manage resources (domains, audiences, contacts, campaigns). | | **sending_access** | Send email only. Cannot create, update, or delete domains, audiences, contacts, or campaigns. | A `sending_access` key is the safest choice for a server that only needs to send transactional email. See [Create an API key](https://www.senddart.com/docs/create-an-api-key). > **Warning:** Neither permission covers API keys themselves. Creating a key, changing its permission or domain restriction, and revoking it are **dashboard-only** actions: `POST /api-keys`, `PATCH /api-keys/:id`, and `DELETE /api-keys/:id` refuse every API-key caller with `403 dashboard_only`, whatever its permission. Sign in to the dashboard to manage keys. This is a breaking change — if you previously automated those three calls with a full-access key, that automation now fails and the steps must be done in the dashboard. ## Rate limit Rate limits are enforced over **60-second windows, per client IP** — not per key or per team: roughly **30 requests per minute** on the send endpoints, **20 per minute** on expensive endpoints (such as AI and support), and **120 per minute** on general public endpoints. There is no separate burst allowance, and requests from multiple services behind the same address count together. Exceeding a limit returns a `429`. See [Account quotas and limits](https://www.senddart.com/docs/kb/quotas). ## Errors A missing key returns `401 missing_api_key`; an invalid or revoked key returns `403 invalid_api_key`; a key without the required permission returns `401 restricted_api_key`; an API key calling a dashboard-only endpoint returns `403 dashboard_only`; a missing `User-Agent` returns `403`. See [Errors](https://www.senddart.com/docs/api/errors). --- # Create an API key > Get started sending email by creating an API key to authenticate your SendDart requests. ## What is an API key? API keys are secret tokens used to authenticate your requests. They are unique to your account and should be kept confidential. You must create at least one API key to use the SendDart platform through code — for example from your server, a script, or any HTTP client. ## Create an API key API keys are created on the **API Keys** page of the SendDart dashboard, and only there. An API key can never create, re-scope, or revoke another key — a key that calls `POST /api-keys`, `PATCH /api-keys/:id`, or `DELETE /api-keys/:id` is refused with `403 dashboard_only`, no matter what permission it holds. This keeps a leaked sending key from quietly promoting itself into an administrative one. > **Warning:** This is a breaking change. If you previously scripted key creation, permission changes, or revocation against the API with a full-access key, those calls now return `403 dashboard_only` and the steps must be done by a signed-in person in the dashboard. Reading your keys still works over the API: `GET /api-keys` returns key metadata (never the token). To create a new API key from the SendDart dashboard: 1. **Open the API Keys page** — In your SendDart dashboard, navigate to the **API Keys** page. 2. **Click Create API Key** — Click the **Create API Key** button to open the creation modal. 3. **Name your key** — Choose a name (maximum 50 characters) to identify your key — for example `production-server` or `staging`. 4. **Select a permission** — Choose **Sending access** to grant access to only sending email, unless your key needs **Full access** to create, delete, get, and update any resource. You can change the permission later by editing the key on the same **API Keys** page — but only from the dashboard, never with an API key. 5. **(Optional) Restrict to a domain** — If you selected **Sending access**, you can further restrict the key to a single verified domain, so it can only send `from` addresses on that domain. > **Warning:** For security reasons, the full API key is shown **only once**, at creation. SendDart stores only a hash of the key afterward — copy it immediately and store it somewhere safe. If you lose it, revoke the key and create a new one. ## Use the API key in your code Authenticate your requests by adding your SendDart API key to your project as an environment variable, then sending it as a Bearer token on every request. 1. **Create and store an environment variable** — Store your API key as an environment variable rather than hardcoding it. For example, Node.js projects commonly keep secrets in a `.env` file at the project root. 2. **Pass the variable to your code** — Read the variable at runtime and send it in the `Authorization` header. Your environment variables are not automatically available to SendDart — you must pass the value explicitly on each request. **.env** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` > **Note:** If you store secrets in a project file, add that file to `.gitignore` to keep it out of version control. Many frameworks add `.env` to `.gitignore` by default, so this may already be done. > **Note:** On Node.js `v20` and later you can load a `.env` file into `process.env` with the built-in `--env-file=.env` flag (for example `node --env-file=.env app.js`). On earlier versions, use a loader such as the `dotenv` package. Read the key from the environment and send it as a Bearer token: **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from SendDart", "html": "

It works!

" }' ``` **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY); const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello from SendDart', html: '

It works!

', }); console.log({ data, error }); ``` **Python** ```python import os import requests res = requests.post( "https://www.senddart.com/api/emails", headers={"Authorization": f"Bearer {os.environ['SENDDART_API_KEY']}"}, json={ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from SendDart", "html": "

It works!

", }, ) print(res.json()) ``` > **Warning:** Treat API keys like passwords. Never commit them or expose them in client-side code — always call the API from your server. See [Authentication](https://www.senddart.com/docs/authentication) for the full permission model. ## Next steps - [Add a domain](https://www.senddart.com/docs/add-a-domain) you own and verify it to start sending. - Send your first transactional email with the [Quickstart](https://www.senddart.com/docs/quickstart). - Review the [Authentication](https://www.senddart.com/docs/authentication) permission levels and error codes. --- # Add a domain > Get started sending email by adding and verifying a domain you own. SendDart sends email using a domain you own. Before you can send email, you must have a **verified domain** associated with your account. Verification publishes DNS records that prove you control the domain and let receiving servers authenticate your mail (SPF and DKIM), which is essential for deliverability. ## Add a domain You can add and verify a domain you own in two ways: - In the **Domains** dashboard page. - Using the [SendDart API](https://www.senddart.com/docs/api/domains-create). To add a new domain from the SendDart dashboard: 1. **Open the Domains page** — In your SendDart dashboard, navigate to the **Domains** page. 2. **Click Add Domain** — Click the **Add Domain** button. 3. **Enter your domain (use a subdomain)** — We strongly recommend sending from a subdomain such as `notifications.example.com` instead of your root domain `example.com`, to follow deliverability best practices. Choose a subdomain that reflects the purpose of your mail, like `customers.example.com` or `updates.example.com`. You can have multiple subdomains under one root domain, but each must be configured and verified individually. 4. **Choose a region** — Select the region to send your email from. Choose the one closest to the majority of your recipients to reduce latency. 5. **(Optional) Set a custom Return-Path** — The Return-Path defaults to `send.example.com`. You can provide a custom subdomain for the Return-Path address if you prefer. 6. **Update your DNS records** — Open the **Records** tab for your domain to find the records to add at your DNS host. Add the SPF and DKIM records (`TXT` and `MX`) exactly as SendDart generated them — copy and paste to avoid configuration errors. These records prove you own the domain and have permission to send. 7. **Wait for verification** — When the records are correct, your domain often verifies within 15 minutes. DNS changes can occasionally take up to 72 hours to propagate globally. If verification has not completed after 72 hours, use the **Restart verification** button in the dashboard to trigger a fresh check. 8. **Add a DMARC record** — After your domain is verified, add a DMARC record to build additional trust in your domain and protect against spoofing. DMARC is an authentication protocol that lets receivers reject unauthenticated messages, and it is important for deliverability. 9. **(Optional) Update domain settings** — Once verified, you may wish to enable open and click tracking or enforce TLS for the domain. See [Managing domains](https://www.senddart.com/docs/domains/managing). > **Note:** You can verify your records are publicly visible with any public DNS lookup tool before waiting on SendDart. If the records resolve but the domain still will not verify, double-check that the values match exactly — a trailing space or wrapped line is the most common cause. ## What gets published The Records tab lists every DNS record SendDart needs. A typical setup includes: **DNS records** | Name | Type | Required | Description | | --- | --- | --- | --- | | `DKIM (TXT)` | authentication | No | A single TXT record at `senddart._domainkey.yourdomain.com` holding your domain’s public key. Signs your messages so receivers can verify they were not altered in transit. Required. | | `SPF (TXT) + MX` | authentication | No | Authorizes SendDart to send on behalf of your sending subdomain and routes the Return-Path. Required. | | `DMARC (TXT)` | policy | No | Tells receivers what to do with mail that fails SPF/DKIM. Added after verification; strongly recommended. | > **Warning:** Emails can only be sent from a verified domain you own — or a subdomain of one. Until verification completes, `POST /emails` will reject sends from that domain with a `validation_error`. ## Next steps - [Create an API key](https://www.senddart.com/docs/create-an-api-key) if you have not already. - Send your first email with the [Quickstart](https://www.senddart.com/docs/quickstart). - Learn how to edit, re-verify, and configure domains in [Managing domains](https://www.senddart.com/docs/domains/managing). --- # Explore sending features > SendDart has a wide range of features for sending both transactional and marketing email. SendDart provides a REST API, webhooks, audiences, campaigns, and a dashboard for both kinds of email you need to send: - **Transactional email** — personalized, event-driven messages. - **Marketing campaigns** — bulk [campaigns](https://www.senddart.com/docs/campaigns/managing) distributed to a contact list. All of these features are also available through the dashboard, so your whole team can create and send email, manage contacts, and track performance — not just developers calling the API. ## I need to send transactional email A **transactional email** is a message triggered by a user action or required for legal compliance. It is typically a **1-to-1** message sent in response to a specific event. Common examples include: - Order confirmations - Password reset emails - Account notifications Send transactional email from your application with a single `POST /emails` request from your verified domain: **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["customer@example.com"], "subject": "Your order is confirmed", "html": "

Thanks for your order!

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "customer@example.com" ], "subject": "Your order is confirmed", "html": "

Thanks for your order!

" }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "customer@example.com" ], 'subject' => "Your order is confirmed", 'html' => "

Thanks for your order!

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "customer@example.com" ], "subject": "Your order is confirmed", "html": "

Thanks for your order!

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"customer@example.com"}, Subject: "Your order is confirmed", Html: "

Thanks for your order!

", }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["customer@example.com"], "Your order is confirmed", ) .with_html("

Thanks for your order!

"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("customer@example.com") .subject("Your order is confirmed") .html("

Thanks for your order!

") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "customer@example.com", Subject = "Your order is confirmed", HtmlBody = "

Thanks for your order!

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["customer@example.com"], "subject": "Your order is confirmed", "html": "

Thanks for your order!

" }' ``` **CLI** ```bash senddart emails send \ --from 'Acme ' \ --to 'customer@example.com' \ --subject 'Your order is confirmed' \ --html '

Thanks for your order!

' ``` You can also receive [webhooks](https://www.senddart.com/docs/webhooks/overview) for delivery and engagement events, [schedule](https://www.senddart.com/docs/emails/schedule) email for later, and add [attachments](https://www.senddart.com/docs/emails/attachments) or [custom headers](https://www.senddart.com/docs/emails/headers). ## I need to send bulk marketing email Marketing emails are **promotional**, **informative**, or general-communication messages. They are typically **1-to-many**, sent when you want to reach a larger audience (for example, a newsletter). Examples include: - Promotional offers and discounts - Newsletters - Product updates > **Warning:** Marketing email is regulated by laws like **CAN-SPAM** (US) and **CASL** (Canada). Recipients must have a working option to unsubscribe — SendDart adds a per-contact unsubscribe to every campaign for you. Send [campaigns](https://www.senddart.com/docs/campaigns/managing) to your subscribers from the dashboard or the Campaigns API. With campaigns you get tools for [managing your audiences and contacts](https://www.senddart.com/docs/audiences/overview), tracking performance, and per-contact unsubscribe handling. SendDart also handles queuing, throttling, and scheduling so you do not have to roll your own infrastructure. ## I need to send a combination of email It is common to need both. Your customers need personalized messages about their orders, but may also subscribe to a newsletter sent to your entire contact list. Some email does not fit neatly into one category: - Marketing email can be **1-to-1** when based on personalized activity (e.g. abandoned-cart reminders or drip campaigns). You can send these through the transactional `POST /emails` API, as long as proper consent and compliance rules are followed. - The [batch send](https://www.senddart.com/docs/emails/batch) endpoint can send multiple transactional emails at once (up to 100), even to different recipients with unique content, instead of one request per email. You can use SendDart’s opinionated, full-featured solutions or design your own architecture from the ground up — all of the API, webhooks, audiences, campaigns, and dashboard controls are available for any type of sending you build. ## Learn more - [Send Email API](https://www.senddart.com/docs/api/emails-send) — send, list, retrieve, and cancel transactional email. - [Campaigns](https://www.senddart.com/docs/campaigns/managing) — create and send marketing email to an audience. - [Audiences & contacts](https://www.senddart.com/docs/audiences/overview) — build and manage contact lists. - [Webhooks](https://www.senddart.com/docs/webhooks/overview) — receive delivery and engagement events. ## Next steps - [Add a domain](https://www.senddart.com/docs/add-a-domain) and [create an API key](https://www.senddart.com/docs/create-an-api-key) if you have not yet. - Send your first transactional email with the [Quickstart](https://www.senddart.com/docs/quickstart). - Import or add contacts to an [audience](https://www.senddart.com/docs/audiences/overview) to prepare your first campaign. --- # Next.js > Send your first email from a Next.js Route Handler with the official senddart SDK. Send your first email from a Next.js app with the official [`senddart`](https://www.senddart.com/docs/resources/sdks) SDK. Install it, create a client with your API key, and call `mb.emails.send(...)` from server-side code — a Route Handler, a Server Action, or any API route. ```sh npm install senddart ``` ## Prerequisites Before you start, you will need: - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Set your API key Store your API key in an environment variable in your project's `.env.local`. Never hardcode the key in source. **.env.local** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 2. Send an email from a Route Handler Create a route file under `app/api/send/route.ts` (App Router). It reads the key from `process.env`, sends with the SDK, and returns the created email's `id`. **App Router** ```ts // app/api/send/route.ts import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY!); export async function POST() { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello world', html: 'It works!', }); if (error) return Response.json({ error }, { status: 400 }); return Response.json(data); } ``` **Pages Router** ```ts // pages/api/send.ts import type { NextApiRequest, NextApiResponse } from 'next'; import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY!); export default async function handler( req: NextApiRequest, res: NextApiResponse, ) { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello world', html: 'It works!', }); if (error) return res.status(400).json({ error }); return res.status(200).json(data); } ``` > **Warning:** Only call the SendDart API from server-side code (Route Handlers, Server Actions, API routes). Never ship your API key to the browser. ## 3. Response A successful send returns the created email's `id`. Retrieve it later with [GET /emails/:id](https://www.senddart.com/docs/api/emails-get). ```json { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` > **Note:** See the full request body — `cc`, `bcc`, `reply_to`, `attachments`, `scheduled_at` — in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Node.js > Send your first email from Node.js using the global fetch and the SendDart API. SendDart ships an official Node.js SDK (`npm install senddart`) — see [Send emails with Node.js](https://www.senddart.com/docs/integrations/nodejs) for the typed client — but you do not need it: this guide sends email by making an HTTP request to `https://www.senddart.com/api/emails`. Node.js 18+ has a global `fetch`, so no dependencies are required. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - Node.js 18 or newer (for the built-in `fetch`). ## 1. Set your API key Store your API key in a `.env` file and load it however your app already does (for example with `node --env-file=.env`, available in Node.js 20+). **.env** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 2. Send email using HTML The easiest way to send an email is with the `html` field. **fetch (ESM)** ```js // server.js const res = await fetch('https://www.senddart.com/api/emails', { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.SENDDART_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello World', html: 'It works!', }), }); if (!res.ok) { console.error(await res.json()); } else { const { id } = await res.json(); console.log({ id }); // { id: '49a3999c-...' } } ``` **https (no fetch)** ```js // server.js — for runtimes without a global fetch import https from 'node:https'; const body = JSON.stringify({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello World', html: 'It works!', }); // node:https sends no default User-Agent, and the API rejects UA-less // requests with a 403 validation_error — so set it explicitly. const req = https.request('https://www.senddart.com/api/emails', { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.SENDDART_API_KEY}`, 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body), 'User-Agent': 'my-app/1.0', }, }, (res) => { let data = ''; res.on('data', (chunk) => (data += chunk)); res.on('end', () => console.log(res.statusCode, data)); }); req.write(body); req.end(); ``` ## Idempotency To make a retry safe, add an `Idempotency-Key` header so the same logical send is processed only once. See [Idempotency keys](https://www.senddart.com/docs/emails/idempotency). ```js await fetch('https://www.senddart.com/api/emails', { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.SENDDART_API_KEY}`, 'Content-Type': 'application/json', 'Idempotency-Key': 'welcome-user/123456789', }, body: JSON.stringify({ /* ... */ }), }); ``` > **Note:** Idempotency keys are remembered for 24 hours and should be unique per logical send. --- # PHP > Send your first email from PHP using cURL against the SendDart API. SendDart ships an official PHP SDK — see [Send emails with PHP](https://www.senddart.com/docs/integrations/php) for the `composer require senddart/senddart` path — but you do not need it: this guide sends email by POSTing JSON to `https://www.senddart.com/api/emails`. The examples below use PHP's built-in cURL extension, which ships with most PHP installs. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - PHP with the `curl` extension enabled — any version can run the raw cURL example below. - PHP 8.1 or newer if you install the official `senddart/senddart` package, which also needs the `json` extension. ## 1. Set your API key Read your API key from the environment rather than hardcoding it. Set `SENDDART_API_KEY` in your environment (or your framework's `.env`). **.env** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 2. Send email using HTML The easiest way to send an email is with the `html` field. **index.php** ```php 'Acme ', 'to' => ['delivered@test.senddart.com'], 'subject' => 'hello world', 'html' => 'it works!', ]); $ch = curl_init('https://www.senddart.com/api/emails'); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => $payload, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . $apiKey, 'Content-Type: application/json', // REQUIRED: PHP cURL sends no User-Agent of its own, and the API answers a // request without one with 403 validation_error before it authenticates. 'User-Agent: my-app/1.0', ], ]); $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE); curl_close($ch); if ($status >= 200 && $status < 300) { $data = json_decode($response, true); echo $data['id']; } else { echo 'Error: ' . $response; } ``` > **Note:** A successful call returns the created email's `id`. See the full set of body fields in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. ## Laravel / Symfony In a framework, you can use the HTTP client you already have — Laravel's `Http` facade or Symfony's `HttpClient` — pointing at `https://www.senddart.com/api/emails` with the same `Authorization: Bearer` header. The request body shape is identical to the cURL example above. See [Send emails with PHP & Laravel](https://www.senddart.com/docs/integrations/php-laravel) for the framework walkthrough, or [Send emails with PHP](https://www.senddart.com/docs/integrations/php) to use the official package instead. --- # Python > Send your first email from Python using requests against the SendDart API. SendDart ships an official Python SDK — see [Send emails with Python](https://www.senddart.com/docs/integrations/python) for the `pip install senddart` path — but you do not need it: this guide sends email by POSTing JSON to `https://www.senddart.com/api/emails`. The examples below use the popular [`requests`](https://pypi.org/project/requests/) library, but any HTTP client (including the stdlib `urllib`) works. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - Python 3.8 or newer if you install the official `senddart` package (it declares `requires-python >= 3.8`). The `requests` example below runs on older interpreters too. ## 1. Install an HTTP client **Pip** ```bash pip install requests ``` ## 2. Set your API key Read your key from the environment so it never lives in source. **.env** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send email using HTML The easiest way to send an email is with the `html` field. **requests** ```python import os import requests res = requests.post( "https://www.senddart.com/api/emails", headers={"Authorization": f"Bearer {os.environ['SENDDART_API_KEY']}"}, json={ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "hello world", "html": "it works!", }, ) res.raise_for_status() print(res.json()["id"]) ``` **urllib (stdlib)** ```python import json, os, urllib.request body = json.dumps({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "hello world", "html": "it works!", }).encode() req = urllib.request.Request( "https://www.senddart.com/api/emails", data=body, headers={ "Authorization": f"Bearer {os.environ['SENDDART_API_KEY']}", "Content-Type": "application/json", }, method="POST", ) with urllib.request.urlopen(req) as resp: print(json.load(resp)["id"]) ``` > **Note:** Inside Flask, FastAPI, or Django, call the API the same way from your view/route handler. See [Send an email](https://www.senddart.com/docs/api/emails-send) for every body field. --- # Ruby > Send your first email from Ruby using Net::HTTP against the SendDart API. This guide sends email by POSTing JSON to `https://www.senddart.com/api/emails` using the standard-library `net/http`, so there is nothing to install. Want the official gem instead? [Send emails with Ruby](https://www.senddart.com/docs/integrations/ruby-rails) installs `senddart` and calls `SendDart::Emails.send`. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - Ruby 2.7 or newer if you install the official `senddart` gem (that is the gemspec floor). The `net/http` example below runs on any supported Ruby. ## 1. Set your API key **.env** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 2. Send email using HTML The easiest way to send an email is with the `html` field. **index.rb** ```rb require "net/http" require "json" require "uri" uri = URI("https://www.senddart.com/api/emails") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch('SENDDART_API_KEY')}" request["Content-Type"] = "application/json" # Required: the API answers a missing User-Agent with 403 validation_error. request["User-Agent"] = "acme-app/1.0" request.body = { from: "Acme ", to: ["delivered@test.senddart.com"], subject: "hello world", html: "it works!", }.to_json response = http.request(request) puts JSON.parse(response.body)["id"] ``` > **Note:** In a Rails or Sinatra app, issue this request from a controller/route — the JSON body is identical. See [Send an email](https://www.senddart.com/docs/api/emails-send) for all fields. --- # Go > Send your first email from Go using net/http against the SendDart API. This guide sends email by POSTing JSON to `https://www.senddart.com/api/emails` using only the standard-library `net/http` and `encoding/json`, so there are no third-party dependencies. Want the typed client instead? [Send emails with Go](https://www.senddart.com/docs/integrations/go) installs the official module. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - Go 1.22 or newer if you use the official module (that is the floor in its `go.mod`). The standard-library example below builds on Go 1.18 and up (it uses the `any` alias). ## 1. Set your API key **.env** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 2. Send email using HTML The easiest way to send an email is with the `html` field. **main.go** ```go package main import ( "bytes" "encoding/json" "fmt" "net/http" "os" ) func main() { payload, _ := json.Marshal(map[string]any{ "from": "Acme ", "to": []string{"delivered@test.senddart.com"}, "subject": "Hello from Go", "html": "hello world", }) req, _ := http.NewRequest("POST", "https://www.senddart.com/api/emails", bytes.NewReader(payload)) req.Header.Set("Authorization", "Bearer "+os.Getenv("SENDDART_API_KEY")) req.Header.Set("Content-Type", "application/json") // Required: the API answers a missing User-Agent with 403 validation_error. req.Header.Set("User-Agent", "acme-app/1.0") res, err := http.DefaultClient.Do(req) if err != nil { fmt.Println(err.Error()) return } defer res.Body.Close() var out struct { ID string `json:"id"` } json.NewDecoder(res.Body).Decode(&out) fmt.Println(out.ID) } ``` > **Note:** Drop this into a Chi or Gin handler to send from a web request. See [Send an email](https://www.senddart.com/docs/api/emails-send) for `cc`, `bcc`, `reply_to`, and more. --- # Rust > Send your first email from Rust using reqwest against the SendDart API. SendDart ships an official Rust crate (`cargo add senddart`) — see [Send emails with Rust](https://www.senddart.com/docs/integrations/rust) for the typed, async client — but you do not need it: this guide sends email by POSTing JSON to `https://www.senddart.com/api/emails`. The example below uses the async [`reqwest`](https://crates.io/crates/reqwest) client with [Tokio](https://tokio.rs). ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - An async runtime — Tokio below; any executor that can drive `reqwest` futures works. - Rust 1.75 or newer if you add the official `senddart` crate, which declares that as its `rust-version`. ## 1. Create a project and add dependencies Create a Cargo project and add an async HTTP client plus a runtime. ```bash cargo init senddart-rust-example cd senddart-rust-example cargo add reqwest -F json cargo add tokio -F macros,rt-multi-thread cargo add serde_json ``` ## 2. Set your API key ```bash export SENDDART_API_KEY=mb_xxxxxxxxx ``` > **Note:** Rust does not read `.env` files on its own, and the example below calls `std::env::var` directly. Export the variable in your shell, or add [`dotenvy`](https://crates.io/crates/dotenvy) (`cargo add dotenvy`) and call `dotenvy::dotenv().ok();` as the first line of `main`. ## 3. Send email **src/main.rs** ```rust use serde_json::json; #[tokio::main] async fn main() -> Result<(), Box> { let api_key = std::env::var("SENDDART_API_KEY")?; let res = reqwest::Client::new() .post("https://www.senddart.com/api/emails") .bearer_auth(api_key) // REQUIRED: reqwest sends no User-Agent of its own, and the API answers // a request without one with 403 validation_error before it authenticates. .header("User-Agent", "my-app/1.0") .json(&json!({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello World", "html": "It works!", })) .send() .await?; let body: serde_json::Value = res.json().await?; println!("{}", body["id"]); Ok(()) } ``` > **Note:** Inside an Axum app, send this request from a handler. See [Send an email](https://www.senddart.com/docs/api/emails-send) for the full body schema. --- # Elixir > Send your first email from Elixir using Req against the SendDart API. SendDart has no Elixir package — you send email by POSTing JSON to `https://www.senddart.com/api/emails`. The example below uses [`Req`](https://hex.pm/packages/req), a batteries-included HTTP client. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install an HTTP client Add `req` to your dependencies in `mix.exs`, then run `mix deps.get`. **mix.exs** ```elixir def deps do [ {:req, "~> 0.5"} ] end ``` ## 2. Send email using HTML Read the API key from the environment and POST the email body. The easiest way to send is with the `html` field. **send.exs** ```elixir api_key = System.get_env("SENDDART_API_KEY") response = Req.post!("https://www.senddart.com/api/emails", auth: {:bearer, api_key}, json: %{ from: "Acme ", to: ["delivered@test.senddart.com"], subject: "hello world", html: "it works!" } ) IO.inspect(response.body["id"]) ``` > **Note:** In a Phoenix app, send from a controller action with the same body. See [Send an email](https://www.senddart.com/docs/api/emails-send) for every supported field. --- # Java > Send your first email from Java using the built-in HttpClient against the SendDart API. SendDart ships an official Java SDK (`com.senddart:senddart:5.1.1` on Maven Central, usable from Kotlin too) — see [Send emails with Java & Kotlin](https://www.senddart.com/docs/integrations/java) for the typed client — but you do not need it: this guide sends email by POSTing JSON to `https://www.senddart.com/api/emails`. The example below uses the `java.net.http.HttpClient` introduced in Java 11, so no dependencies are required. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - Java 11 or newer (for the built-in `HttpClient`). ## 1. Set your API key **.env** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 2. Send emails using HTML **Main.java** ```java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class Main { public static void main(String[] args) throws Exception { String apiKey = System.getenv("SENDDART_API_KEY"); // Written as concatenated literals, not a text block: text blocks are a // standard language feature only from Java 15, and this page targets 11. String body = "{" + "\"from\": \"Acme \"," + "\"to\": [\"delivered@test.senddart.com\"]," + "\"subject\": \"it works!\"," + "\"html\": \"hello world\"" + "}"; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://www.senddart.com/api/emails")) .header("Authorization", "Bearer " + apiKey) .header("Content-Type", "application/json") // Every SendDart API request must carry a User-Agent; HttpClient // sends a default one, but set your own so it identifies your app. .header("User-Agent", "my-app/1.0") .POST(HttpRequest.BodyPublishers.ofString(body)) .build(); HttpResponse response = HttpClient.newHttpClient() .send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.statusCode()); System.out.println(response.body()); } } ``` > **Note:** In Spring Boot, the simplest route is to add the `com.senddart:senddart` dependency and expose one `@Bean SendDart senddart()` built from your API key — the artifact has zero transitive dependencies, so it will not clash with your HTTP stack. Prefer no dependency? `RestClient` or `WebClient` work against the same URL with the same Bearer header. See [Send an email](https://www.senddart.com/docs/api/emails-send) for all fields. --- # .NET > Send your first email from .NET using HttpClient against the SendDart API. Install the official `SendDart` NuGet package for typed access to the whole API — [Send emails with .NET & C#](https://www.senddart.com/docs/integrations/dotnet) is the guide for that — or POST JSON straight to `https://www.senddart.com/api/emails`. The example below uses the built-in `HttpClient`, which you can register in your app's DI container. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - .NET 8.0 or newer if you install the official `SendDart` package — it targets `net8.0` only, so a `net6.0`/`net7.0` or .NET Framework project cannot restore it. ## 1. Register an HttpClient In the startup of your application, register a named or typed `HttpClient` pointed at the SendDart API, reading the key from configuration/environment. ```csharp builder.Services.AddHttpClient("SendDart", client => { client.BaseAddress = new Uri("https://www.senddart.com/api/"); client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue( "Bearer", Environment.GetEnvironmentVariable("SENDDART_API_KEY")); // REQUIRED: HttpClient sends no User-Agent of its own, and the API answers a // request without one with 403 validation_error before it authenticates. client.DefaultRequestHeaders.UserAgent.ParseAdd("my-app/1.0"); }); ``` ## 2. Send emails using HTML Resolve the client and POST the email body as JSON. ```csharp using System.Net.Http.Json; public class FeatureImplementation { private readonly IHttpClientFactory _factory; public FeatureImplementation(IHttpClientFactory factory) { _factory = factory; } public async Task Execute() { var client = _factory.CreateClient("SendDart"); var message = new { from = "Acme ", to = new[] { "delivered@test.senddart.com" }, subject = "hello world", html = "it works!", }; var response = await client.PostAsJsonAsync("emails", message); response.EnsureSuccessStatusCode(); var result = await response.Content.ReadFromJsonAsync(); Console.WriteLine(result?.Id); } private record EmailResult(string Id); } ``` > **Note:** This works the same in an ASP.NET Minimal API or MVC app. See [Send an email](https://www.senddart.com/docs/api/emails-send) for the complete request body. --- # Astro > Send your first email from an Astro Action using the senddart SDK. Send your first email from an Astro app using the `senddart` Node SDK. Install it with `npm install senddart`, then import `SendDart` and call `mb.emails.send()`. Because Astro runs server code on demand, an [Astro Action](https://docs.astro.build/en/guides/actions/) is the natural place to make the call. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - An [SSR adapter](https://docs.astro.build/en/guides/server-side-rendering/) installed so routes can run on demand. ## 1. Install the SDK ```bash npm install senddart ``` ## 2. Add your API key Add your key to a `.env` file at the project root. Astro exposes it server-side via `import.meta.env`. **.env** ```ini SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send email from an Action Create an Astro Action under `src/actions/index.ts`. Instantiate the client with the key from `import.meta.env`, call `mb.emails.send()`, and surface any error as an `ActionError`. **src/actions/index.ts** ```ts import { ActionError, defineAction } from 'astro:actions'; import { SendDart } from 'senddart'; const mb = new SendDart(import.meta.env.SENDDART_API_KEY); export const server = { send: defineAction({ accept: 'form', handler: async () => { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello world', html: 'It works!', }); if (error) { throw new ActionError({ code: 'BAD_REQUEST', message: JSON.stringify(error) }); } return data; }, }), }; ``` Call the `send` action from any frontmatter route, script, or component. > **Note:** A successful call returns the created email's `id`. See every supported field — `cc`, `bcc`, `reply_to`, `attachments`, `scheduled_at` — in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Nuxt > Send your first email from a Nuxt server route using the senddart SDK. Send your first email from a Nuxt app using the `senddart` Node SDK. Install it with `npm install senddart`, then import `SendDart` and call `mb.emails.send()`. A Nuxt [server route](https://nuxt.com/docs/guide/directory-structure/server) keeps the key on the server, where it belongs. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install the SDK ```bash npm install senddart ``` ## 2. Add your API key Store your key in `.env`. Nuxt reads it server-side from `process.env`. **.env** ```ini SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send email from a server route Create a server route under `server/api/send.ts`. Instantiate the SDK client with the key from `process.env` and call `mb.emails.send()`. **server/api/send.ts** ```ts import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY!); export default defineEventHandler(async () => { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello world', html: 'It works!', }); if (error) { throw createError({ statusCode: 500, message: 'Error sending email' }); } return data; }); ``` > **Note:** A successful call returns the created email's `id`. See the full request body in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Remix > Send your first email from a Remix resource route using the senddart SDK. Send your first email from a Remix app using the `senddart` Node SDK. Install it with `npm install senddart`, then import `SendDart` and call `mb.emails.send()`. A Remix [resource route](https://remix.run/docs/en/main/guides/resource-routes) runs only on the server, so your key stays private. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install the SDK ```bash npm install senddart ``` ## 2. Add your API key **.env** ```ini SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send email from a resource route Create a resource route under `app/routes/send.ts`. Instantiate the SDK with the key from `process.env`, call `mb.emails.send()`, and return JSON to the caller. **app/routes/send.ts** ```ts import { json } from '@remix-run/node'; import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY!); export const loader = async () => { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello world', html: 'It works!', }); if (error) { return json({ error }, 400); } return json(data, 200); }; ``` > **Note:** A successful call returns the created email's `id`. See the full request body in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # SvelteKit > Send your first email from a SvelteKit endpoint using the senddart SDK. Send your first email from a SvelteKit app using the `senddart` Node SDK. Install it with `npm install senddart`, then import `SendDart` and call `mb.emails.send()`. A [`+server` endpoint](https://svelte.dev/docs/kit/routing#server) runs server-side only. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install the SDK ```bash npm install senddart ``` ## 2. Add your API key Store your key in `.env`. Import it from `$env/static/private`, which is only available in server code. **.env** ```ini SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send email from a +server route Create a `+server.ts` endpoint under `src/routes/send/`. Instantiate the SDK with the private key and call `mb.emails.send()`. **src/routes/send/+server.ts** ```ts import { SENDDART_API_KEY } from '$env/static/private'; import { SendDart } from 'senddart'; const mb = new SendDart(SENDDART_API_KEY); export async function POST() { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello world', html: '

Hello world

', }); if (error) { return Response.json({ error }, { status: 500 }); } return Response.json({ data }); } ``` > **Note:** A successful call returns the created email's `id`. See the full request body in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # RedwoodJS > Send your first email from a RedwoodJS serverless function using the senddart SDK. Send your first email from a RedwoodJS app using the `senddart` Node SDK. Install it with `npm install senddart`, then import `SendDart` and call `mb.emails.send()`. Redwood serverless functions live in the `api` side, so the call (and your key) stay on the server. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install the SDK ```bash yarn workspace api add senddart ``` ## 2. Add your API key Add your key to the project `.env`. Redwood loads it into the `api` side automatically. **.env** ```ini SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Generate a function Scaffold a serverless function on the `api` side. ```bash yarn rw g function send ``` ## 4. Send email from the function Edit the generated handler to use the SDK. **api/src/functions/send/send.ts** ```ts import type { APIGatewayEvent, Context } from 'aws-lambda'; import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY!); export const handler = async (_event: APIGatewayEvent, _context: Context) => { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'hello world', html: 'it works!', }); return { statusCode: error ? 500 : 200, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(error ? { error } : { data }), }; }; ``` > **Note:** A successful call returns the created email's `id`. See the full request body in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Express > Send your first email from an Express route using the senddart SDK. Send your first email from an Express server using the `senddart` Node SDK. Install it with `npm install senddart`, then import `SendDart` and call `mb.emails.send()` inside your route handler. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - Node.js 18 or newer. ## 1. Install the SDK ```bash npm install senddart ``` ## 2. Add your API key **.env** ```ini SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send email from a route Instantiate the SDK client once at module scope and call `mb.emails.send()` inside your handler. **server.ts** ```ts import express, { Request, Response } from 'express'; import { SendDart } from 'senddart'; const app = express(); const mb = new SendDart(process.env.SENDDART_API_KEY!); app.get('/', async (req: Request, res: Response) => { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'hello world', html: 'it works!', }); res.status(error ? 400 : 200).json(error ? { error } : { data }); }); app.listen(3000, () => { console.log('Listening on http://localhost:3000'); }); ``` > **Note:** A successful call returns the created email's `id`. See the full request body in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Hono > Send your first email from a Hono route using the senddart SDK. Send your first email from a Hono app using the `senddart` SDK. The SDK uses the standard `fetch` API and works on Node.js, Bun, Cloudflare Workers, and other edge runtimes. Install it with `npm install senddart`, import `SendDart`, and call `mb.emails.send()`. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install the SDK ```bash npm install senddart ``` ## 2. Add your API key Store your key in the environment. On Node.js or Bun it is available as `process.env.SENDDART_API_KEY`; on Cloudflare Workers it comes from the request context bindings (`c.env`). **.env** ```ini SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send email from a route Create `index.ts`, instantiate the SDK client, and call `mb.emails.send()` inside a route handler. **index.ts** ```ts import { Hono } from 'hono'; import { SendDart } from 'senddart'; const app = new Hono(); const mb = new SendDart(process.env.SENDDART_API_KEY!); app.get('/', async (c) => { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'hello world', html: 'it works!', }); return c.json(error ? { error } : { data }, error ? 400 : 200); }); export default app; ``` > **Note:** A successful call returns the created email's `id`. See the full request body in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Bun > Send your first email from a Bun server using the senddart SDK. Send your first email from a Bun app using the `senddart` SDK. Bun reads `.env` automatically and is fully compatible with the Node SDK. Install it with `bun add senddart`, then import `SendDart` and call `mb.emails.send()`. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install the SDK ```bash bun add senddart ``` ## 2. Add your API key Bun loads `.env` automatically and exposes it on `process.env` / `Bun.env`. **.env** ```ini SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send email from a Bun server Create `index.ts`, instantiate the SDK client, and call `mb.emails.send()` from the request handler. Start it with `bun index.ts`. **index.ts** ```ts import { SendDart } from 'senddart'; const mb = new SendDart(Bun.env.SENDDART_API_KEY); const server = Bun.serve({ port: 3000, async fetch() { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello World', html: 'It works!', }); return Response.json(error ? { error } : { data }, { status: error ? 500 : 200, }); }, }); console.log(`Listening on http://localhost:${server.port} ...`); ``` > **Note:** A successful call returns the created email's `id`. See the full request body in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Django > Send your first email from a Django view by calling the SendDart API with requests. Python has an official package — `pip install senddart` — and it works unchanged from a Django view. The example below instead calls the REST API directly with the [`requests`](https://pypi.org/project/requests/) library, so the send adds no new dependency beyond one you almost certainly already have. See [SDKs](https://www.senddart.com/docs/resources/sdks) for the package. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install an HTTP client **Pip** ```bash pip install requests ``` ## 2. Set your API key Read the key from the environment so it never lives in source. **.env** ```ini SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send email from a view POST the email body to the SendDart API from a Django view. The easiest way to send is with the `html` field. **views.py** ```py import os import requests from django.http import JsonResponse def send_email(request): res = requests.post( "https://www.senddart.com/api/emails", headers={"Authorization": f"Bearer {os.environ['SENDDART_API_KEY']}"}, json={ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from Django", "html": "it works!", }, ) res.raise_for_status() return JsonResponse({"id": res.json()["id"]}) ``` For richer HTML, render a Django template to a string and pass it as the `html` field. **views.py** ```py from django.template.loader import render_to_string html = render_to_string("emails/welcome.html", { "user_name": "Django Developer", "dashboard_url": "https://example.com/dashboard", }) # ...then pass html=... in the JSON body above. ``` > **Note:** A successful call returns the created email's `id`. See every supported field in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # FastAPI > Send your first email from a FastAPI endpoint by calling the SendDart API with httpx. Python has an official package — `pip install senddart` — and it works unchanged from a FastAPI route. The example below instead POSTs JSON to `https://www.senddart.com/api/emails` with the async [`httpx`](https://www.python-httpx.org/) client, which pairs naturally with FastAPI. See [SDKs](https://www.senddart.com/docs/resources/sdks) for the package. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install an HTTP client **Pip** ```bash pip install httpx ``` ## 2. Set your API key **.env** ```ini SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send email from an endpoint POST the email body to the SendDart API from a route handler. The easiest way to send is with the `html` field. **main.py** ```py import os import httpx from fastapi import FastAPI app = FastAPI() @app.post("/") async def send_mail(): async with httpx.AsyncClient() as client: res = await client.post( "https://www.senddart.com/api/emails", headers={"Authorization": f"Bearer {os.environ['SENDDART_API_KEY']}"}, json={ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "hello world", "html": "it works!", }, ) res.raise_for_status() return res.json() ``` > **Note:** A successful call returns the created email's `id`. See every supported field in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Flask > Send your first email from a Flask route by calling the SendDart API with requests. Python has an official package — `pip install senddart` — and it works unchanged from a Flask view. The example below instead POSTs JSON to `https://www.senddart.com/api/emails` with the [`requests`](https://pypi.org/project/requests/) library, keeping the dependency list short. See [SDKs](https://www.senddart.com/docs/resources/sdks) for the package. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install an HTTP client **Pip** ```bash pip install requests ``` ## 2. Set your API key **.env** ```ini SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send email from a route POST the email body to the SendDart API from a route handler. The easiest way to send is with the `html` field. **index.py** ```py import os import requests from flask import Flask, jsonify app = Flask(__name__) @app.route("/") def index(): res = requests.post( "https://www.senddart.com/api/emails", headers={"Authorization": f"Bearer {os.environ['SENDDART_API_KEY']}"}, json={ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "hello world", "html": "it works!", }, ) res.raise_for_status() return jsonify(res.json()) if __name__ == "__main__": app.run() ``` > **Note:** A successful call returns the created email's `id`. See every supported field in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Laravel > Send your first email from a Laravel controller by calling the SendDart API with the Http facade. PHP has an official package — `composer require senddart/senddart` — and it works from any Laravel controller or service. The example below shows the dependency-free alternative instead: POST JSON to `https://www.senddart.com/api/emails` with the built-in [`Http` facade](https://laravel.com/docs/http-client), a wrapper over Guzzle. See [SDKs](https://www.senddart.com/docs/resources/sdks) for the package. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Add your API key Add your key to the application's `.env` file and read it with the `env()` helper (or via a `config/` entry). **.env** ```ini SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 2. Send email from a controller Use the `Http` facade to POST the email body to the SendDart API. The easiest way to send is with the `html` field. **app/Http/Controllers/SendController.php** ```php post('https://www.senddart.com/api/emails', [ 'from' => 'Acme ', 'to' => ['delivered@test.senddart.com'], 'subject' => 'hello world', 'html' => 'it works!', ]); $response->throw(); return response()->json(['id' => $response->json('id')]); } } ``` > **Note:** A successful call returns the created email's `id`. See every supported field in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Ruby on Rails > Send your first email from a Rails controller by calling the SendDart API with Net::HTTP. Ruby has an official gem — `gem install senddart` — and it works from any Rails controller or job. The example below shows the dependency-free alternative instead: POST JSON to `https://www.senddart.com/api/emails` with the standard-library `net/http`, so there is nothing to install. See [SDKs](https://www.senddart.com/docs/resources/sdks) for the gem. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Add your API key Store your key in the environment (or Rails credentials). The example reads `SENDDART_API_KEY` from `ENV`. **.env** ```ini SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 2. Send email from a controller POST the email body to the SendDart API from a controller action with `net/http`. The easiest way to send is with the `html` field. **app/controllers/send_controller.rb** ```rb require "net/http" require "json" require "uri" class SendController < ApplicationController def create uri = URI("https://www.senddart.com/api/emails") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch('SENDDART_API_KEY')}" request["Content-Type"] = "application/json" request.body = { from: "Acme ", to: ["delivered@test.senddart.com"], subject: "hello world", html: "it works!", }.to_json response = http.request(request) render json: JSON.parse(response.body), status: response.code.to_i end end ``` > **Note:** A successful call returns the created email's `id`. See every supported field in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Phoenix > Send your first email from a Phoenix app by calling the SendDart API with an Elixir HTTP client. The `senddart` SDK is for Node.js — Elixir users send email by POSTing JSON to `https://www.senddart.com/api/emails`. The example below uses [`Req`](https://hex.pm/packages/req), a batteries-included HTTP client, called from a Phoenix controller. `HTTPoison` works the same way if you already have it. ## Prerequisites Before you start, you will need: - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - A Phoenix application. ## 1. Install an HTTP client Add `req` to your list of dependencies in `mix.exs`, then run `mix deps.get`. **mix.exs** ```elixir def deps do [ {:req, "~> 0.5"} ] end ``` ## 2. Set your API key Read the API key from the environment rather than hardcoding it. In `runtime.exs` you can put it into your app config, then read it back where you send. **config/runtime.exs** ```elixir config :my_app, :senddart_api_key, System.fetch_env!("SENDDART_API_KEY") ``` ## 3. Send email from a controller POST the email body to the SendDart API from a controller action. The easiest way to send is with the `html` field. **lib/my_app_web/controllers/email_controller.ex** ```elixir defmodule MyAppWeb.EmailController do use MyAppWeb, :controller def send(conn, _params) do api_key = Application.fetch_env!(:my_app, :senddart_api_key) response = Req.post!("https://www.senddart.com/api/emails", auth: {:bearer, api_key}, json: %{ from: "Acme ", to: ["delivered@test.senddart.com"], subject: "hello world", html: "it works!" } ) json(conn, %{id: response.body["id"]}) end end ``` > **Note:** A successful call returns the created email's `id`. See [Send an email](https://www.senddart.com/docs/api/emails-send) for every supported field — `cc`, `bcc`, `reply_to`, `attachments`, and `scheduled_at`. --- # Sinatra > Send your first email from a Sinatra app using Net::HTTP against the SendDart API. Ruby has an official SDK — `gem install senddart` — and it works unchanged inside a Sinatra route: set `SendDart.api_key` once, then call `SendDart::Emails.send({ ... })`. The example below deliberately takes the dependency-free route instead, POSTing JSON to `https://www.senddart.com/api/emails` with the standard-library `net/http`, so there is nothing extra to install beyond Sinatra itself. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install Sinatra Add Sinatra to your project if you have not already. **RubyGems** ```bash gem install sinatra ``` ## 2. Set your API key Read your API key from the environment so it never lives in source. **.env** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send email using HTML The easiest way to send an email is with the `html` field. POST it to the SendDart API from a route handler. **index.rb** ```rb require "sinatra" require "net/http" require "json" require "uri" set :port, 5000 set :bind, "0.0.0.0" get "/" do content_type :json uri = URI("https://www.senddart.com/api/emails") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch('SENDDART_API_KEY')}" request["Content-Type"] = "application/json" request.body = { from: "Acme ", to: ["delivered@test.senddart.com"], subject: "hello world", html: "it works!" }.to_json response = http.request(request) response.body end ``` > **Note:** A successful call returns the created email's `id`. See [Send an email](https://www.senddart.com/docs/api/emails-send) for all supported fields. --- # Symfony > Send your first email from a Symfony controller using the Symfony HttpClient against the SendDart API. PHP has an official SDK — `composer require senddart/senddart` — and it works in any Symfony controller or service (`SendDart::client($key)`, then `$senddart->emails->send([ ... ])`). The example below instead shows the dependency-free route, POSTing JSON to `https://www.senddart.com/api/emails` with Symfony's [HttpClient](https://symfony.com/doc/current/http_client.html) component, which you can inject into any controller or service. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - A Symfony application. ## 1. Install the HTTP client Install the Symfony HttpClient component with Composer. **Composer** ```bash composer require symfony/http-client ``` ## 2. Configure your API key In your `.env.local` file, which you can create if needed, add your SendDart API key. Never commit this file. **.env.local** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send your first email Inject the `HttpClientInterface` into a controller and POST the email body. The easiest way to send is with the `html` field. **src/Controller/EmailController.php** ```php client->request('POST', 'https://www.senddart.com/api/emails', [ 'auth_bearer' => $_ENV['SENDDART_API_KEY'], 'json' => [ 'from' => 'Acme ', 'to' => ['delivered@test.senddart.com'], 'subject' => 'Hello world', 'html' => 'it works!', ], ]); return new JsonResponse($response->toArray()); } } ``` > **Note:** A successful call returns the created email's `id`. See [Send an email](https://www.senddart.com/docs/api/emails-send) for the complete request body. --- # Axum > Send your first email from an Axum handler using reqwest against the SendDart API. Rust has an official SDK — the [`senddart`](https://crates.io/crates/senddart) crate on crates.io — and an [Axum](https://github.com/tokio-rs/axum) handler can call it directly on the [Tokio](https://tokio.rs) runtime. The example below instead takes the raw-HTTP route, POSTing JSON to `https://www.senddart.com/api/emails` with the async [`reqwest`](https://crates.io/crates/reqwest) client, so you can see exactly what goes over the wire. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install dependencies Add Axum, an async HTTP client, a runtime, and JSON support to your Cargo project. ```bash cargo add axum cargo add reqwest -F json cargo add tokio -F macros,rt-multi-thread cargo add serde_json ``` ## 2. Set your API key **.env** ```toml SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Send an email Build an Axum router with a single route whose handler POSTs the email and returns the created `id`. **src/main.rs** ```rust use axum::{http::StatusCode, routing::get, Router}; use serde_json::json; #[tokio::main] async fn main() { let app = Router::new().route("/", get(endpoint)); let listener = tokio::net::TcpListener::bind("0.0.0.0:3000") .await .unwrap(); axum::serve(listener, app).await.unwrap(); } async fn endpoint() -> Result { let api_key = std::env::var("SENDDART_API_KEY") .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?; let res = reqwest::Client::new() .post("https://www.senddart.com/api/emails") .bearer_auth(api_key) // reqwest sends no User-Agent of its own and the API rejects a request // without one with 403 validation_error, so set it explicitly. .header("User-Agent", "my-app/1.0") .json(&json!({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello World", "html": "It works!", })) .send() .await .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?; let body: serde_json::Value = res .json() .await .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?; Ok(body["id"].to_string()) } ``` Opening your browser at `http://localhost:3000` (or running `curl localhost:3000`) sends an email and returns its `id`. > **Warning:** The explicit `User-Agent` header is required: `reqwest` does not set one by default and every SendDart API request without a `User-Agent` is rejected with `403 validation_error`. The official crate sets it for you. > **Note:** See [Send an email](https://www.senddart.com/docs/api/emails-send) for the full body schema — `cc`, `bcc`, `reply_to`, `attachments`, and more. --- # Encore.ts > Send your first email from an Encore.ts API endpoint using the senddart SDK. [Encore](https://encore.dev) is an open-source TypeScript framework that provisions infrastructure directly from your application code. Use the `senddart` Node SDK — install it with `npm install senddart` — and read your key from Encore's secrets management. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - Install [Encore](https://encore.dev/docs/ts/install) (`brew install encoredev/tap/encore`). ## 1. Create an Encore app ```bash encore app create --lang=ts my-app ``` ## 2. Install the SDK ```bash npm install senddart ``` ## 3. Set your API key Encore has built-in [secrets management](https://encore.dev/docs/ts/primitives/secrets). Store your SendDart API key as a secret — no `.env` files needed. ```bash encore secret set --type dev,local,pr,production SendDartAPIKey ``` ## 4. Define a service Every Encore.ts service needs a service definition file. **email/encore.service.ts** ```ts import { Service } from 'encore.dev/service'; export default new Service('email'); ``` ## 5. Send email from an API endpoint Create a type-safe API endpoint. Read the secret with `secret()` from `encore.dev/config`, then call `mb.emails.send()`. **email/send.ts** ```ts import { api } from 'encore.dev/api'; import { secret } from 'encore.dev/config'; import { SendDart } from 'senddart'; const senddartApiKey = secret('SendDartAPIKey'); interface SendRequest { to: string; subject: string; html: string; } interface SendResponse { id: string; } export const sendEmail = api( { expose: true, method: 'POST', path: '/email/send' }, async (req: SendRequest): Promise => { const mb = new SendDart(senddartApiKey()); const { data, error } = await mb.emails.send({ from: 'Acme ', to: req.to, subject: req.subject, html: req.html, }); if (error) { throw new Error(`Failed to send email: ${JSON.stringify(error)}`); } return { id: data.id }; }, ); ``` ## 6. Run the app ```bash encore run ``` Your API is running at `http://localhost:4000`. Send a test email: ```bash curl -X POST http://localhost:4000/email/send \ -H "Content-Type: application/json" \ -d '{"to":"delivered@test.senddart.com","subject":"Hello World","html":"It works!"}' ``` > **Note:** See [Send an email](https://www.senddart.com/docs/api/emails-send) for every body field, including `cc`, `bcc`, `reply_to`, and `scheduled_at`. --- # Encore.go > Send your first email from an Encore Go API endpoint using net/http against the SendDart API. [Encore](https://encore.dev) is an open-source Go framework that provisions infrastructure directly from your application code. Go has an official SDK — `go get github.com/shekhu10/senddart-sdks/senddart-go` — and `senddart.NewClient` works from any Encore endpoint. The example below instead takes the dependency-free route, POSTing JSON to `https://www.senddart.com/api/emails` with the standard-library `net/http`, reading your key from Encore's secrets management. See [SDKs](https://www.senddart.com/docs/resources/sdks) for the package. ## Prerequisites - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - Install [Encore](https://encore.dev/docs/go/install) (`brew install encoredev/tap/encore`). ## 1. Create an Encore app ```bash encore app create --lang=go my-app ``` ## 2. Set your API key Encore has built-in [secrets management](https://encore.dev/docs/go/primitives/secrets). Store your SendDart API key as a secret — no `.env` files needed. ```bash encore secret set --type dev,local,pr,production SendDartAPIKey ``` ## 3. Send email from an API endpoint Create an `email` service directory and define your endpoint. Encore injects the secret through an unexported `secrets` struct; the handler POSTs the email body to the SendDart API with `net/http`. **email/email.go** ```go package email import ( "bytes" "context" "encoding/json" "fmt" "net/http" ) var secrets struct { SendDartAPIKey string } type SendRequest struct { To string `json:"to"` Subject string `json:"subject"` HTML string `json:"html"` } type SendResponse struct { ID string `json:"id"` } //encore:api public method=POST path=/email/send func Send(ctx context.Context, req *SendRequest) (*SendResponse, error) { payload, _ := json.Marshal(map[string]any{ "from": "Acme ", "to": []string{req.To}, "subject": req.Subject, "html": req.HTML, }) httpReq, err := http.NewRequestWithContext( ctx, "POST", "https://www.senddart.com/api/emails", bytes.NewReader(payload), ) if err != nil { return nil, err } httpReq.Header.Set("Authorization", "Bearer "+secrets.SendDartAPIKey) httpReq.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(httpReq) if err != nil { return nil, err } defer res.Body.Close() if res.StatusCode >= 300 { return nil, fmt.Errorf("failed to send email: status %d", res.StatusCode) } var out SendResponse if err := json.NewDecoder(res.Body).Decode(&out); err != nil { return nil, err } return &out, nil } ``` ## 4. Run the app ```bash encore run ``` Your API is running at `http://localhost:4000`. Send a test email: ```bash curl -X POST http://localhost:4000/email/send \ -H "Content-Type: application/json" \ -d '{"to":"delivered@test.senddart.com","subject":"Hello World","html":"It works!"}' ``` > **Note:** See [Send an email](https://www.senddart.com/docs/api/emails-send) for the complete request body — `cc`, `bcc`, `reply_to`, `attachments`, and `scheduled_at`. --- # AWS Lambda > Send your first email from an AWS Lambda function using the senddart SDK. Send your first email from an [AWS Lambda](https://aws.amazon.com/lambda/) function using the `senddart` Node SDK. Bundle the SDK into your Lambda deployment package with your preferred bundler (esbuild, webpack, etc.) or a Lambda Layer. ## Prerequisites Before you start, you will need: - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install the SDK ```bash npm install senddart ``` ## 2. Create an AWS Lambda function Go to [aws.amazon.com](https://aws.amazon.com) and create a new Lambda function using the **Node.js 20.x** (or later) runtime. ## 3. Store your API key Under the function's **Configuration → Environment variables**, add `SENDDART_API_KEY` with your key. Reading it from the environment keeps the secret out of source. **Environment variable** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 4. Edit the handler function Use the SDK client in your handler. It returns `{ data, error }` — no try/catch needed for HTTP errors. **index.mjs** ```js import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY); export const handler = async (event) => { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'hello world', html: 'it works!', }); return { statusCode: error ? 500 : 200, body: JSON.stringify(error ? { error } : { data }), }; }; ``` ## 5. Deploy and send email Click **Deploy**, then **Test** at the top of the screen. A successful run returns the created email's `id`. > **Note:** See the full request body — `cc`, `bcc`, `reply_to`, `attachments`, `scheduled_at` — in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Cloudflare Workers > Send your first email from a Cloudflare Worker using the senddart SDK. Send your first email from a [Cloudflare Worker](https://developers.cloudflare.com/workers/) using the `senddart` SDK. The SDK uses the standard `fetch` API and runs without modification on the Workers edge runtime — install it with `npm install senddart`. ## Prerequisites Before you start, you will need: - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - A Cloudflare Worker — recommended to bootstrap with `npm create cloudflare`. ## 1. Install the SDK ```bash npm install senddart ``` ## 2. Store your API key as a secret Add your API key as an encrypted Worker secret so it is never committed to source. ```bash npx wrangler secret put SENDDART_API_KEY # paste mb_xxxxxxxxx when prompted ``` ## 3. Send the email from your Worker In your Worker's `fetch` handler, read the key from `env`, instantiate the SDK client, and call `mb.emails.send()`. **src/index.ts** ```ts import { SendDart } from 'senddart'; export default { async fetch(request, env, ctx): Promise { const mb = new SendDart(env.SENDDART_API_KEY); const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'hello world', html: 'it works!', }); return Response.json(error ? { error } : { data }, { status: error ? 500 : 200, }); }, } satisfies ExportedHandler<{ SENDDART_API_KEY: string }>; ``` ## 4. Deploy and send email Run `wrangler deploy` and wait for it to finish. It will give you a URL like `https://my-worker.your-name.workers.dev` that you can open to verify the email was sent. > **Note:** See the full set of body fields in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Vercel Functions > Send your first email from a Vercel Function using the senddart SDK. Send your first email from a [Vercel Function](https://vercel.com/docs/functions) using the `senddart` Node SDK. The SDK works in both the Node.js and Edge runtimes. Install it with `npm install senddart`. ## Prerequisites Before you start, you will need: - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - The [Vercel CLI](https://vercel.com/docs/cli#installing-vercel-cli) installed. ## 1. Install the SDK ```bash npm install senddart ``` ## 2. Set up environment variables Add your API key to `.env.local` for local development. Never hardcode the key in source. **.env.local** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Create the function Create a route file under `app/api/send/route.ts` if you are using the Next.js [App Router](https://nextjs.org/docs/app/building-your-application/routing/route-handlers). **app/api/send/route.ts** ```ts import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY); export async function POST() { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'hello world', html: 'it works!', }); return Response.json(error ? { error } : { data }, { status: error ? 500 : 200, }); } ``` ## 4. Send email locally Run the function locally and open the endpoint URL to send an email at `http://localhost:3000/api/send`. ```bash npm run dev ``` ## 5. Send email in production Deploy with the Vercel CLI, then add your `SENDDART_API_KEY` environment variable in your Vercel project settings. Open `https://your-project.vercel.app/api/send` to send an email. ```bash vercel ``` > **Warning:** Only call the SendDart API from server-side code (Route Handlers, Server Actions, API routes). Never ship your API key to the browser. > **Note:** See the full request body in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Deno Deploy > Send your first email from Deno Deploy by calling the SendDart API with fetch. Send your first email from [Deno Deploy](https://deno.com/deploy) by calling the SendDart REST API. The `senddart` SDK targets Node.js/npm — Deno users POST JSON to `https://www.senddart.com/api/emails` using the built-in global `fetch`, so there is nothing to install. ## Prerequisites Before you start, you will need: - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Create a Deno Deploy project Go to [dash.deno.com/projects](https://dash.deno.com/projects) and create a new playground project. ## 2. Store your API key In your project's **Settings → Environment Variables**, add `SENDDART_API_KEY` with your key, then read it with `Deno.env.get`. **Environment variable** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Edit the handler function Paste the following code into the browser editor. **main.ts** ```ts const SENDDART_API_KEY = Deno.env.get('SENDDART_API_KEY'); Deno.serve(async () => { try { const res = await fetch('https://www.senddart.com/api/emails', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${SENDDART_API_KEY}`, }, body: JSON.stringify({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello World', html: 'It works!', }), }); const data = await res.json(); return new Response(JSON.stringify(data), { status: res.ok ? 200 : res.status, headers: { 'Content-Type': 'application/json' }, }); } catch (error) { console.error(error); return new Response(null, { status: 500 }); } }); ``` ## 4. Deploy and send email Click **Save & Deploy** at the top of the screen, then open the deployment URL to verify your email was sent. > **Note:** See the full set of body fields in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Supabase Edge Functions > Send your first email from a Supabase Edge Function by calling the SendDart API with fetch. Send your first email from a [Supabase Edge Function](https://supabase.com/docs/guides/functions) by calling the SendDart REST API. The `senddart` SDK targets Node.js/npm — Edge Functions run on Deno, which has a global `fetch`, so you POST JSON to `https://www.senddart.com/api/emails` directly. ## Prerequisites Before you start, you will need: - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - The [Supabase CLI](https://supabase.com/docs/guides/cli#installation) installed. ## 1. Create a Supabase function Create a new function locally. ```bash supabase functions new senddart ``` ## 2. Set your API key as a secret Store your key as a function secret so it is read from the environment, not hardcoded. ```bash supabase secrets set SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 3. Edit the handler function Paste the following code into the `index.ts` file. **index.ts** ```ts const SENDDART_API_KEY = Deno.env.get('SENDDART_API_KEY'); const handler = async (_request: Request): Promise => { const res = await fetch('https://www.senddart.com/api/emails', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${SENDDART_API_KEY}`, }, body: JSON.stringify({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'hello world', html: 'it works!', }), }); const data = await res.json(); return new Response(JSON.stringify(data), { status: res.ok ? 200 : res.status, headers: { 'Content-Type': 'application/json' }, }); }; Deno.serve(handler); ``` ## 4. Deploy and send email Run the function locally, then deploy it to Supabase and open the endpoint URL to send an email. ```bash supabase functions serve senddart --no-verify-jwt supabase functions deploy senddart ``` > **Note:** See the full set of body fields in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Railway > Deploy an app to Railway that sends your first email using the senddart SDK. [Railway](https://railway.com) lets you focus on building your product instead of managing infrastructure, scaling automatically as you grow. Use the `senddart` Node SDK — it works the same on Railway as in any Node.js host. Install it with `npm install senddart`. ## Prerequisites Before you start, you will need: - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. - A [Railway](https://railway.com) account. ## 1. Install the SDK ```bash npm install senddart ``` ## 2. Create a Railway project Create a new project on Railway and deploy a Node.js service (for example, from a GitHub repo or with `railway init` from the [Railway CLI](https://docs.railway.com/develop/cli)). ## 3. Add your API key In your service's **Variables** tab, add `SENDDART_API_KEY` with your key. Railway injects it into the runtime environment so you never commit the secret. **Service variable** ```sh SENDDART_API_KEY=mb_xxxxxxxxx ``` ## 4. Send your first email In a request handler (here, a minimal Node.js HTTP server), instantiate the SDK client and call `mb.emails.send()`. **index.mjs** ```js import { createServer } from 'node:http'; import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY); createServer(async (_req, res) => { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'hello world', html: 'it works!', }); res.writeHead(error ? 500 : 200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify(error ? { error } : { data })); }).listen(process.env.PORT || 3000); ``` ## 5. Deploy and verify Once your deployment finishes, open the deploy URL to send your first email. > **Warning:** This basic example sends an email each time someone visits the deploy URL, so share the link with discretion. > **Note:** See the full set of body fields in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Auth0 > Send Auth0 transactional emails — verification codes, password resets, and more — through SendDart. [Auth0](https://auth0.com) supports custom email providers, so you can route its transactional mail through SendDart. Authentication flows depend on reliable delivery for verification codes, password resets, and other crucial emails. Auth0 Actions run in a sandboxed Node.js runtime where npm packages cannot be installed, so the examples below call the SendDart REST API directly using the global `fetch`. ## Prerequisites Before you start, you will need: - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. > **Warning:** SendDart raw SMTP listeners are not currently deployed. Use an Auth0 Action that calls the HTTPS API instead of configuring an SMTP provider. ## Send emails with Auth0 Actions Use an Auth0 Action that calls the SendDart API directly with `fetch`. In the Auth0 Dashboard, go to **Actions → Library** and create a new Custom action. Store your API key as a secret named `SENDDART_API_KEY` on the Action. The Actions runtime provides a global `fetch` and does not support npm installs, so call the REST API directly. The following example sends a security alert on first login: **Post Login action** ```js exports.onExecutePostLogin = async (event, api) => { if (event.stats.logins_count !== 1) return; await fetch('https://www.senddart.com/api/emails', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${event.secrets.SENDDART_API_KEY}`, }, body: JSON.stringify({ from: 'Security ', to: event.user.email, subject: 'New login detected', html: `

Hi ${event.user.name}, a new login was detected from ${event.request.ip}.

`, }), }); }; ``` Deploy it by adding the Action to the **Post Login** trigger under **Actions → Triggers**. ## Use a SendDart template Instead of inline `html`, you can reference a published [template](https://www.senddart.com/docs/templates/overview) and pass variables. The example below uses a template with the id `login-detected` and two variables: **Post Login action (template)** ```js exports.onExecutePostLogin = async (event, api) => { if (event.stats.logins_count !== 1) return; await fetch('https://www.senddart.com/api/emails', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${event.secrets.SENDDART_API_KEY}`, }, body: JSON.stringify({ from: 'Security ', to: event.user.email, template: { id: 'login-detected', variables: { first_name: event.user.name, ip_address: event.request.ip, }, }, }), }); }; ``` ## Debugging email delivery When something goes wrong, check both sides of the chain: - **Auth0 Logs** (**Monitoring → Logs**) show send events and any errors raised by the email provider. - SendDart [Logs](https://www.senddart.com/docs/logs/overview) show the delivery side: accepted, delivered, opened, bounced. > **Note:** See the full request body — `cc`, `bcc`, `reply_to`, and more — in the [Send an email](https://www.senddart.com/docs/api/emails-send) reference. --- # Send emails with Node.js > Send email from Node.js using the senddart npm SDK — install once and call mb.emails.send(). The `senddart` npm package is the fastest way to send email from Node.js. Install it once and use the typed SDK — no manual `fetch` calls or header wrangling required. This guide sends a single email with `mb.emails.send()`. Every other SDK method follows the same `{ data, error }` pattern. ## Prerequisites 1. A **verified domain** — add one under Domains and publish its SPF/DKIM/DMARC records so your `from` address is allowed. ([guide](https://www.senddart.com/docs/domains/managing)) 2. An **API key** — create an `mb_` key under API Keys; it is shown once at creation. ([Authentication](https://www.senddart.com/docs/authentication)) 3. **Node 18 or newer** and `npm install senddart` (or `yarn add senddart` / `pnpm add senddart`). ## Send an email Read the key from `process.env.SENDDART_API_KEY`. Every SDK call returns `{ data, error }` — check `error` before using `data`. **send.mjs** ```js import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY); const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello from Node.js', html: '

Sent with the SendDart SDK.

', }); if (error) { throw new Error(error.message); } console.log('Sent email', data.id); ``` ## Handling the response Every SDK method returns `{ data, error }`. On success `data` holds the API response (`{ id }` for a send); on failure `error` is populated and `data` is `null`. Store the returned `id` to [retrieve the email](https://www.senddart.com/docs/api/emails-get) later or to correlate [webhook](https://www.senddart.com/docs/webhooks/overview) events. ```json { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` > **Warning:** Keep your `mb_` API key on the **server**. Never bundle it into client-side JavaScript or expose it in the browser — anyone with the key can send mail as you. Load it from an environment variable (or your secrets manager), never hard-code it. ## Next steps - See the full [Send Email API](https://www.senddart.com/docs/api/emails-send) reference for every body parameter (`cc`, `bcc`, `reply_to`, `attachments`, `scheduled_at`). - Explore [the SDKs reference](https://www.senddart.com/docs/resources/sdks) for all available methods. - Calling from a Next.js app? See [Send emails with Next.js](https://www.senddart.com/docs/integrations/nextjs). --- # Send emails with Next.js > Send email from a Next.js Route Handler or Server Action using the senddart SDK — your API key stays on the server. In Next.js you should call SendDart from **server-only code** — a Route Handler (`app/api/.../route.ts`) or a Server Action — never from a Client Component. That keeps your `mb_` API key out of the browser bundle. Install the SDK (`npm install senddart`) and import it in your server files. This guide adds a `POST /api/send` Route Handler and shows the equivalent Server Action. ## Prerequisites 1. A **verified domain** for your `from` address. ([guide](https://www.senddart.com/docs/domains/managing)) 2. An **API key** stored as an environment variable (e.g. `SENDDART_API_KEY` in `.env.local`). ([Authentication](https://www.senddart.com/docs/authentication)) 3. A **Next.js 13.4+ App Router** project (Route Handlers / Server Actions) and `npm install senddart`. ## Route Handler Create `app/api/send/route.ts`. Because the file runs only on the server, `process.env.SENDDART_API_KEY` is never exposed to the client. **app/api/send/route.ts** ```ts import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY!); export async function POST() { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello from Next.js', html: '

Sent from a Route Handler.

', }); if (error) { return Response.json({ error: error.message }, { status: 400 }); } return Response.json(data); } ``` ## Or a Server Action If you are submitting a form, a Server Action keeps the key server-side too. The `'use server'` directive guarantees the function never ships to the client. **app/actions.ts** ```ts 'use server'; import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY!); export async function sendEmail(formData: FormData) { const { data, error } = await mb.emails.send({ from: 'Acme ', to: [String(formData.get('email'))], subject: 'Thanks for signing up', html: '

Welcome aboard!

', }); if (error) { throw new Error(error.message); } return data.id; } ``` ## Handling the response Every SDK call returns `{ data, error }`. On success `data.id` is the created email's ID; on failure `error` is set and `data` is `null`. The examples above relay a clean error to the client without leaking the key. Use the `id` to [retrieve the email](https://www.senddart.com/docs/api/emails-get) or correlate [webhook](https://www.senddart.com/docs/webhooks/overview) events. > **Warning:** Only reference `SENDDART_API_KEY` in server files (Route Handlers, Server Actions, `getServerSideProps`). Never prefix it with `NEXT_PUBLIC_` and never read it in a Client Component — that would inline the secret into the browser bundle. ## Next steps - See the full [Send Email API](https://www.senddart.com/docs/api/emails-send) reference. - Review [Authentication](https://www.senddart.com/docs/authentication) for key permissions (a `sending_access` key is ideal here). - New to the API? Start with the [Quickstart](https://www.senddart.com/docs/quickstart). --- # Send emails with Python > Send email from Python with the official senddart package — zero dependencies, with module-level API key configuration. The official [`senddart`](https://pypi.org/project/senddart/) package is the fastest way to send email from Python. It has **zero dependencies** (standard library `urllib` + `json` only) and is configured module-level — set `senddart.api_key` once, then call the resource classes. There is no client object to construct and pass around. This guide sends a single email with `senddart.Emails.send(...)`. The package also sets the required `User-Agent` header on every request for you, retries `429`/`503` for you, and raises typed errors instead of handing back raw HTTP. ## Prerequisites 1. A **verified domain** for your `from` address. ([guide](https://www.senddart.com/docs/domains/managing)) 2. An **API key** (`mb_...`), read from `SENDDART_API_KEY`. ([Authentication](https://www.senddart.com/docs/authentication)) 3. Python **3.8 or newer** — the package declares `requires-python >= 3.8`. ## Install ```sh pip install senddart ``` ## Configure Assign your key to `senddart.api_key` once, at import time or during app startup. Read it from the environment so the secret never lands in source control. **mailer.py** ```python import os import senddart senddart.api_key = os.environ["SENDDART_API_KEY"] ``` Two more module-level knobs are optional: `senddart.timeout` (per-request seconds, default `30`) and `senddart.max_retries` (automatic retries of `429`/`503` only, default `2`; set `0` to disable). Because only those two statuses are retried, a send is never duplicated by a retry. ## Send an email Every field of the send body is a plain dict key — `from` is a Python keyword, so the payload is a dict rather than keyword arguments. `to` accepts a single address or a list. **send.py** ```python import os import senddart senddart.api_key = os.environ["SENDDART_API_KEY"] email = senddart.Emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from Python", "html": "

Sent with the senddart package 🐍

", }) print("Sent email", email["id"]) ``` > **Note:** `delivered@test.senddart.com` is the SendDart simulator: the send is accepted, recorded, and marked delivered without touching a real inbox. Swap it for your own address once the first call succeeds — and never use `@example.com`, which the API rejects with `422`. ## Handling the response Every method returns the parsed JSON response as a dict, so a successful send gives you `email["id"]`. A non-2xx answer raises `senddart.SendDartError`, which carries the `{ statusCode, name, message }` envelope — branch on `err.name`, never on `err.message` (messages are scrubbed server-side and are not a stable contract). ```python import time try: email = senddart.Emails.send(params) print("Sent email", email["id"]) except senddart.SendDartError as err: print(err.status_code, err.name, err.message) if err.name == "daily_quota_exceeded": # Plan/quota rejections describe the cap that was hit. print(err.limit["used"], err.limit["limit"], err.limit["next_plan"]) if err.retry_after: time.sleep(err.retry_after) print(err.body) # the full parsed error body ``` A transport failure (or a missing key) raises the same exception with `status_code == 0` and `name` of `network_error` or `missing_api_key`, so one `except` clause covers both. ## Retry safely with an idempotency key Pass `options={"idempotency_key": "..."}` so replaying a request returns the original response instead of sending twice. Only `Emails.send` and `Batch.send` honour it — see [Idempotency](https://www.senddart.com/docs/emails/idempotency). ```python senddart.Emails.send(params, options={"idempotency_key": "order-123"}) # Up to 100 emails in one request (no attachments, no scheduled_at). senddart.Batch.send([ {"from": "hello@yourdomain.com", "to": ["delivered@test.senddart.com"], "subject": "Hi A", "html": "

A

"}, {"from": "hello@yourdomain.com", "to": ["delivered@test.senddart.com"], "subject": "Hi B", "html": "

B

"}, ], options={"idempotency_key": "orders-2026-08-19"}) ``` ## Schedule instead of sending now Add `scheduled_at` (ISO 8601) to hand the send to the scheduler. A scheduled send goes through the real delivery path, so it cannot target the simulator address — use one of your own recipients. ```python scheduled = senddart.Emails.send({ "from": "Acme ", "to": ["you@yourdomain.com"], "subject": "Tomorrow morning", "html": "

Queued ahead of time.

", "scheduled_at": "2026-09-01T09:00:00Z", }) senddart.Emails.update(scheduled["id"], {"scheduled_at": "2026-09-01T14:00:00Z"}) # reschedule senddart.Emails.cancel(scheduled["id"]) # or call it off ``` > **Warning:** Keep the `mb_` API key server-side — load it from an environment variable or secrets manager, never commit it, and never ship it in a client-side script or notebook you share. Anyone holding the key can send email as you. ## Next steps - See the full [Send Email API](https://www.senddart.com/docs/api/emails-send) reference for every body field. - Using a web framework? See [Send emails with Django](https://www.senddart.com/docs/integrations/django). - Explore [the SDKs reference](https://www.senddart.com/docs/resources/sdks) for the other resources the package exposes — `Domains`, `Contacts`, `Campaigns`, `Automations`, `Webhooks`, and more. - Want no dependency at all? [Python without the SDK](https://www.senddart.com/docs/send-with/python) does the same send with `requests` or stdlib `urllib`. --- # Send emails with Django > Send email from a Django view by calling the SendDart REST API with requests or httpx. Sending from Django is straightforward: install the official `senddart` package (`pip install senddart`), or call `POST /emails` from a view (or a background task) with `requests` or `httpx` — the path this guide shows. Read the API key from Django settings, which in turn reads it from the environment — so the secret never lands in source control. This guide adds a small view that sends an email. Node.js projects can use `npm install senddart` instead — see [Send emails with Node.js](https://www.senddart.com/docs/integrations/nodejs). ## Prerequisites 1. A **verified domain** for your `from` address. ([guide](https://www.senddart.com/docs/domains/managing)) 2. An **API key** (`mb_...`). ([Authentication](https://www.senddart.com/docs/authentication)) 3. `requests` installed (`pip install requests`) and `SENDDART_API_KEY` available in your environment. ## Read the key from settings Expose the key through `settings.py` so views import it from one place. **settings.py** ```python import os SENDDART_API_KEY = os.environ["SENDDART_API_KEY"] ``` ## Send from a view This view sends a welcome email and returns the SendDart email `id` as JSON. **views.py** ```python import requests from django.conf import settings from django.http import JsonResponse from django.views.decorators.http import require_POST SENDDART_URL = "https://www.senddart.com/api/emails" @require_POST def send_welcome(request): res = requests.post( SENDDART_URL, headers={"Authorization": f"Bearer {settings.SENDDART_API_KEY}"}, json={ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Welcome to Acme", "html": "

Thanks for signing up.

", }, timeout=10, ) if not res.ok: err = res.json() return JsonResponse({"error": err["message"]}, status=res.status_code) return JsonResponse({"id": res.json()["id"]}) ``` > **Note:** Network calls block the request/response cycle. For high throughput, move the `requests.post(...)` into a background task (Celery, Django-Q, or `django-tasks`) so the view returns immediately. ## Handling the response On success SendDart returns HTTP `200` with `{ "id": "..." }`; on failure a non-2xx status with `{ statusCode, name, message }`. The view above checks `res.ok` and surfaces a clean error. Persist the returned `id` if you want to [retrieve the email](https://www.senddart.com/docs/api/emails-get) or reconcile [webhook](https://www.senddart.com/docs/webhooks/overview) events. > **Warning:** Keep `SENDDART_API_KEY` server-side — in your environment or secrets manager, read via `settings`. Never expose it to templates, JavaScript, or the client. The key sends mail as you. ## Next steps - See the full [Send Email API](https://www.senddart.com/docs/api/emails-send) reference. - Read [Authentication](https://www.senddart.com/docs/authentication) — a `sending_access` key is the safest choice for a sending-only service. - Start from the [Quickstart](https://www.senddart.com/docs/quickstart). --- # Send emails with PHP > Send email from PHP with the official senddart/senddart Composer package — no runtime dependencies beyond the curl and json extensions. The official [`senddart/senddart`](https://packagist.org/packages/senddart/senddart) package is the fastest way to send email from PHP. It has **no Composer runtime dependencies** — just the built-in `curl` and `json` extensions — and is built around a single factory: `SendDart::client($apiKey)` returns a client that exposes one property per API resource. The package also sets the required `User-Agent` header on every request for you (the API answers a request without one with a `403 validation_error`), automatically retries `429` and `503`, and throws a typed exception instead of handing back raw HTTP. ## Prerequisites 1. A **verified domain** for your `from` address. ([guide](https://www.senddart.com/docs/domains/managing)) 2. An **API key** (`mb_...`), stored in your environment as `SENDDART_API_KEY`. ([Authentication](https://www.senddart.com/docs/authentication)) 3. PHP **8.1 or newer** with the `curl` and `json` extensions enabled — the package declares `"php": "^8.1"`, `ext-curl` and `ext-json`. 4. [Composer](https://getcomposer.org) to install the package. ## Install ```sh composer require senddart/senddart ``` The current release is **1.0.0**. The package autoloads under the `SendDart\` PSR-4 namespace. ## Create the client Call the static `SendDart::client()` factory with your key. Read the key from the environment so the secret never lands in source control. **mailer.php** ```php 30, // seconds per request (0 = no timeout) 'maxRetries' => 2, // automatic retries on 429/503 only (0 disables) ]); ``` ## Send your first email Every field of the send body is a plain array key — `from` is a reserved word in PHP, so the payload is an associative array rather than named arguments. `to` takes a list of up to 50 recipients. **send.php** ```php emails->send([ 'from' => 'Acme ', 'to' => ['delivered@test.senddart.com'], 'subject' => 'Hello from PHP', 'html' => '

Your first email 🐘

', ]); echo "Sent email {$sent['id']}\n"; ``` > **Note:** `delivered@test.senddart.com` is the SendDart simulator: the send is accepted, recorded, and marked delivered without touching a real inbox. Swap it for your own address once the first call succeeds — and never use `@example.com`, which the API rejects with `422`. ## Handling the response Every method returns the decoded JSON response as an associative array, so a successful send gives you `$sent['id']`. Any non-2xx answer throws `SendDart\Exceptions\SendDartException`, which carries the `{ statusCode, name, message }` envelope. Branch on `getName()` together with `getStatusCode()`, never on the message — messages are scrubbed server-side and are not a stable contract. ```php use SendDart\Exceptions\SendDartException; try { $sent = $senddart->emails->send($payload); echo "Sent email {$sent['id']}\n"; } catch (SendDartException $e) { echo $e->getStatusCode(); // 422 echo $e->getName(); // 'validation_error' echo $e->getMessage(); // human text — do not match on it // WHICH quota ran out, and what would clear it (null on other errors). if ($limit = $e->getLimit()) { echo "{$limit['kind']}: {$limit['used']}/{$limit['limit']} used"; } // Reputation gates: whether waiting helps, and until when. if ($rep = $e->getReputation()) { echo $rep['retryable'] ? "retry at {$rep['retry_at']}" : 'not retryable'; } print_r($e->getBody()); // the whole parsed error body } ``` A transport-level failure throws the same exception with `getStatusCode() === 0` and a `getName()` of `network_error`, so one `catch` clause covers both. ## Retry safely with an idempotency key Pass `['idempotencyKey' => '...']` as the second argument so replaying a request returns the original response instead of sending twice. Only the two send endpoints honour it — `emails->send()`, and `batch->send()` or its `emails->batch()` alias — see [Idempotency keys](https://www.senddart.com/docs/emails/idempotency). ```php $senddart->emails->send($payload, ['idempotencyKey' => 'order-123']); // Up to 100 emails in one request (batch items reject attachments and scheduled_at). $senddart->batch->send([ ['from' => 'hello@yourdomain.com', 'to' => ['delivered@test.senddart.com'], 'subject' => 'Hi A', 'html' => '

A

'], ['from' => 'hello@yourdomain.com', 'to' => ['delivered@test.senddart.com'], 'subject' => 'Hi B', 'html' => '

B

'], ], ['idempotencyKey' => 'orders-2026-08-19']); ``` If a batch fails part way through, the exception names the emails that already went out — read `$e->getSent()` and `$e->getSentCount()` and do **not** resend those. ## Schedule instead of sending now Add `scheduled_at` (ISO 8601, at most 30 days ahead) to hand the send to the scheduler. A scheduled send goes through the real delivery path, so it cannot target the simulator address — use one of your own recipients. ```php $scheduled = $senddart->emails->send([ 'from' => 'Acme ', 'to' => ['you@yourdomain.com'], 'subject' => 'Tomorrow morning', 'html' => '

Queued ahead of time.

', 'scheduled_at' => '2026-09-01T09:00:00Z', ]); $senddart->emails->update($scheduled['id'], ['scheduled_at' => '2026-09-01T14:00:00Z']); // reschedule $senddart->emails->cancel($scheduled['id']); // or call it off ``` > **Warning:** Keep the `mb_` API key server-side — load it from an environment variable or secrets manager, never commit it, and never echo it into a Blade view or any browser response. Anyone holding the key can send email as you. ## Next steps - See the full [Send Email API](https://www.senddart.com/docs/api/emails-send) reference for every body field, including [attachments](https://www.senddart.com/docs/emails/attachments). - Using Laravel? See [Send emails with PHP & Laravel](https://www.senddart.com/docs/integrations/php-laravel). - Explore [the SDKs reference](https://www.senddart.com/docs/resources/sdks) for the other resources the client exposes — `domains`, `contacts`, `campaigns`, `automations`, `webhooks`, `polls`, and more (plus inbound mail via `emails->receiving`). - Want no dependency at all? [PHP without the SDK](https://www.senddart.com/docs/send-with/php) does the same send with the raw cURL extension. --- # Send emails with PHP & Laravel > Call the SendDart REST API from Laravel with the Http facade, or from plain PHP with cURL. SendDart ships an official PHP package — `composer require senddart/senddart`. If you want it, start at [Send emails with PHP](https://www.senddart.com/docs/integrations/php), which installs the package and sends a first email with `$senddart->emails->send(...)`. This guide shows the raw-HTTP alternative instead: Laravel ships a clean HTTP client (the `Http` facade, built on Guzzle) that makes calling the REST API a few lines, and plain PHP works with the built-in cURL extension. Both call `POST /emails` with your `mb_` Bearer token. The official package works the same inside Laravel — resolve it from the container or construct it in a service class. ## Prerequisites 1. A **verified domain** for your `from` address. ([guide](https://www.senddart.com/docs/domains/managing)) 2. An **API key** (`mb_...`), stored in your `.env` as `SENDDART_API_KEY`. ([Authentication](https://www.senddart.com/docs/authentication)) 3. Laravel 9+ (for the `Http` facade) — or any PHP 8.1+ with the `curl` and `json` extensions enabled. PHP 8.1 is the floor declared by the official `senddart/senddart` package; the raw-cURL path shown here also runs on PHP 8.0. ## Laravel (Http facade) Reference the key from `config`/`env`, not inline. The `Http` facade lets you inspect the status and pull JSON fields directly. **app/Http/Controllers/SendController.php** ```php acceptJson() ->post('https://www.senddart.com/api/emails', [ 'from' => 'Acme ', 'to' => ['delivered@test.senddart.com'], 'subject' => 'Hello from Laravel', 'html' => '

Sent with the Http facade.

', ]); if ($response->failed()) { // SendDart returns { statusCode, name, message }. abort($response->status(), $response->json('message')); } $id = $response->json('id'); ``` ## Plain PHP (cURL) Without a framework, the cURL extension sends the same request. **send.php** ```php true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . $apiKey, 'Content-Type: application/json', // cURL sends no User-Agent by default and the API rejects that with 403. 'User-Agent: my-app/1.0', ], CURLOPT_POSTFIELDS => json_encode([ 'from' => 'Acme ', 'to' => ['delivered@test.senddart.com'], 'subject' => 'Hello from PHP', 'html' => '

Sent with cURL.

', ]), ]); $body = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $data = json_decode($body, true); if ($status >= 400) { throw new RuntimeException("SendDart {$data['name']}: {$data['message']}"); } echo "Sent email {$data['id']}\n"; ``` ## Handling the response A successful send returns HTTP `200` with `{ "id": "..." }`. Errors return a non-2xx status with a `{ statusCode, name, message }` body — check the status (`$response->failed()` or the cURL `HTTP_CODE`) before reading the `id`. Keep the `id` to [retrieve the email](https://www.senddart.com/docs/api/emails-get) or correlate [webhook](https://www.senddart.com/docs/webhooks/overview) events. > **Warning:** Store the `mb_` API key in your server's `.env` (or secrets manager) and read it via `env()`/`getenv()`. Never hard-code it, commit it, or output it to a Blade view or browser — the key sends mail as you. ## Next steps - Prefer the official package? [Send emails with PHP](https://www.senddart.com/docs/integrations/php) installs `senddart/senddart` and does the same send in three lines. - See the full [Send Email API](https://www.senddart.com/docs/api/emails-send) reference. - Read [Authentication](https://www.senddart.com/docs/authentication) for key permissions. - Start from the [Quickstart](https://www.senddart.com/docs/quickstart). --- # Send emails with Ruby > Send email from Ruby or Rails with the official senddart gem — zero runtime dependencies, plain-hash params, and typed errors. The official [`senddart`](https://rubygems.org/gems/senddart) gem is the fastest way to send email from Ruby. It has **zero runtime dependencies** — only `net/http`, `json`, `openssl`, `uri`, `cgi` and `time` from the standard library — so it drops into a Rails app, a Sinatra service, or a bare script without pulling anything else in. One thing to know up front: the gem is configured at the module level (`SendDart.api_key = ...`) rather than by constructing a client object, and every resource is a module method — `SendDart::Emails.send`, `SendDart::Contacts.create`, and so on. Note the capitalisation: the constant is `SendDart`, with a lowercase `b`. ## Prerequisites 1. A **verified domain** for your `from` address. ([guide](https://www.senddart.com/docs/domains/managing)) 2. An **API key** (`mb_...`), read from `ENV["SENDDART_API_KEY"]` or Rails credentials. ([Authentication](https://www.senddart.com/docs/authentication)) 3. **Ruby 2.7 or newer** — that is the floor declared by the gemspec (`required_ruby_version`). ## Install ```sh gem install senddart ``` Or add it to your `Gemfile` and run `bundle install`: **Gemfile** ```ruby gem "senddart", "~> 5.1" ``` ## Configure Set the key once at boot. `SendDart.api_key = ...` on its own is enough; the `configure` block is the same assignment with room for the optional settings. **config/initializers/senddart.rb** ```ruby require "senddart" SendDart.configure do |config| config.api_key = ENV.fetch("SENDDART_API_KEY") # Optional: # config.base_url = "https://www.senddart.com/api" # override the API host # config.timeout = 10 # seconds per attempt (default 30; 0 disables) # config.max_retries = 3 # 429/503 retry budget (default 2) end ``` > **Note:** Outside Rails, put the same lines wherever your process boots. Configuration is process-global and there is no client object to thread through your code, so `SendDart::Emails.send` works from anywhere once the key is set. Call it before setting the key and the gem raises a `SendDart::Error` whose `name` is `missing_api_key` — it fails locally rather than spending a request, which is also why that one error has a `nil` `#status_code`. ## Send an email Params are a plain hash with snake_case keys, passed through as JSON. `delivered@test.senddart.com` is SendDart's mailbox simulator — the send is accepted, produces a real email object and a delivery event, and never reaches a provider, so it is safe to send to while you wire things up. Do not point a send at `example.com`: those recipients are suppressed and the call comes back `422 validation_error` having sent nothing. **send.rb** ```ruby require "senddart" SendDart.api_key = ENV.fetch("SENDDART_API_KEY") begin sent = SendDart::Emails.send({ from: "Acme ", to: ["delivered@test.senddart.com"], subject: "Hello from Ruby", html: "

Sent with the official Ruby gem 💎

" }) puts "Sent email #{sent['id']}" rescue SendDart::Error => e warn "SendDart #{e.status_code} #{e.name}: #{e.message}" end ``` ## Handling the response A successful call returns the parsed JSON body — a `Hash` with **string** keys, so the id is `sent["id"]` and not `sent[:id]`. Keep it to [retrieve the email](https://www.senddart.com/docs/api/emails-get) later or to correlate [webhook](https://www.senddart.com/docs/webhooks/overview) events. ```json { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` Any non-2xx answer raises `SendDart::Error`, which carries the API's `{ statusCode, name, message }` envelope as `#status_code`, `#name` and `#message`. Branch on `#name` together with `#status_code`, never on `#message` — message text is scrubbed server-side and is not a stable contract. Plan and quota rejections additionally populate `#limit` and reputation gates populate `#reputation`; both are `nil` on an ordinary error, and `#body` is the whole parsed body so a field newer than your gem version is still reachable. ```ruby begin SendDart::Emails.send(params) rescue SendDart::Error => e case e.name when "validation_error" # 422 — a bad field (and 403 on a raw request with no User-Agent). when "daily_quota_exceeded", "monthly_quota_exceeded", "plan_limit_reached" if (cap = e.limit) warn "#{cap['kind']} cap hit: #{cap['used']}/#{cap['limit']}" end when "missing_api_key", "invalid_api_key", "restricted_api_key" # 401/403 — the key is absent, wrong, or lacks the scope for this route. else raise end end ``` ## From a Rails controller or job With the initializer above in place there is nothing else to wire up. Send from a background job so a slow API call never blocks the request. **app/jobs/welcome_email_job.rb** ```ruby class WelcomeEmailJob < ApplicationJob queue_as :mailers def perform(user) sent = SendDart::Emails.send( { from: "Acme ", to: [user.email], subject: "Welcome to Acme", html: "

Hi #{CGI.escapeHTML(user.first_name.to_s)}, thanks for signing up.

" }, { idempotency_key: "welcome-#{user.id}" } ) user.update!(welcome_email_id: sent["id"]) end end ``` The second argument is an options hash. `idempotency_key` is honoured only on the two send endpoints — `SendDart::Emails.send`, and `SendDart::Batch.send` or its `SendDart::Emails.batch` alias — a retry with the same key replays the original response instead of sending twice. It must be 1–255 characters (`SendDart::Client::IDEMPOTENCY_KEY_MAX_LENGTH`); the server answers anything else with `400 invalid_idempotency_key`. > **Note:** The gem sets a `User-Agent` on every request (`senddart-ruby/1.0.0`), which the API requires on every route — a request without one is rejected with `403 validation_error` before it is even authenticated. It also retries `429` and `503` automatically, honouring `Retry-After`, up to `SendDart.max_retries` times (default 2). Nothing else is retried — not a timeout, not a network error, not any other status — so a send is never silently duplicated. > **Warning:** Keep the `mb_` API key server-side — in Rails credentials or an environment variable, never in client-side code or version control. Anyone with the key can send email as you. ## Next steps - Send up to 100 messages in one request with `SendDart::Batch.send([...])`. Batch items reject `attachments` and `scheduled_at` — send those one at a time. - See the full [Send Email API](https://www.senddart.com/docs/api/emails-send) reference for every body field (`cc`, `bcc`, `reply_to`, `attachments`, `scheduled_at`). - Explore [the SDKs reference](https://www.senddart.com/docs/resources/sdks) for the other resources the gem exposes — contacts, segments, campaigns, templates, automations, webhooks and events. - Verify inbound webhooks with `SendDart::Webhooks.verify(raw_body, headers, signing_secret)` — pass `request.raw_post`, never re-serialized JSON. See [Webhooks](https://www.senddart.com/docs/webhooks/overview). - Prefer no gem at all? [Send with Ruby over raw HTTP](https://www.senddart.com/docs/send-with/ruby) uses only `net/http`. --- # Send emails with Go > Send email from Go with the official senddart-go module — typed request structs, context variants, and zero third-party dependencies. The official Go module is the fastest way to send email from Go. It depends only on the standard library, sets the required `User-Agent` header for you, and retries `429`/`503` responses automatically. The SendDart 1.0.0 module path is `github.com/shekhu10/senddart-sdks/senddart-go`, without a major-version suffix. The package name is `senddart`. ## Prerequisites 1. A **verified domain** for your `from` address. ([guide](https://www.senddart.com/docs/domains/managing)) 2. An **API key** (`mb_...`), read from `SENDDART_API_KEY`. ([Authentication](https://www.senddart.com/docs/authentication)) 3. **Go 1.22 or newer** — that is the floor declared in the module `go.mod`. ## Install ```sh go get github.com/shekhu10/senddart-sdks/senddart-go ``` ## Send an email Construct the client with `senddart.NewClient` and call `client.Emails.Send`. `delivered@test.senddart.com` is the delivery simulator — safe to send to while you wire things up. Do not use `example.com`: it is a blocked recipient domain and the send comes back `422`. **main.go** ```go package main import ( "errors" "fmt" "log" "os" senddart "github.com/shekhu10/senddart-sdks/senddart-go" ) func main() { client := senddart.NewClient(os.Getenv("SENDDART_API_KEY")) sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Hello from Go", Html: "

Sent with the official Go module 🐹

", }) if err != nil { var apiErr *senddart.SendDartError if errors.As(err, &apiErr) { log.Fatalf("SendDart %d %s: %s", apiErr.StatusCode, apiErr.Name, apiErr.Message) } log.Fatal(err) } fmt.Println("Sent email", sent.Id) } ``` ## Handling the response A successful send returns `*senddart.CreateEmailResponse`, whose only field is `Id`. Keep it to [retrieve the email](https://www.senddart.com/docs/api/emails-get) later or to correlate [webhook](https://www.senddart.com/docs/webhooks/overview) events. ```json { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` Any non-2xx answer comes back as a `*senddart.SendDartError` carrying the `{ statusCode, name, message }` envelope. Branch on `Name` together with `StatusCode`, never on `Message` — message text is scrubbed server-side and is not a stable contract. Plan and quota rejections additionally populate `Limit`, and reputation gates populate `Reputation`; both are `nil` on an ordinary error. ```go var apiErr *senddart.SendDartError if errors.As(err, &apiErr) { switch apiErr.Name { case "validation_error": // 422 — a bad field, or 403 when the User-Agent header is missing. case "daily_quota_exceeded": if l := apiErr.Limit; l != nil { fmt.Printf("%s cap hit: %d/%d\n", l.Kind, l.Used, l.Limit) } } } ``` ## Context and tuning Every method has a context-aware variant with a `WithContext` suffix, so a send can inherit the deadline of the request that triggered it. ```go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() sent, err := client.Emails.SendWithContext(ctx, params) ``` The exported client fields may be overridden before first use. `Timeout` bounds each attempt (default `senddart.DefaultTimeout`, 30s) and `MaxRetries` is the retry budget for `429`/`503` only (default `senddart.DefaultMaxRetries`, 2) — no other status, network error, or timeout is retried, so a send is never silently duplicated. ```go client := senddart.NewClient(os.Getenv("SENDDART_API_KEY")) client.Timeout = 10 * time.Second client.MaxRetries = 3 ``` > **Note:** The module always sends a non-empty `User-Agent` (`senddart-go/1.0.0`), which the API requires on every route — a request without one is rejected with `403 validation_error` before it is even authenticated. Setting `client.UserAgent = ""` falls back to that default rather than producing a client that 403s on every call. > **Warning:** Read the `mb_` API key from the environment (or your secrets manager) and keep it server-side. Never compile it into a binary you ship to users — the key can send email as your account. ## Next steps - See the full [Send Email API](https://www.senddart.com/docs/api/emails-send) reference for every body field (`Cc`, `Bcc`, `ReplyTo`, `Attachments`, `ScheduledAt`). - Explore [the SDKs reference](https://www.senddart.com/docs/resources/sdks) for the other resources the module exposes. - Prefer no dependencies at all? [Send with Go over raw HTTP](https://www.senddart.com/docs/send-with/go) uses only `net/http`. --- # Send emails with Rust > Send email from Rust with the official senddart crate — async, typed errors, and built on reqwest with rustls. The official [`senddart`](https://crates.io/crates/senddart) crate is the fastest way to send email from Rust. Every method is `async` and returns `Result` (the crate re-exports `senddart::Result` as the alias for that), so API failures arrive as typed values instead of raw HTTP. You construct one `SendDart` client and reach every resource through a field on it — `senddart.emails`, `senddart.comntacts`, `senddart.campaigns`, and so on. The client is `Clone` and internally reference-counted, so cloning it into tasks is cheap and there is no need for a global. ## Prerequisites 1. A **verified domain** for your `from` address — publish its SPF/DKIM/DMARC records first. ([guide](https://www.senddart.com/docs/domains/managing)) 2. An **API key** (`mb_...`), read from `SENDDART_API_KEY`. ([Authentication](https://www.senddart.com/docs/authentication)) 3. **Rust 1.75 or newer** — that is the `rust-version` declared by the crate. 4. An **async runtime**. The examples use [Tokio](https://tokio.rs); any executor that can drive `reqwest` futures works. ## Install ```sh cargo add senddart cargo add tokio -F macros,rt-multi-thread ``` Or pin it in `Cargo.toml` yourself: **Cargo.toml** ```toml [dependencies] senddart = "5" tokio = { version = "1", features = ["macros", "rt-multi-thread"] } ``` The crate pulls in `reqwest` with `rustls-tls` and `default-features = false`, so it does not need OpenSSL on the build machine. ## Send an email Read the key from the environment and hand it to `SendDart::new`. `delivered@test.senddart.com` is SendDart's mailbox simulator — the send is accepted, produces a real email object and delivery event, and is intercepted before it reaches a provider, so it is safe to send to while you wire things up. Do not point a send at `example.com`: those recipients are suppressed and the call comes back `422 validation_error` having sent nothing. **src/main.rs** ```rust use senddart::{SendDart, Result, SendEmailOptions}; #[tokio::main] async fn main() -> Result<()> { let api_key = std::env::var("SENDDART_API_KEY").expect("SENDDART_API_KEY not set"); let senddart = SendDart::new(api_key); let email = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Hello from Rust", ) .with_html("

Sent with the senddart crate 🦀

"); let sent = senddart.emails.send(email).await?; println!("Sent email {}", sent.id); Ok(()) } ``` `SendEmailOptions::new(from, to, subject)` takes the three required fields; everything optional is a chained `with_*` builder — `with_text`, `with_cc`, `with_bcc`, `with_reply_to`, `with_preview_text`, `with_header`, `with_attachment`, `with_topic_id`, `with_template`, `with_template_id`, `with_variable`, `with_scheduled_at`. `to` is any iterable of string-likes, so an array literal, a `Vec`, or an iterator all work. > **Warning:** A **scheduled** send (`with_scheduled_at("2026-09-01T09:00:00Z")`) must go to a real mailbox such as `you@yourdomain.com`. The simulator only intercepts immediate sends, so scheduling one to `delivered@test.senddart.com` is rejected with `422 validation_error`. ## Handling the response A successful send resolves to `CreateEmailResponse { id }`. Keep the id to [retrieve the email](https://www.senddart.com/docs/api/emails-get) later or to correlate [webhook](https://www.senddart.com/docs/webhooks/overview) events. A non-2xx answer is `Error::Api`, which boxes an `ApiError` carrying the API's `{ statusCode, name, message }` envelope as `status_code`, `name` and `message`. Use `err.api()` to reach it — that returns `None` for `Error::Http` (transport) and `Error::Json` (decode) failures. Branch on `name` together with `status_code`, never on `message`: message text is scrubbed server-side and is not a stable contract. ```rust match senddart.emails.send(email).await { Ok(sent) => println!("Sent email {}", sent.id), Err(err) => match err.api() { // The API answered with an error envelope. Some(api) => { eprintln!("{} {}: {}", api.status_code, api.name, api.message); // Plan and quota rejections say WHICH allowance ran out. if let Some(limit) = &api.limit { eprintln!("{} cap hit: {}/{}", limit.kind, limit.used, limit.limit); } // Reputation gates say whether waiting will help. if let Some(rep) = &api.reputation { eprintln!("{} sending gated, retryable={}", rep.scope, rep.retryable); } } // Transport or decode failure. None => eprintln!("request failed: {err}"), }, } ``` `limit` and `reputation` are `None` on an ordinary error, `sent` is an empty `Vec` outside a part-way batch failure, and `api.body` holds the whole parsed body so a field newer than your crate version is still reachable. ## Retry-safe sends When your own code may retry a send — a job runner, a webhook handler — use the idempotent variant. Replaying the same key returns the stored response instead of sending a second copy. The key must be 1–255 characters (`senddart::IDEMPOTENCY_KEY_MAX_LEN`); the API answers anything else with `400 invalid_idempotency_key`. Only `POST /emails` and `POST /emails/batch` honour the header. ```rust let sent = senddart .emails .send_with_idempotency_key(email, &format!("welcome-{user_id}")) .await?; ``` ## Tuning the client `SendDart::new` targets production with a 30s per-request timeout and up to 2 automatic retries. Use the builder to change any of that, or `SendDart::with_client` to bring your own `reqwest::Client` (proxies, connection pools — its own timeout then applies). ```rust use std::time::Duration; let senddart = SendDart::builder(api_key) .base_url("https://www.senddart.com/api") // override the API host .timeout(Duration::from_secs(10)) // per attempt; Duration::ZERO disables it .max_retries(3) // 429/503 budget; 0 disables retrying .build(); ``` > **Note:** The crate sends the required `User-Agent` on every request (`senddart-rust/1.0.0`, exposed as `senddart::USER_AGENT`) — a raw request without one is rejected with `403 validation_error` before it is even authenticated. It retries only `429` and `503`, honouring `Retry-After` and otherwise backing off exponentially. Timeouts, network errors and other 5xx are never retried, so a send is never silently duplicated. > **Warning:** Read the `mb_` API key from the environment (or your secrets manager) and keep it server-side. Never compile it into a binary you ship to users — anyone with the key can send email as your account. ## Next steps - Send up to 100 messages in one request with `senddart.batch.send_emails(vec![BatchEmailOptions::new(...)])`. `BatchEmailOptions` is `SendEmailOptions` minus `attachments` and `scheduled_at` — the API rejects both in a batch, so the type keeps that a compile error. The response is `SendEmailBatchResponse { data, queued, queued_count }` — `queued` is true when the batch was accepted for asynchronous delivery (HTTP 202, batches over the inline cap) rather than sent in the request. - See the full [Send Email API](https://www.senddart.com/docs/api/emails-send) reference for every body field (`cc`, `bcc`, `reply_to`, `attachments`, `scheduled_at`, templates and variables). - Explore [the SDKs reference](https://www.senddart.com/docs/resources/sdks) for the other resources the crate exposes — contacts, segments, topics, campaigns, templates, automations, webhooks, events, logs and API keys. - Verify inbound deliveries with `senddart::verify_webhook_signature(raw_body, &WebhookHeaders::new(id, timestamp, signature), secret, &VerifyWebhookOptions::default())` — pass the raw request body, never re-serialized JSON. See [Webhooks](https://www.senddart.com/docs/webhooks/overview). - Prefer no crate at all? [Send with Rust over raw HTTP](https://www.senddart.com/docs/send-with/rust) posts JSON with `reqwest` directly. --- # Send emails with Java & Kotlin > Send email from Java or Kotlin with the official com.senddart:senddart SDK — zero dependencies, Java 11+. The official Java SDK is published to Maven Central as `com.senddart:senddart`. It has **zero dependencies** — it is built on the JDK `java.net.http.HttpClient` — and the jar is plain Java 11 bytecode, so the same artifact works unchanged from **Kotlin**, Scala, Groovy and any other JVM language. You construct one `SendDart` client and reach every resource through a method on it — `senddart.emails()`, `senddart.comntacts()`, `senddart.campaigns()`, and so on. The client is immutable and thread-safe, so build it once and share it. ## Prerequisites 1. A **verified domain** for your `from` address — publish its SPF/DKIM/DMARC records first. ([guide](https://www.senddart.com/docs/domains/managing)) 2. An **API key** (`mb_...`), read from `System.getenv("SENDDART_API_KEY")`. ([Authentication](https://www.senddart.com/docs/authentication)) 3. **Java 11 or newer** — that is the `maven.compiler.release` the artifact is built at, and the floor for the `java.net.http.HttpClient` the default transport uses. ## Install **Maven** ```xml com.senddart senddart 1.0.0 ``` **Gradle (Kotlin DSL)** ```kotlin implementation("com.senddart:senddart:1.0.0") ``` **Gradle (Groovy)** ```groovy implementation 'com.senddart:senddart:1.0.0' ``` ## Send an email Construct the client with your API key and call `senddart.emails().send(...)`. Request bodies are built with a fluent builder — `SendEmailRequest.builder()` — and `build()` returns the immutable request. `delivered@test.senddart.com` is the delivery simulator, so it is safe to send to while you wire things up; it is intercepted before it reaches a real mailbox. Do not use `example.com`, which is a blocked recipient domain and comes back `422`. **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartException; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; public class Main { public static void main(String[] args) { SendDart senddart = new SendDart(System.getenv("SENDDART_API_KEY")); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Hello from Java") .html("

Sent with the official SendDart Java SDK.

") .build(); try { SendDartResponse response = senddart.emails().send(request); System.out.println("Sent email " + response.getString("id")); } catch (SendDartException e) { // SendDart returns { statusCode, name, message }. System.err.println(e.getStatusCode() + " " + e.getName() + ": " + e.getMessage()); } } } ``` **Kotlin** ```kotlin import com.senddart.SendDart import com.senddart.SendDartException import com.senddart.requests.SendEmailRequest fun main() { val senddart = SendDart(System.getenv("SENDDART_API_KEY")) val request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Hello from Kotlin") .html("

Sent with the official SendDart Java SDK.

") .build() try { val response = senddart.emails().send(request) println("Sent email " + response.getString("id")) } catch (e: SendDartException) { System.err.println(e.statusCode.toString() + " " + e.name + ": " + e.message) } } ``` There is no Kotlin-specific artifact and none is needed — the same jar is on the classpath either way. `emails()` is a plain getter method, so it keeps its parentheses in Kotlin, while `getStatusCode()` and `getName()` are reachable as the synthetic properties `statusCode` and `name`. ## Handling the response Every method returns a `SendDartResponse` (binary downloads return `byte[]`). It wraps the parsed JSON and exposes typed, dotted-path accessors — `getString`, `getInt`, `getBoolean`, `getList`, `getMap`, plus `asMap()` and the untouched `raw()`. A successful send carries just the new email id. ```json { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` ```java SendDartResponse response = senddart.emails().send(request); String id = response.getString("id"); ``` Keep that id to [retrieve the email](https://www.senddart.com/docs/api/emails-get) later or to correlate [webhook](https://www.senddart.com/docs/webhooks/overview) events. ## Handling errors Every non-2xx response throws `SendDartException`, which mirrors the API envelope through `getStatusCode()`, `getName()` and `getMessage()`. A transport failure throws the same type with `getStatusCode() == 0` and `getName() == "network_error"`, so one catch block covers both. Branch on `getName()` together with `getStatusCode()` — never on the message text, which is scrubbed of provider identifiers server-side and is not a stable contract. ```java try { senddart.emails().send(request); } catch (SendDartException e) { switch (e.getName()) { case "validation_error": // 422 — a bad field (and 403 on a raw request with no User-Agent). break; case "daily_quota_exceeded": case "monthly_quota_exceeded": case "plan_limit_reached": Map cap = e.getLimit(); if (cap != null) { System.out.println(cap.get("kind") + " cap hit: " + cap.get("used") + "/" + cap.get("limit")); } break; case "missing_api_key": case "invalid_api_key": case "restricted_api_key": // 401/403 — the key is absent, wrong, or lacks the scope for this route. break; default: throw e; } } ``` Plan and quota rejections add a `limit` object (`getLimit()`), reputation gates add `reputation` (`getReputation()`), and a partially-applied batch adds `sent` / `sent_count` (`getSent()` / `getSentCount()`). Each returns `null` on an ordinary error. The full parsed body is always available via `getBody()`, or by dotted path with `e.get("limit.next_plan.id")`. ## Retrying a send safely Pass an idempotency key as the second argument to `send` and a retry replays the original response instead of sending a second email. ```java SendDartResponse response = senddart.emails().send(request, "welcome-" + userId); ``` The key must be 1–255 characters after trimming (`SendDart.IDEMPOTENCY_KEY_MAX_LENGTH`); anything else is a `400 invalid_idempotency_key`. It is bound to the request body, so reusing it with a different payload is a `409 invalid_idempotent_request`. Only `POST /emails` and `POST /emails/batch` read the header — every other endpoint ignores it, so a retry there creates a second resource. ## Timeouts and retries The four-argument constructor tunes the HTTP core: a per-request (and connect) timeout, and the retry budget. ```java SendDart senddart = new SendDart( System.getenv("SENDDART_API_KEY"), SendDart.DEFAULT_BASE_URL, Duration.ofSeconds(10), // null or non-positive means "no timeout" 3); // extra attempts on 429/503; 0 disables retries ``` > **Note:** The default transport allows 30s per attempt and retries up to 2 extra times, honouring `Retry-After`, on HTTP `429` and `503` **only** — those are the only responses the server guarantees were not applied. No other status, network error, or timeout is retried, so a send is never silently duplicated. The SDK also sets a non-empty `User-Agent` (`senddart-java/1.0.0`) on every request, which the API requires on every route: a request without one is rejected with `403 validation_error` before it is even authenticated. > **Warning:** **Android is not supported by the default transport.** It uses `java.net.http.HttpClient`, which the Android runtime does not ship. An Android build must supply its own `com.senddart.http.HttpTransport` implementation (a single `execute(method, url, headers, body)` method, e.g. over OkHttp) and pass it to `new SendDart(apiKey, baseUrl, transport)`. Sending directly from a mobile app is a bad idea regardless — see the key warning below. > **Warning:** Read the `mb_` API key from the environment (or your secrets manager) and keep it server-side. Never ship it inside a mobile or desktop app a user can decompile, and never commit it — anyone with the key can send email as your account. ## Next steps - Send up to 100 messages in one request with `senddart.batch().sendEmails(List.of(BatchEmailRequest.builder()...))`. Batch items reject `attachments` and `scheduled_at` — `BatchEmailRequest` enforces that at compile time, so send those one at a time with `emails().send(...)`. - See the full [Send Email API](https://www.senddart.com/docs/api/emails-send) reference for every body field (`cc`, `bcc`, `replyTo`, `attachment`, `scheduledAt`). - Explore [the SDKs reference](https://www.senddart.com/docs/resources/sdks) for the other resources the SDK exposes — contacts, segments, campaigns, templates, automations, webhooks and events. - Verify inbound webhooks with `senddart.webhooks().verify(...)` — pass the raw request body, never re-serialized JSON. See [Webhooks](https://www.senddart.com/docs/webhooks/overview). - Read [Authentication](https://www.senddart.com/docs/authentication) for key scopes and permissions. - Prefer no dependency at all? [Send with Java over raw HTTP](https://www.senddart.com/docs/send-with/java) uses only `java.net.http`. --- # Send emails with .NET & C# > Send email from C# with the official SendDart NuGet package — async, typed, BCL-only, and ready for IHttpClientFactory. The official [`SendDart`](https://www.nuget.org/packages/SendDart) NuGet package (1.0.0) is the fastest way to send email from C#, F# or VB. It targets `net8.0` and takes no dependency beyond the BCL — `HttpClient` plus `System.Text.Json`. Every call is `async`, returns a typed model, and accepts an optional `CancellationToken`. You create one client and reach every operation through a flat method on the `ISendDart` interface — `EmailSendAsync`, `ContactCreateAsync`, `CampaignCreateAsync`, and so on. Create it once and reuse it for the lifetime of the process: it holds a pooled `HttpClient` and is safe to share across threads. ## Prerequisites 1. A **verified domain** for your `from` address — publish its SPF/DKIM/DMARC records first. ([guide](https://www.senddart.com/docs/domains/managing)) 2. An **API key** (`mb_...`), read from `SENDDART_API_KEY`. ([Authentication](https://www.senddart.com/docs/authentication)) 3. **.NET 8.0 or newer.** The package targets `net8.0` only, so a `net6.0`/`net7.0` or .NET Framework project cannot restore it. ## Install ```sh dotnet add package SendDart --version 1.0.0 ``` Drop `--version` to take the newest release. The package id is `SendDart` — capital S and D — and the root namespace matches it, so a single `using SendDart;` brings in the client, the request models and the exception type. ## Send an email `SendDartClient.Create(apiKey)` hands back the `ISendDart` interface, and `EmailSendAsync` posts to `/emails`. Address your first message to `delivered@test.senddart.com`, the delivery simulator: it is intercepted before it reaches a real mailbox, so it is safe to send to while you are wiring things up. Do not use `example.com` — it is a blocked recipient domain and the send comes back `422`. **Program.cs** ```csharp using SendDart; var apiKey = Environment.GetEnvironmentVariable("SENDDART_API_KEY") ?? throw new InvalidOperationException("SENDDART_API_KEY is not set"); ISendDart senddart = SendDartClient.Create(apiKey); try { EmailCreated sent = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Hello from .NET", HtmlBody = "

Sent with the official SendDart .NET SDK.

", }); Console.WriteLine("Sent email " + sent.Id); } catch (SendDartException ex) { // The API error envelope: { statusCode, name, message }. Console.Error.WriteLine(ex.StatusCode + " " + ex.Name + ": " + ex.Message); } ``` Two property names differ from the JSON they serialize to, because C# reserves nothing useful here: the HTML body is `HtmlBody` (sent as `html`) and the plain-text alternative is `TextBody` (sent as `text`). `To`, `Cc`, `Bcc` and `ReplyTo` are `EmailAddressList`, which converts implicitly from a single `string` or a `string[]`, so both of these compile: ```csharp To = "delivered@test.senddart.com", To = new[] { "delivered@test.senddart.com", "bounced@test.senddart.com" }, ``` ## Handling the response A successful send resolves to `EmailCreated`, whose single `Id` property is the new email id. Keep it to [retrieve the email](https://www.senddart.com/docs/api/emails-get) later or to correlate [webhook](https://www.senddart.com/docs/webhooks/overview) events. ```json { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` Any non-2xx answer throws `SendDartException` carrying the envelope as `StatusCode`, `Name` and `Message`. Branch on `Name` together with `StatusCode`, never on `Message` — message text is scrubbed of provider identifiers server-side and is not a stable contract. Plan and quota rejections additionally populate `Limit`, reputation gates populate `Reputation`, and a batch that failed part way through populates `Sent`/`SentCount`; all of them are `null` on an ordinary error. ```csharp catch (SendDartException ex) { switch (ex.Name) { case "validation_error": // 422 for a bad field — or 403 when the User-Agent header is missing. break; case "daily_quota_exceeded": if (ex.Limit is not null) { Console.Error.WriteLine(ex.Limit.Kind + " cap hit: " + ex.Limit.Used + "/" + ex.Limit.Limit); } break; } } ``` > **Note:** The SDK sends `User-Agent: senddart-dotnet/1.0.0` on every request. The API rejects a request with a missing or blank User-Agent with `403 validation_error` before it even authenticates, which is why raw-`HttpClient` callers have to set the header themselves and SDK callers do not. ## Dependency injection and tuning Pass `SendDartClientOptions` to supply your own `HttpClient` — typically one from `IHttpClientFactory` — or to change the timeout and retry budget. A client you supply is never disposed by the SDK, and it needs no headers of its own: the `Authorization` and `User-Agent` headers are set per request. **Program.cs (ASP.NET Core)** ```csharp builder.Services.AddHttpClient("senddart"); builder.Services.AddSingleton(sp => SendDartClient.Create( builder.Configuration["SendDart:ApiKey"]!, new SendDartClientOptions { HttpClient = sp.GetRequiredService().CreateClient("senddart"), Timeout = TimeSpan.FromSeconds(10), MaxRetries = 3, })); ``` `Timeout` bounds each individual attempt — a retry gets a fresh one — and defaults to 30 seconds; `TimeSpan.Zero` disables it. `MaxRetries` (default `2`) is the budget for `429` and `503` responses **only**. No other status, no network error and no timeout is retried, so a send is never silently duplicated. When you supply your own `HttpClient`, remember its own `HttpClient.Timeout` still applies on top. ## Scheduling a send Set `ScheduledAt` to an ISO 8601 timestamp to queue the email instead of sending it now. Scheduled sends bypass the delivery simulator, so use a real address on your own verified domain here — `delivered@test.senddart.com` is only honoured for immediate sends and would be rejected. ```csharp var sent = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "you@yourdomain.com", Subject = "Your weekly digest", HtmlBody = "

Scheduled ahead of time.

", ScheduledAt = "2026-09-01T09:00:00Z", }); // Later: reschedule or cancel by id. await senddart.EmailUpdateAsync(sent.Id, "2026-09-02T09:00:00Z"); await senddart.EmailCancelAsync(sent.Id); ``` > **Warning:** Read the `mb_` API key from configuration or your secrets manager and keep it server-side. Never ship it in a desktop, mobile, or Blazor WebAssembly client — the key can send email as your account. ## Next steps - Send up to 100 messages in one request with `EmailBatchAsync`, passing a list of `BatchEmailMessage`. Batch items reject `Attachments` and `ScheduledAt` — send those one at a time with `EmailSendAsync`. - Pass an `idempotencyKey` to `EmailSendAsync` to make a retry safe; replaying the key returns the original result. It is honoured by the send and batch-send routes only. - See the full [Send Email API](https://www.senddart.com/docs/api/emails-send) reference for every body field (`Cc`, `Bcc`, `ReplyTo`, `Attachments`, `Headers`, `TemplateId`). - Verify inbound webhooks with `WebhookSignature.Verify(rawBody, headers, signingSecret)` — pass the raw request body, never re-serialized JSON. See [Webhooks](https://www.senddart.com/docs/webhooks/overview). - Explore [the SDKs reference](https://www.senddart.com/docs/resources/sdks) for the other resources the package exposes — contacts, segments, topics, campaigns, templates, automations, domains and events. - Prefer no package at all? [Send with .NET over raw HTTP](https://www.senddart.com/docs/send-with/dotnet) uses only `IHttpClientFactory`. --- # Send emails over raw HTTP / cURL > The canonical POST /emails request — headers, body, and response — that any HTTP client can reproduce. At its core, SendDart is a plain JSON REST API — every SDK and framework guide is a wrapper around the same HTTP request shown here. If your language or tool can make an HTTPS `POST` with a couple of headers and a JSON body, it can send email through SendDart. Node.js / TypeScript users can skip the raw HTTP call and `npm install senddart` instead. This is the canonical request. Reproduce it in `curl`, Postman, an HTTP client library, or a no-code tool. ## Prerequisites 1. A **verified domain** so your `from` address is allowed. ([guide](https://www.senddart.com/docs/domains/managing)) 2. An **API key** (`mb_...`) for the `Authorization` header. ([Authentication](https://www.senddart.com/docs/authentication)) `POST /emails` ## Request headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `Authorization` | string | Yes | Your API key as a Bearer token: `Bearer mb_xxxxxxxxx`. See [Authentication](https://www.senddart.com/docs/authentication). | | `Content-Type` | string | Yes | Must be `application/json` — the body is a JSON object. | | `User-Agent` | string | Yes | Any descriptive value, e.g. `my-app/1.0`. A request with no `User-Agent` is rejected with `403 validation_error`. `curl` sets one for you; many client libraries and no-code tools do not. See [Authentication](https://www.senddart.com/docs/authentication). | | `Idempotency-Key` | string | No | Optional. A unique key so a retried request sends only once. See [Idempotency keys](https://www.senddart.com/docs/emails/idempotency). | ## The canonical request Replace `mb_xxxxxxxxx` with your key and use a `from` address on your verified domain. The minimum body is `from`, `to`, `subject`, and one of `html` / `text`. ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from SendDart", "html": "

Sent over raw HTTP.

" }' ``` > **Note:** Any HTTP client works — `curl`, `wget`, `HTTPie`, Postman, Insomnia, or your language's native client. The full set of body fields (`cc`, `bcc`, `reply_to`, `headers`, `attachments`, `scheduled_at`) is documented in the [Send Email API](https://www.senddart.com/docs/api/emails-send) reference. ## Handling the response A successful send returns HTTP `200` with the new email `id`: ```json { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` On failure the status is non-2xx and the body is a `{ statusCode, name, message }` error object. Always branch on the HTTP status before reading the `id`. ```json { "statusCode": 422, "name": "validation_error", "message": "The domain yourdomain.com is not verified." } ``` > **Warning:** Send this request only from a **server** (or a private script). The `mb_` API key authenticates as your account — never put it in a browser, a mobile app, or any client a user can inspect. Load it from an environment variable, not a literal in your code. ## Next steps - See the full [Send Email API](https://www.senddart.com/docs/api/emails-send) reference for every header, body field, and error. - Walk through the [Quickstart](https://www.senddart.com/docs/quickstart) end to end. - Read [Authentication](https://www.senddart.com/docs/authentication) to understand key permissions. --- # Managing emails > The email lifecycle, every delivery status, previewing HTML/text, and reading the per-email event log. Every email you send through SendDart is recorded as an **email** object with a stable `id`, the content you sent, and a `status` that advances as SendDart reports what happened to the message. You can [retrieve an email](https://www.senddart.com/docs/api/emails-get) at any time to read its current status and the full event log. Status changes are driven by real delivery notifications (delivery, bounce, complaint) plus SendDart's own open/click tracking engine. Each transition is recorded once and (if you have webhooks configured) forwarded as an `email.` webhook. ## Lifecycle An email starts in one of two states depending on whether you scheduled it, then advances through delivery and engagement states as events arrive: 1. **Created** — A `POST /emails` with no `scheduled_at` is queued for delivery immediately and starts as `sent`. A `POST /emails` with a future `scheduled_at` is stored as `scheduled` and held until its run time. 2. **Sent** — The message has been accepted for delivery and is on its way. Scheduled emails enter `sent` when the scheduler dispatches them at `scheduled_at`. 3. **Delivered** — The receiving mail server accepted the message. Some messages may instead report `delivery_delayed`, `bounced`, or `complained`. 4. **Engaged** — If open/click tracking is enabled on the sending domain, the email advances to `opened` and then `clicked` as the recipient interacts with it. ## Statuses The `status` field (and `last_event`) takes one of the following values: | Status | Meaning | | --- | --- | | `queued` | Transient initial state — accepted by SendDart and about to be handed to the sender. Sends move through this state in milliseconds, so you will normally observe `sent` (or `scheduled`) rather than `queued`. | | `scheduled` | Held for future delivery — `scheduled_at` is in the future. The email has not been sent yet and can still be rescheduled or canceled. | | `sent` | Queued for delivery. This is the initial state for an immediate (non-scheduled) send. | | `delivered` | The receiving server accepted the message. | | `delivery_delayed` | Delivery was temporarily delayed (e.g. a transient soft bounce or a throttling/grey-listing receiver). SendDart may still deliver it. | | `bounced` | The message bounced. A permanent (hard) bounce also auto-suppresses the recipient — see [Email bounces](https://www.senddart.com/docs/emails/bounces). | | `complained` | The recipient marked the message as spam. The recipient is auto-suppressed — see [Email suppressions](https://www.senddart.com/docs/emails/suppressions). | | `opened` | The recipient opened the email (open tracking must be enabled on the sending domain). | | `clicked` | The recipient clicked a tracked link (click tracking must be enabled on the sending domain). | | `canceled` | A scheduled email was canceled via [POST /emails/:id/cancel](https://www.senddart.com/docs/api/emails-cancel) before it was sent. | | `failed` | The message was rejected outright (for example, the content was rejected) and it was never sent. | | `suppressed` | The recipient was on the account suppression list, so the send to that recipient was skipped — see [Email suppressions](https://www.senddart.com/docs/emails/suppressions). | > **Note:** Open and click statuses are driven by SendDart's own tracking engine, not by delivery notifications, so they appear only when open/click tracking is enabled for the sending domain. ## Previewing content The retrieved email includes the exact `html` and `text` bodies you submitted, so you can preview what was sent. If you send only `text`, SendDart generates an HTML alternative from it; if you send only `html`, that HTML is delivered as-is. Tracking pixels and rewritten links (when tracking is enabled) are applied to the outbound message at send time and are not reflected back in the stored body. ## How links are tracked You write ordinary links. When the sending domain has click tracking enabled, SendDart replaces each destination with a tracked redirect **at send time**, in the copy handed to the recipient only. Everything a link can look like is covered, in **both** the `html` and the `text` body: `` targets, markdown-style `[label](url)` links, and bare URLs or domains written in running text (`https://acme.com/sale`, `www.acme.com`, `acme.com/sale`). Link text is preserved — a recipient still sees `acme.com/sale`, or your anchor text, and only the underlying destination changes. In the plain-text part, where there is no separate label, the URL itself is replaced so no untracked copy of the destination is left for the recipient to click. Content already inside an `` tag, attribute values, `
`/`` blocks, non-`http(s)` schemes (`mailto:`, `tel:`), and every unsubscribe or preference-centre link are left exactly as written. Opting out is never recorded as engagement.

| Property | Behaviour |
| --- | --- |
| Your stored content | Never modified. [GET /emails/:id](https://www.senddart.com/docs/api/emails-get), the dashboard, and your campaign and template editors keep showing the link you wrote, permanently. |
| One link per recipient | Every recipient of a campaign or multi-recipient send gets their own signed URL, so a click identifies exactly who clicked. The `html` and `text` parts of one message also carry separate link ids. |
| Repeat clicks | Always redirect. The recipient can click a link any number of times and always lands on your URL; only the *first* click per recipient per destination advances the click count, so re-reads never inflate your click rate. |
| Link lifetime | Permanent. A tracked link keeps resolving to your destination long after the email leaves your log-retention window — delivered mail is forever, so the redirect has to be. Once the email ages out of retention the click still redirects, it simply stops recording engagement. |
| Custom tracking domain | If the sending domain has a verified tracking subdomain, links use it (`https://t.yourdomain.com/t/c?…`); otherwise they use SendDart's shared host. Changing or switching off the subdomain later never breaks links already in delivered mail. |

> **Note:** Links in the **subject line** cannot be tracked — mail clients do not make subject text clickable, so there is nothing to rewrite. Put the link in the body.

## The event log

Each email carries an ordered `events` array — every recorded transition (`sent`, `delivered`, `delivery_delayed`, `bounced`, `complained`, `opened`, `clicked`, `failed`) with the time it occurred. Events are de-duplicated: a redelivered notification will not record the same event twice. Fetch the log with [GET /emails/:id](https://www.senddart.com/docs/api/emails-get).

```json
{
  "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794",
  "object": "email",
  "status": "delivered",
  "last_event": "delivered",
  "events": [
    { "type": "sent", "created_at": "2026-06-23T10:00:00.000Z" },
    { "type": "delivered", "created_at": "2026-06-23T10:00:04.512Z" }
  ]
}
```

> **Note:** Want events pushed to you instead of polled? Configure [webhooks](https://www.senddart.com/docs/webhooks/overview) to receive an `email.delivered`, `email.bounced`, `email.opened`, etc. callback as each event is recorded.

---

# Schedule email

> Send an email at a future time with scheduled_at, then reschedule or cancel it before it goes out.

Pass a `scheduled_at` timestamp to `POST /emails` to hold the email and deliver it later. The value is an **ISO 8601** datetime — always send it with an explicit timezone offset (or a trailing `Z` for UTC) so there is no ambiguity about when it fires.

## Schedule a send

When `scheduled_at` is in the future, SendDart stores the email with status `scheduled` and enqueues an internal job that the scheduler dispatches at the requested time. Open/click tracking, custom headers, and attachments are applied at the *actual* send time, so a scheduled email is assembled identically to an immediate one.

> **Note:** Emails can be scheduled up to **30 days** in advance. A `scheduled_at` further out than that is rejected with a `validation_error`.

**Node.js**

```js
import { SendDart } from 'senddart';

const mb = new SendDart('mb_xxxxxxxxx');

const { data, error } = await mb.emails.send({
  "from": "Acme ",
  "to": ["you@yourdomain.com"],
  "subject": "Your weekly digest",
  "html": "

Here is what you missed.

", "scheduled_at": "2026-06-24T09:00:00Z" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "you@yourdomain.com" ], "subject": "Your weekly digest", "html": "

Here is what you missed.

", "scheduled_at": "2026-06-24T09:00:00Z" }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "you@yourdomain.com" ], 'subject' => "Your weekly digest", 'html' => "

Here is what you missed.

", 'scheduled_at' => "2026-06-24T09:00:00Z" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "you@yourdomain.com" ], "subject": "Your weekly digest", "html": "

Here is what you missed.

", "scheduled_at": "2026-06-24T09:00:00Z" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"you@yourdomain.com"}, Subject: "Your weekly digest", Html: "

Here is what you missed.

", ScheduledAt: "2026-06-24T09:00:00Z", }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["you@yourdomain.com"], "Your weekly digest", ) .with_html("

Here is what you missed.

") .with_scheduled_at("2026-06-24T09:00:00Z"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("you@yourdomain.com") .subject("Your weekly digest") .html("

Here is what you missed.

") .scheduledAt("2026-06-24T09:00:00Z") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "you@yourdomain.com", Subject = "Your weekly digest", HtmlBody = "

Here is what you missed.

", ScheduledAt = "2026-06-24T09:00:00Z", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["you@yourdomain.com"], "subject": "Your weekly digest", "html": "

Here is what you missed.

", "scheduled_at": "2026-06-24T09:00:00Z" }' ``` **CLI** ```bash senddart emails send \ --from 'Acme ' \ --to 'you@yourdomain.com' \ --subject 'Your weekly digest' \ --html '

Here is what you missed.

' \ --scheduled-at '2026-06-24T09:00:00Z' ``` > **Note:** If `scheduled_at` is in the past (or omitted), the email is sent immediately and starts as `sent` rather than `scheduled`. ## Reschedule Change the delivery time of a still-`scheduled` email with [PATCH /emails/:id](https://www.senddart.com/docs/api/emails-update), passing a new `scheduled_at`. Only emails in the `scheduled` state can be rescheduled — once an email has been sent, the time is fixed. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.update('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', { "scheduled_at": "2026-06-25T09:00:00Z" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", { "scheduled_at": "2026-06-25T09:00:00Z" }) ``` **PHP** ```php emails->update('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', [ 'scheduled_at' => "2026-06-25T09:00:00Z" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", { "scheduled_at": "2026-06-25T09:00:00Z" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") updated, err := client.Emails.Update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", &senddart.UpdateEmailRequest{ ScheduledAt: "2026-06-25T09:00:00Z", }) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _updated = mb.emails.update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "2026-06-25T09:00:00Z").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().update( "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "2026-06-25T09:00:00Z"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailUpdateAsync( "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "2026-06-25T09:00:00Z"); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "scheduled_at": "2026-06-25T09:00:00Z" }' ``` **CLI** ```bash senddart emails update 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 \ --scheduled-at '2026-06-25T09:00:00Z' ``` ## Cancel Cancel a still-`scheduled` email with [POST /emails/:id/cancel](https://www.senddart.com/docs/api/emails-cancel). The email moves to `canceled` and the pending job is removed, so it will never be sent. Only `scheduled` emails can be canceled. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.cancel('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") ``` **PHP** ```php emails->cancel('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") canceled, err := client.Emails.Cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _canceled = mb.emails.cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailCancelAsync("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794/cancel' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails cancel 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 ``` > **Warning:** Once an email is canceled it cannot be rescheduled — submit a fresh `POST /emails` to send it later. > **Warning:** Attempting to reschedule or cancel an email that is no longer `scheduled` returns a `validation_error` — by then it has already been queued for delivery. ## Scheduled email failures A scheduled email may still fail when its run time arrives — the dispatch is attempted later than the original request, so conditions can change in between. When this happens the email moves to `failed` and the reason is recorded on its [event log](https://www.senddart.com/docs/emails/managing). Common causes: - **The recipient was suppressed in the meantime** — if every `to` recipient hard-bounced, complained, or unsubscribed between scheduling and dispatch, there is no one left to deliver to. - **The sending domain is no longer verified** — if the `from` domain’s verification lapsed before the run time, the send is rejected. - **Your sending quota stayed exhausted** — the send is retried hourly for about three days; if there is still no headroom it is failed rather than queued forever. --- # Attachments > Attach files to an email as base64 content or a hosted URL, with per-file and total size limits. Add files to an email with the `attachments` array. Each attachment is either inlined as **base64** `content` or referenced by a hosted **`path`** URL that SendDart fetches when the email is sent. ## Attachment fields | Name | Type | Required | Description | | --- | --- | --- | --- | | `filename` | string | Yes | The name the file is presented with in the recipient's mail client (e.g. `invoice.pdf`). | | `content` | string | No | The file contents, base64-encoded. Provide either `content` **or** `path`. | | `path` | string | No | A hosted URL SendDart fetches at send time. Provide either `path` **or** `content`. The fetch is SSRF-guarded. | | `content_type` | string | No | Optional MIME type for the attachment (e.g. `application/pdf`). Inferred from the filename when omitted. | | `content_id` | string | No | Embeds the attachment as an inline image; reference it in your HTML via ``. Only meaningful when the attachment is an image. | > **Warning:** Each attachment must provide exactly one of `content` or `path`. An attachment with neither is rejected. ## Size limits | Limit | Value | | --- | --- | | Per attachment | up to 25 MB | | Total per email | up to 40 MB | These limits cover the decoded bytes. Note that base64 encoding inflates the payload by roughly 33%, so a 25 MB file is about 34 MB of `content` in the request body. For large files, prefer `path` so SendDart streams the bytes server-side. > **Warning:** Attachments are **not supported on the batch endpoint** ([POST /emails/batch](https://www.senddart.com/docs/emails/batch)). To send an email with an attachment, use a single [POST /emails](https://www.senddart.com/docs/api/emails-send) request. ## Send with an attachment (hosted URL) The simplest form points `path` at a hosted file — SendDart fetches it at send time, so you never base64-encode anything yourself. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Your invoice", "html": "

Invoice attached.

", "attachments": [ { "filename": "invoice.pdf", "path": "https://yourdomain.com/invoices/invoice.pdf" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Your invoice", "html": "

Invoice attached.

", "attachments": [ { "filename": "invoice.pdf", "path": "https://yourdomain.com/invoices/invoice.pdf" } ] }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Your invoice", 'html' => "

Invoice attached.

", 'attachments' => [ [ 'filename' => "invoice.pdf", 'path' => "https://yourdomain.com/invoices/invoice.pdf" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Your invoice", "html": "

Invoice attached.

", "attachments": [ { "filename": "invoice.pdf", "path": "https://yourdomain.com/invoices/invoice.pdf" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Your invoice", Html: "

Invoice attached.

", Attachments: []senddart.Attachment{ { Filename: "invoice.pdf", Path: "https://yourdomain.com/invoices/invoice.pdf", }, }, }) ``` **Rust** ```rust use senddart::{Attachment, SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Your invoice", ) .with_html("

Invoice attached.

") .with_attachment(Attachment::from_path( "invoice.pdf", "https://yourdomain.com/invoices/invoice.pdf", )); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.Attachment; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Your invoice") .html("

Invoice attached.

") .attachment(Attachment.builder() .filename("invoice.pdf") .path("https://yourdomain.com/invoices/invoice.pdf") .build()) .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Your invoice", HtmlBody = "

Invoice attached.

", Attachments = new List { new() { Filename = "invoice.pdf", Path = "https://yourdomain.com/invoices/invoice.pdf", }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Your invoice", "html": "

Invoice attached.

", "attachments": [ { "filename": "invoice.pdf", "path": "https://yourdomain.com/invoices/invoice.pdf" } ] }' ``` > **Note:** A `path` URL is fetched through an SSRF-guarded client and must return the file with a 2xx status. If the fetch fails or the file exceeds the size limit, the send is rejected with a `422 invalid_attachment`. Base64 `content` is sized before anything is sent, so an over-size file is rejected without consuming quota. ## Send with base64 content Or inline the bytes directly as base64 `content` — useful for files you generate in memory and never host. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Your invoice", "html": "

Invoice attached.

", "attachments": [ { "filename": "invoice.pdf", "content": "JVBERi0xLjQKJ...base64...", "content_type": "application/pdf" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Your invoice", "html": "

Invoice attached.

", "attachments": [ { "filename": "invoice.pdf", "content": "JVBERi0xLjQKJ...base64...", "content_type": "application/pdf" } ] }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Your invoice", 'html' => "

Invoice attached.

", 'attachments' => [ [ 'filename' => "invoice.pdf", 'content' => "JVBERi0xLjQKJ...base64...", 'content_type' => "application/pdf" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Your invoice", "html": "

Invoice attached.

", "attachments": [ { "filename": "invoice.pdf", "content": "JVBERi0xLjQKJ...base64...", "content_type": "application/pdf" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Your invoice", Html: "

Invoice attached.

", Attachments: []senddart.Attachment{ { Filename: "invoice.pdf", Content: "JVBERi0xLjQKJ...base64...", ContentType: "application/pdf", }, }, }) ``` **Rust** ```rust use senddart::{Attachment, SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Your invoice", ) .with_html("

Invoice attached.

") .with_attachment(Attachment::from_content("invoice.pdf", "JVBERi0xLjQKJ...base64...") .with_content_type("application/pdf")); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.Attachment; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Your invoice") .html("

Invoice attached.

") .attachment(Attachment.builder() .filename("invoice.pdf") .content("JVBERi0xLjQKJ...base64...") .contentType("application/pdf") .build()) .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Your invoice", HtmlBody = "

Invoice attached.

", Attachments = new List { new() { Filename = "invoice.pdf", Content = "JVBERi0xLjQKJ...base64...", ContentType = "application/pdf", }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Your invoice", "html": "

Invoice attached.

", "attachments": [ { "filename": "invoice.pdf", "content": "JVBERi0xLjQKJ...base64...", "content_type": "application/pdf" } ] }' ``` --- # Batch sending > Send up to 100 emails in a single request with POST /emails/batch. Send multiple distinct emails in one request with `POST /emails/batch`. The body is a JSON array of email objects — each with the same shape as a single [POST /emails](https://www.senddart.com/docs/api/emails-send) body. A batch may contain **up to 100** emails. ## When to use batch sending Reach for the batch endpoint when you need to send many distinct transactional emails at once — order confirmations, notifications, or per-recipient messages with unique content — and want to cut the number of API calls. For marketing email to an audience, use a [campaign](https://www.senddart.com/docs/audiences/overview) instead. ## How a batch is processed SendDart validates **every** email in the batch *before* sending any of them. If a single item fails validation, the whole request is rejected with that item's error and nothing is sent — so an invalid item late in the array can never leave earlier items already delivered. Once all items pass validation, a **small** batch is sent in order before the response returns (`200`), and a **large** one is queued and delivered by the background sender (`202`). Either way the response body carries `data` with one id per email, in request order. See [Batch delivery modes](https://www.senddart.com/docs/api/emails-batch-delivery) for the size boundary, what `202` adds to the body, and how to follow a queued batch to completion. > **Note:** Each item is an independent email with its own `from`, `to`, `subject`, body, and headers. Suppressed recipients are skipped per-item, exactly as for a single send. ## Limitations - A batch holds a maximum of **100 emails**; an empty array is also rejected. - The `attachments` field is **not supported** in a batch — send those as single [POST /emails](https://www.senddart.com/docs/api/emails-send) requests. See [Attachments](https://www.senddart.com/docs/emails/attachments). - The `scheduled_at` field is **not supported** in a batch — schedule those as single sends. See [Schedule email](https://www.senddart.com/docs/emails/schedule). - A single invalid item (missing required field, invalid data) fails the whole request and nothing is sent. > **Note:** You can make a batch send safe to retry by passing an `Idempotency-Key` header for the whole batch — see [Idempotency keys](https://www.senddart.com/docs/emails/idempotency). Choose a key that represents the batch (e.g. a team or job id). ## Send a batch **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.batch.send([ { "from": "Acme ", "to": ["delivered+first@test.senddart.com"], "subject": "Welcome, first user", "html": "

Hello!

" }, { "from": "Acme ", "to": ["delivered+second@test.senddart.com"], "subject": "Welcome, second user", "html": "

Hello!

" } ]); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Batch.send([ { "from": "Acme ", "to": [ "delivered+first@test.senddart.com" ], "subject": "Welcome, first user", "html": "

Hello!

" }, { "from": "Acme ", "to": [ "delivered+second@test.senddart.com" ], "subject": "Welcome, second user", "html": "

Hello!

" } ]) ``` **PHP** ```php batch->send([ [ 'from' => "Acme ", 'to' => [ "delivered+first@test.senddart.com" ], 'subject' => "Welcome, first user", 'html' => "

Hello!

" ], [ 'from' => "Acme ", 'to' => [ "delivered+second@test.senddart.com" ], 'subject' => "Welcome, second user", 'html' => "

Hello!

" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Batch.send([ { "from": "Acme ", "to": [ "delivered+first@test.senddart.com" ], "subject": "Welcome, first user", "html": "

Hello!

" }, { "from": "Acme ", "to": [ "delivered+second@test.senddart.com" ], "subject": "Welcome, second user", "html": "

Hello!

" } ]) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") batch, err := client.Batch.SendEmails([]*senddart.BatchEmailRequest{ { From: "Acme ", To: []string{"delivered+first@test.senddart.com"}, Subject: "Welcome, first user", Html: "

Hello!

", }, { From: "Acme ", To: []string{"delivered+second@test.senddart.com"}, Subject: "Welcome, second user", Html: "

Hello!

", }, }) ``` **Rust** ```rust use senddart::{BatchEmailOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let items = vec![ BatchEmailOptions::new( "Acme ", ["delivered+first@test.senddart.com"], "Welcome, first user", ) .with_html("

Hello!

"), BatchEmailOptions::new( "Acme ", ["delivered+second@test.senddart.com"], "Welcome, second user", ) .with_html("

Hello!

"), ]; let _batch = mb.batch.send_emails(items).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.BatchEmailRequest; import java.util.List; SendDart senddart = new SendDart("mb_xxxxxxxxx"); List requests = List.of( BatchEmailRequest.builder() .from("Acme ") .to("delivered+first@test.senddart.com") .subject("Welcome, first user") .html("

Hello!

") .build(), BatchEmailRequest.builder() .from("Acme ") .to("delivered+second@test.senddart.com") .subject("Welcome, second user") .html("

Hello!

") .build()); SendDartResponse response = senddart.batch().sendEmails(requests); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailBatchSendAsync(new List { new() { From = "Acme ", To = "delivered+first@test.senddart.com", Subject = "Welcome, first user", HtmlBody = "

Hello!

", }, new() { From = "Acme ", To = "delivered+second@test.senddart.com", Subject = "Welcome, second user", HtmlBody = "

Hello!

", }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails/batch' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '[ { "from": "Acme ", "to": ["delivered+first@test.senddart.com"], "subject": "Welcome, first user", "html": "

Hello!

" }, { "from": "Acme ", "to": ["delivered+second@test.senddart.com"], "subject": "Welcome, second user", "html": "

Hello!

" } ]' ``` **CLI** ```bash senddart emails batch \ --data '[{"from":"Acme ","to":["delivered+first@test.senddart.com"],"subject":"Welcome, first user","html":"

Hello!

"},{"from":"Acme ","to":["delivered+second@test.senddart.com"],"subject":"Welcome, second user","html":"

Hello!

"}]' ``` ## Response The response is a `data` array of the created emails, each with its `id`, in the same order as the request. ```json { "data": [ { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" }, { "id": "1b2c3d4e-5f60-7a8b-9c0d-1e2f3a4b5c6d" } ] } ``` > **Warning:** A batch larger than 100 emails, or an empty array, is rejected with a `validation_error`. --- # Custom headers > Attach custom MIME headers to an email with the headers object. Add custom MIME headers to an outbound email with the `headers` object — a map of header name to string value. These are written verbatim into the message, which is useful for correlation IDs, threading, or downstream filtering on the receiving side. SendDart already sets all the headers required for deliverability. Custom headers are an advanced feature for a few specific cases — for example, setting a unique **`X-Entity-Ref-ID`** so that Gmail does not collapse a series of distinct messages into a single conversation thread. ## Example A common use is a per-message reference ID you can correlate against your own systems: **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Order confirmation", "html": "

Thanks for your order.

", "headers": { "X-Entity-Ref-ID": "order_12345", "X-Mailer-Campaign": "transactional" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Order confirmation", "html": "

Thanks for your order.

", "headers": { "X-Entity-Ref-ID": "order_12345", "X-Mailer-Campaign": "transactional" } }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Order confirmation", 'html' => "

Thanks for your order.

", 'headers' => [ 'X-Entity-Ref-ID' => "order_12345", 'X-Mailer-Campaign' => "transactional" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Order confirmation", "html": "

Thanks for your order.

", "headers": { "X-Entity-Ref-ID": "order_12345", "X-Mailer-Campaign": "transactional" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Order confirmation", Html: "

Thanks for your order.

", Headers: map[string]string{ "X-Entity-Ref-ID": "order_12345", "X-Mailer-Campaign": "transactional", }, }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Order confirmation", ) .with_html("

Thanks for your order.

") .with_header("X-Entity-Ref-ID", "order_12345") .with_header("X-Mailer-Campaign", "transactional"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Order confirmation") .html("

Thanks for your order.

") .header("X-Entity-Ref-ID", "order_12345") .header("X-Mailer-Campaign", "transactional") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Order confirmation", HtmlBody = "

Thanks for your order.

", Headers = new Dictionary { ["X-Entity-Ref-ID"] = "order_12345", ["X-Mailer-Campaign"] = "transactional", }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Order confirmation", "html": "

Thanks for your order.

", "headers": { "X-Entity-Ref-ID": "order_12345", "X-Mailer-Campaign": "transactional" } }' ``` **CLI** ```bash senddart emails send \ --from 'Acme ' \ --to 'delivered@test.senddart.com' \ --subject 'Order confirmation' \ --html '

Thanks for your order.

' \ --headers '{"X-Entity-Ref-ID":"order_12345","X-Mailer-Campaign":"transactional"}' ``` ## Header sanitization Both header names and values are sanitized before they are written to the message: any carriage-return or line-feed characters (`\r`, `\n`) are stripped and collapsed to a single space. This prevents header injection — a value cannot smuggle in extra headers or a premature body break. > **Note:** Set `List-Unsubscribe` by hand only on a transactional send (no `topic_id`), where SendDart adds nothing. For campaigns **and** for `POST /emails` sends that set `topic_id`, SendDart injects the RFC 8058 `List-Unsubscribe` header automatically — don't set it yourself there. See [Unsubscribe links](https://www.senddart.com/docs/emails/unsubscribe). --- # Idempotency keys > Safely retry a send without sending twice using the Idempotency-Key header. Network failures and timeouts make it hard to know whether a `POST /emails` actually succeeded. Pass an `Idempotency-Key` header so that retrying the same request is safe: SendDart processes the send **once** and replays the original response for any repeat of that key. > **Note:** Idempotency keys are supported on both the `POST /emails` and `POST /emails/batch` endpoints. ## Using a key Generate a unique key per logical send and send it on the request. If you have to retry, send the **same** key. A key must be between **1 and 255 characters**; a UUID is a good choice. A practical pattern is to derive the key from the entity the email is about, e.g. `welcome-user/123456789` for a single send or `team-quota/123456789` for a batch. ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: 8f3a9c1e-2b4d-4e6f-9a1b-c2d3e4f5a6b7' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Receipt", "html": "

Thanks!

" }' ``` ## Replay behavior - **First request** — the send is processed and the response (the email `id`) is stored against the key. - **Retry with the same key** — the stored response is replayed with its original status code. No second email is sent. - **Concurrent retry** — if a second request with the same key arrives while the first is *still in flight*, it is rejected with `409 concurrent_idempotent_requests` rather than risking a double send. > **Note:** Idempotency keys are scoped per account and remembered for **24 hours**. After that window the key is forgotten and reusing it processes a fresh send. ## Possible responses A successful response returns the email `id` (replayed unchanged on a retry). Otherwise you may get one of these errors: | Status | Error | Meaning | | --- | --- | --- | | `400` | `invalid_idempotency_key` | The key is outside the 1–255 character range. Retry with a valid key, or without an idempotency key. | | `409` | `invalid_idempotent_request` | This key was already used for a request with a **different** payload. Retrying is futile until you change the key or the payload. | | `409` | `concurrent_idempotent_requests` | Another request with the same key is still in flight. Its original response isn’t available yet — it is safe to retry later. | > **Warning:** A key only protects against duplicate *delivery* of the same intended email. Reusing a key for a genuinely different payload returns `invalid_idempotent_request` rather than replaying — always use a fresh key for a new send. --- # Email bounces > How SendDart records hard and soft bounces, and suppresses permanent or repeatedly failing recipients. A bounce means the receiving mail system rejected your message. SendDart distinguishes two kinds, and treats them differently: | Type | What it means | SendDart behavior | | --- | --- | --- | | **Hard (permanent)** | The address is invalid or permanently undeliverable. | Email status → `bounced`; the recipient is **auto-suppressed** for your account. | | **Soft (transient)** | A temporary problem — full mailbox, throttling, grey-listing. | Recorded as `delivery_delayed` or `bounced`; one failure remains retryable, but a second soft bounce within 30 days is **auto-suppressed**. | ## Bounce types and subtypes When a message bounces, SendDart reports a **type** and a more specific **subtype** describing why delivery failed. These are recorded on the email so you can tell a permanent failure apart from a retryable one. There are three types: | Type | Subtype | What it means | | --- | --- | --- | | `Permanent` (hard) | `General` | The recipient’s provider sent a hard bounce — the address is undeliverable and will not accept the message. | | `Permanent` (hard) | `NoEmail` | The recipient address could not be extracted from the bounce message. | | `Transient` (soft) | `General` | A general temporary failure. A later send to the same recipient may succeed once the issue clears. | | `Transient` (soft) | `MailboxFull` | The recipient’s inbox was full. Retrying later may succeed. | | `Transient` (soft) | `MessageTooLarge` | The message exceeded the recipient provider’s size limit. Reduce the size and retry. | | `Transient` (soft) | `ContentRejected` | The provider rejected the message content. Changing the content may let it through. | | `Transient` (soft) | `AttachmentRejected` | An attachment was unacceptable (file type or size). Remove or change it and retry. | | `Undetermined` | `Undetermined` | The server bounced but the message lacked enough detail to classify the reason. | > **Note:** `Permanent` bounces auto-suppress immediately. A single `Transient` or `Undetermined` bounce remains retryable; a second soft bounce for the same address within 30 days auto-suppresses it, preventing a persistent full mailbox or receiver failure from being retried indefinitely. Note that some autoresponders signal as a `Transient` bounce rather than a real failure. ## How bounces are recorded When a bounce is reported, SendDart matches it to the original email, advances its `status` to `bounced` (or `delivery_delayed` for a transient delay), and appends a `bounced` (or `delivery_delayed`) entry to the email's [event log](https://www.senddart.com/docs/emails/managing). The same event is forwarded to your [webhooks](https://www.senddart.com/docs/webhooks/overview) as `email.bounced` (or `email.delivery_delayed`). Redelivered notifications are de-duplicated, so a bounce is never recorded or forwarded twice. ## Auto-suppression after permanent or repeated failure A **permanent** bounce immediately adds the recipient to your account-wide [suppression list](https://www.senddart.com/docs/emails/suppressions). A first soft bounce remains retryable, but two distinct soft-bounced emails within 30 days add the address too. On every later send, SendDart skips that recipient — protecting your sender reputation without permanently blocking an address for one short-lived outage. > **Warning:** Repeatedly mailing addresses that hard-bounce damages your domain's deliverability with mailbox providers. Auto-suppression exists to prevent exactly this — do not work around it by stripping suppressed recipients from your own lists and re-adding them. --- # Email suppressions > The account-wide suppression list: how recipients are added and how suppressed sends are skipped. SendDart maintains an **account-wide suppression list** of addresses you should no longer email. Any send — single, batch, scheduled, or campaign — skips recipients on this list before queuing the message for delivery. ## How addresses are added A recipient is added to your suppression list when: - They **hard-bounce** — a permanent bounce. See [Email bounces](https://www.senddart.com/docs/emails/bounces). - They **soft-bounce repeatedly** — two distinct transient or undetermined bounces within 30 days. - They **complain** — they mark a message as spam (a complaint). - They **unsubscribe** — via a campaign unsubscribe link, or a manual unsubscribe you record. > **Note:** Not every mailbox provider reports a complaint — most notably Gmail / Google Workspace does not emit a complaint when a recipient marks a message as spam. So a missing `complained` event does not mean a message was well received. ## How suppression is applied Before each send, SendDart checks every recipient (across `to`, `cc`, and `bcc`) against your suppression list and removes any matches. Matching is case-insensitive. - If *some* `to` recipients are suppressed, they are dropped and the email is sent to the remaining recipients. - If **all** `to` recipients are suppressed, the send is rejected with a `validation_error` — there is no one left to deliver to. > **Note:** Suppression is scoped to your account: an address you suppressed never affects another account, and another account's suppressions never affect yours. > **Warning:** Suppression is a deliverability and compliance safeguard. Mailing recipients who bounced, complained, or unsubscribed harms your reputation and can violate anti-spam regulations — the list is enforced on every send path for this reason. > **Warning:** If you remove an address from the suppression list and it bounces or is marked as spam again, it will simply be suppressed again. Repeatedly mailing addresses that bounce or complain negatively impacts your sender reputation. --- # Unsubscribe links > A `POST /emails` send carries an opt-out only when it sets `topic_id`; campaigns inject a per-contact unsubscribe link and List-Unsubscribe header automatically. How unsubscribe is handled depends on what you are sending: a **transactional** email, a **topic** email (`POST /emails` with `topic_id`), or a **campaign**. | Send | Unsubscribe footer + `List-Unsubscribe` | What an opt-out does | | --- | --- | --- | | `POST /emails` **without** `topic_id` | No — never added | — | | `POST /emails` **with** `topic_id` | Yes — added automatically | Removes that address from **that one topic** | | Campaign | Yes — added automatically | Unsubscribes the contact from **all** your email | ## Transactional emails (sender-driven) For `POST /emails` **without** a `topic_id`, SendDart does **not** add an unsubscribe link or `List-Unsubscribe` header. Transactional sends — receipts, password resets, confirmations — are sender-driven: if a message needs an unsubscribe mechanism, you add it to your own HTML. This keeps SendDart from injecting footers into messages where they don't belong. > **Warning:** This is deliberate, not an omission. In SendDart an unsubscribe writes a [suppression](https://www.senddart.com/docs/emails/suppressions), and a suppressed address is skipped by **every** later send to it — password resets and receipts included. A footer on a password-reset email would let one stray click permanently break that recipient's own account recovery. Mark a send as subscription mail with `topic_id` and you get an opt-out that is scoped to the topic instead. > **Note:** If a recipient should be able to opt out of a transactional email, include your own unsubscribe link in the `html` body. You can record the resulting opt-out as a [suppression](https://www.senddart.com/docs/emails/suppressions) so future sends to that address are skipped. If you manage your own list and want a native one-click control on transactional mail, you can set the headers yourself via the [`headers`](https://www.senddart.com/docs/emails/headers) object — a `List-Unsubscribe` header pointing at your unsubscribe URL, plus `List-Unsubscribe-Post: List-Unsubscribe=One-Click` for [RFC 8058](https://datatracker.ietf.org/doc/html/rfc8058) one-click support. ```json "headers": { "List-Unsubscribe": "", "List-Unsubscribe-Post": "List-Unsubscribe=One-Click" } ``` When honoring a one-click request, your endpoint should accept a `POST` from that URL and return a blank `200 OK` or `202 Accepted` (and serve the normal unsubscribe page on `GET`). Ensure the recipient stops receiving email within **48 hours**. Mailbox providers such as Gmail and Yahoo require RFC 8058 compliance for bulk senders (more than 5,000 messages per day to their domains). ## Topic emails (automatic, scoped to the topic) A `POST /emails` send that sets [`topic_id`](https://www.senddart.com/docs/topics/overview) is subscription mail: SendDart already skips recipients who have left that topic, so it also gives every recipient a way to leave. Both mechanisms are added automatically, exactly as they are for a campaign: - An **unsubscribe footer** appended to the HTML body — unless your body already contains a SendDart unsubscribe link (see the merge tag below), in which case yours is left alone. - An RFC 8058 **`List-Unsubscribe`** header with **`List-Unsubscribe-Post`**, so mailbox providers can render their native one-click unsubscribe control. The link is minted **per recipient** from that recipient's own address, so every `to`, `cc`, and `bcc` address is delivered its own copy carrying only its own opt-out link — one recipient can never opt out another. The recipient does **not** have to be a contact: the opt-out is recorded against the address itself. > **Note:** The scope of the opt-out is **that one topic**. It is not a suppression and not an audience-wide unsubscribe: the address keeps receiving your other topics, your campaigns, and your transactional mail. Only later sends carrying the same `topic_id` — from `POST /emails`, a scheduled send, or a campaign targeting that topic — skip it. To place the link yourself instead of taking the default footer, include `{{{SENDDART_UNSUBSCRIBE_URL}}}` in your `html` (triple braces so the URL is inserted raw). SendDart substitutes each recipient's own URL and then skips the default footer, so you get one opt-out link, where you put it — not two. Topic opt-outs are listed per topic in the dashboard under **Audiences → Topics → View opt-outs**, showing both contacts who opted out and addresses that used a topic unsubscribe link. ## Campaigns (automatic) For campaigns (marketing email to an [audience](https://www.senddart.com/docs/audiences/overview)), SendDart injects unsubscribe handling automatically for every recipient: - A **per-contact unsubscribe link** is appended to the message footer. Each recipient gets a unique link, so one click opts that individual out. - An RFC 8058 **`List-Unsubscribe`** header (with `List-Unsubscribe-Post`) is emitted so mailbox providers can render a native one-click unsubscribe control. When a contact unsubscribes through either path, they are added to your [suppression list](https://www.senddart.com/docs/emails/suppressions) and skipped on subsequent sends. The unsubscribe link is appended after any click-tracking rewrite, so the opt-out link is never wrapped by the click tracker. > **Warning:** Don't set a `List-Unsubscribe` header by hand on a campaign — SendDart manages it. See [Custom headers](https://www.senddart.com/docs/emails/headers) for transactional header usage. --- # Embed inline images > Reference an attachment from your HTML with a cid: source so an image renders inline in the body of the email. You can embed an image directly in the HTML body of an email instead of hosting it on an external server. The image travels with the message as an [attachment](https://www.senddart.com/docs/emails/attachments), and the HTML references it by a **content id** (`cid`). > **Warning:** Inline images (and any attachment) are not supported on the [batch endpoint](https://www.senddart.com/docs/api/emails-batch). Use a single [POST /emails](https://www.senddart.com/docs/api/emails-send) when you need to embed an image. ## How it works 1. **Add a cid: reference in the HTML** — Use the `cid:` prefix in the `src` of an `` tag, e.g. ``. The value after `cid:` is an arbitrary id you choose; it must be under 128 characters. 2. **Set content_id on the attachment** — Add the same id as the `content_id` field of the matching attachment object. SendDart links the `` to the attachment by this id when it assembles the message. ## Remote image Reference a hosted image with `path`. SendDart fetches and base64-encodes it for you at send time (the fetch is SSRF-guarded), so you do not need to encode anything yourself. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Thank you for contacting us", "html": "

Here is our inline logo

", "attachments": [ { "path": "https://files.example.com/logo.png", "filename": "logo.png", "content_id": "logo-image" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Thank you for contacting us", "html": "

Here is our inline logo

", "attachments": [ { "path": "https://files.example.com/logo.png", "filename": "logo.png", "content_id": "logo-image" } ] }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Thank you for contacting us", 'html' => "

Here is our inline logo

", 'attachments' => [ [ 'path' => "https://files.example.com/logo.png", 'filename' => "logo.png", 'content_id' => "logo-image" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Thank you for contacting us", "html": "

Here is our inline logo

", "attachments": [ { "path": "https://files.example.com/logo.png", "filename": "logo.png", "content_id": "logo-image" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Thank you for contacting us", Html: "

Here is our inline logo

", Attachments: []senddart.Attachment{ { Path: "https://files.example.com/logo.png", Filename: "logo.png", ContentId: "logo-image", }, }, }) ``` **Rust** ```rust use senddart::{Attachment, SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Thank you for contacting us", ) .with_html("

Here is our inline logo

") .with_attachment(Attachment::from_path("logo.png", "https://files.example.com/logo.png") .with_content_id("logo-image")); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.Attachment; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Thank you for contacting us") .html("

Here is our inline logo

") .attachment(Attachment.builder() .path("https://files.example.com/logo.png") .filename("logo.png") .contentId("logo-image") .build()) .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Thank you for contacting us", HtmlBody = "

Here is our inline logo

", Attachments = new List { new() { Path = "https://files.example.com/logo.png", Filename = "logo.png", ContentId = "logo-image", }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Thank you for contacting us", "html": "

Here is our inline logo

", "attachments": [ { "path": "https://files.example.com/logo.png", "filename": "logo.png", "content_id": "logo-image" } ] }' ``` ## Local image To inline a file from disk, read it and base64-encode the bytes into the `content` field, then point the `content_id` at the matching `cid`. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Thank you for contacting us", "html": "

Here is our inline logo

", "attachments": [ { "content": "iVBORw0KGgoAAAANS...base64...", "filename": "logo.png", "content_type": "image/png", "content_id": "logo-image" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Thank you for contacting us", "html": "

Here is our inline logo

", "attachments": [ { "content": "iVBORw0KGgoAAAANS...base64...", "filename": "logo.png", "content_type": "image/png", "content_id": "logo-image" } ] }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Thank you for contacting us", 'html' => "

Here is our inline logo

", 'attachments' => [ [ 'content' => "iVBORw0KGgoAAAANS...base64...", 'filename' => "logo.png", 'content_type' => "image/png", 'content_id' => "logo-image" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Thank you for contacting us", "html": "

Here is our inline logo

", "attachments": [ { "content": "iVBORw0KGgoAAAANS...base64...", "filename": "logo.png", "content_type": "image/png", "content_id": "logo-image" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Thank you for contacting us", Html: "

Here is our inline logo

", Attachments: []senddart.Attachment{ { Content: "iVBORw0KGgoAAAANS...base64...", Filename: "logo.png", ContentType: "image/png", ContentId: "logo-image", }, }, }) ``` **Rust** ```rust use senddart::{Attachment, SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Thank you for contacting us", ) .with_html("

Here is our inline logo

") .with_attachment(Attachment::from_content("logo.png", "iVBORw0KGgoAAAANS...base64...") .with_content_type("image/png") .with_content_id("logo-image")); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.Attachment; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Thank you for contacting us") .html("

Here is our inline logo

") .attachment(Attachment.builder() .content("iVBORw0KGgoAAAANS...base64...") .filename("logo.png") .contentType("image/png") .contentId("logo-image") .build()) .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Thank you for contacting us", HtmlBody = "

Here is our inline logo

", Attachments = new List { new() { Content = "iVBORw0KGgoAAAANS...base64...", Filename = "logo.png", ContentType = "image/png", ContentId = "logo-image", }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Thank you for contacting us", "html": "

Here is our inline logo

", "attachments": [ { "content": "iVBORw0KGgoAAAANS...base64...", "filename": "logo.png", "content_type": "image/png", "content_id": "logo-image" } ] }' ``` ## Things to keep in mind - When you inline a **local** image you must base64-encode it yourself in `content`. With a **remote** `path`, SendDart fetches and encodes it for you. - Inline images increase the total size of the email — they count toward the per-email (40 MB) [size limit](https://www.senddart.com/docs/emails/attachments). - Some clients (especially webmail) may reject or strip inline images. Where it matters, host the image and link to it normally instead. - Set a `content_type` (e.g. `image/png`) or a `filename` (e.g. `logo.png`) so receiving clients render the image correctly. > **Note:** All [attachment requirements and limits](https://www.senddart.com/docs/emails/attachments) apply to inline images, since an inline image is just an attachment referenced from the HTML. --- # Send test emails > Simulate delivered, bounced, complained, and suppressed events with SendDart test addresses — without harming your domain reputation. While building your integration it is important to exercise the different deliverability outcomes — a delivery, a hard bounce, a spam complaint, a suppressed recipient. SendDart provides reserved **test addresses** that trigger each event reliably, so you can verify your [webhooks](https://www.senddart.com/docs/webhooks/overview), event handling, and suppression logic without mailing real people. > **Warning:** Do not test by inventing fake addresses or pointing at a throwaway SMTP server — both can hurt your domain reputation. Use the addresses below instead. > **Note:** Test sends still count against your account’s sending quota and produce real [email objects](https://www.senddart.com/docs/emails/managing) with a full event log. ## Available test addresses | Address | Simulates | | --- | --- | | `delivered@test.senddart.com` | A successful delivery — the email advances to `delivered`. | | `bounced@test.senddart.com` | A hard bounce (an SMTP `550 5.1.1` "Unknown User"). The email moves to `bounced` and the recipient is [auto-suppressed](https://www.senddart.com/docs/emails/bounces). | | `complained@test.senddart.com` | The message is delivered but the recipient marks it as spam — a `complained` event, and the recipient is suppressed. | | `suppressed@test.senddart.com` | The recipient is already on your [suppression list](https://www.senddart.com/docs/emails/suppressions), so the send is skipped with status `suppressed`. | ## Send to a test address **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["bounced@test.senddart.com"], "subject": "Testing a bounce", "html": "

This should hard-bounce.

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "bounced@test.senddart.com" ], "subject": "Testing a bounce", "html": "

This should hard-bounce.

" }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "bounced@test.senddart.com" ], 'subject' => "Testing a bounce", 'html' => "

This should hard-bounce.

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "bounced@test.senddart.com" ], "subject": "Testing a bounce", "html": "

This should hard-bounce.

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"bounced@test.senddart.com"}, Subject: "Testing a bounce", Html: "

This should hard-bounce.

", }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["bounced@test.senddart.com"], "Testing a bounce", ) .with_html("

This should hard-bounce.

"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("bounced@test.senddart.com") .subject("Testing a bounce") .html("

This should hard-bounce.

") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "bounced@test.senddart.com", Subject = "Testing a bounce", HtmlBody = "

This should hard-bounce.

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["bounced@test.senddart.com"], "subject": "Testing a bounce", "html": "

This should hard-bounce.

" }' ``` **CLI** ```bash senddart emails send \ --from 'Acme ' \ --to 'bounced@test.senddart.com' \ --subject 'Testing a bounce' \ --html '

This should hard-bounce.

' ``` ## Labeling test runs The `delivered`, `bounced`, and `complained` addresses support **plus-labeling**: add any string after a `+` (e.g. `delivered+signup@test.senddart.com`) and the event still fires, but the recipient address now identifies that specific test run. This is useful for correlating webhook callbacks back to the flow that triggered them. ```text delivered+signup@test.senddart.com delivered+password-reset@test.senddart.com bounced+import-batch@test.senddart.com ``` > **Warning:** The `suppressed@test.senddart.com` address does not support labeling. --- # Deliverability insights > Best-practice checks SendDart runs against a sent email, split into Attention items and Improvements, to help your mail reach the inbox. When you open a sent email in the SendDart dashboard, the **Insights** tab runs a set of deliverability best-practice checks against that message and flags anything that could keep it out of the inbox. Each check either passes (a green check) or returns advice. Results are grouped into two categories: **Attention** and **Improvements**. ## Attention Concrete changes to the message that improve deliverability. These are worth acting on for most sends. ### Link URLs match the sending domain Links in the body should point back to the same domain you are sending from. Mismatched URLs are a classic spam signal — if you send from `@widgets.com`, links should resolve to `https://widgets.com`. ### DMARC record is valid DMARC is a TXT record that tells receivers how to handle mail that fails SPF or DKIM. A valid policy builds trust and, since 2024, is required by Gmail and Yahoo for bulk senders. See [Implementing DMARC](https://www.senddart.com/docs/domains/dmarc); SendDart suggests a starter record on the domain page if you are unsure what to publish. ### Include a plain-text version A plain-text alternative makes your message readable in clients that do not render HTML and is a positive deliverability signal. Pass it via the `text` parameter on [POST /emails](https://www.senddart.com/docs/api/emails-send). If you send only `html` and omit `text`, SendDart auto-generates a plain-text alternative from your HTML — though supplying your own `text` gives you full control over how it reads. ### Avoid "no-reply" senders A `no-reply@` from-address signals one-way communication and lowers trust. Some providers weigh replies when filtering, so a monitored, reply-able address both helps deliverability and lets recipients reach you. ### Keep the body size small Gmail clips messages larger than ~102 KB, hiding the rest behind a "view entire message" link (which also breaks open tracking). This check reports the current size of your email so you can trim it. ### Use full YouTube URLs Gmail’s filters flag shortened `youtu.be` links as possible phishing. Use the full form — `https://www.youtube.com/watch?v=abc123` instead of `https://youtu.be/abc123`. ## Improvements Practice changes worth considering when you are actively diagnosing a deliverability problem. ### Send from a subdomain Sending from a subdomain (e.g. `mail.yourdomain.com`) rather than the root domain segments your traffic by purpose, so a problem with one stream of mail does not drag down the reputation of the others. ### Disable click tracking Click tracking rewrites your links, which can occasionally trip phishing heuristics. For sensitive transactional mail — login links, email verification — turning click tracking off on the sending domain can improve inbox placement. ### Disable open tracking Open tracking injects a pixel, which some filters treat as a spam signal. Disabling it on the domain can help sensitive transactional mail slip past those filters. > **Note:** Open rates are inherently approximate — privacy proxies and image-blocking can both inflate and suppress them — so treat the open metric as a trend, not a precise count. --- # Receiving emails > Receive inbound email on a SendDart domain: every message is parsed and delivered to your webhook as an email.received event. SendDart supports **receiving** email (commonly called *inbound*) alongside sending. Inbound is useful for building support inboxes, processing forwarded receipts and attachments, and replying to customers in-thread — all driven by your own code. SendDart accepts every incoming message for your receiving domain, parses the body and attachments, stores the message, and then sends a `POST` request to a webhook endpoint you choose. Your application reacts to that callback. ## How it works SendDart processes all incoming mail for your receiving domain, parses the contents and attachments, and delivers an `email.received` webhook to your endpoint. Receiving always runs on [your own domain](https://www.senddart.com/docs/receiving/custom-domains) — the same domain you verified for sending. > **Note:** **Any** email sent to your receiving domain is accepted and forwarded to your webhook. Route intelligently on the `to` field of the event: if your domain is `yourdomain.tld`, you receive mail for `anything@yourdomain.tld`. Adding the `MX` record to a subdomain works the same way — `anything@subdomain.yourdomain.tld`. ## 1. Turn on receiving for your domain Receiving is enabled per domain, and the domain must already be **verified** for sending. See [custom receiving domains](https://www.senddart.com/docs/receiving/custom-domains) for the full walkthrough: 1. **Open Domains** — Go to the Domains page in the SendDart dashboard and open a verified domain. 2. **Turn on Receiving** — Enable the "Receiving" toggle. SendDart then shows the one `MX` record to add. 3. **Add the MX record** — Paste the `MX` record (host and priority) into your DNS provider and save. Mail for `anything@yourdomain.tld` then arrives in SendDart. ## 2. Configure a webhook Create a webhook endpoint that subscribes to the `email.received` event: 1. **Open Webhooks** — Go to the Webhooks page in the dashboard. 2. **Add a webhook** — Click "Add Webhook" and enter the public URL of your endpoint. 3. **Subscribe to email.received** — Select the `email.received` event type and save. > **Note:** For local development, expose your localhost server with a tunnel such as [ngrok](https://ngrok.com/download) or VS Code Port Forwarding. These give your dev machine a public URL (e.g. `https://example123.ngrok.io/api/webhook`) that SendDart can call. ## 3. Receive email events In your application, create a route that accepts `POST` requests and reacts when the event `type` is `email.received`: **Node.js** ```js // app/api/events/route.ts (Next.js route handler) import type { NextRequest } from 'next/server'; import { NextResponse } from 'next/server'; export const POST = async (request: NextRequest) => { const event = await request.json(); if (event.type === 'email.received') { // event.data.email_id, event.data.from, event.data.to, ... return NextResponse.json(event); } return NextResponse.json({}); }; ``` **Express** ```js import express from 'express'; const app = express(); app.use(express.json()); app.post('/api/events', (req, res) => { const event = req.body; if (event.type === 'email.received') { // process the inbound email by id console.log(event.data.email_id, event.data.from, event.data.subject); return res.json(event); } res.json({}); }); ``` **Python** ```python from flask import Flask, request, jsonify app = Flask(__name__) @app.post("/api/events") def events(): event = request.get_json() if event.get("type") == "email.received": data = event["data"] print(data["email_id"], data["from"], data["subject"]) return jsonify(event) return jsonify({}) ``` Once you receive the event you can fetch the full message and process its body and attachments. We strongly recommend [verifying the webhook signature](https://www.senddart.com/docs/webhooks/verify) so only genuine SendDart requests are accepted. ## The email.received payload The webhook body carries the event envelope plus a `data` object with the message **metadata** — id, addressing, `message_id`, subject, and attachment metadata: ```json { "type": "email.received", "created_at": "2026-02-22T23:41:12.126Z", "data": { "email_id": "56761188-7520-42d8-8898-ff6fc54ce618", "created_at": "2026-02-22T23:41:11.894719+00:00", "from": "onboarding@test.senddart.com", "to": ["delivered@test.senddart.com"], "bcc": [], "cc": [], "received_for": ["forwarded@example.com"], "message_id": "<111-222-333@email.example.com>", "subject": "Sending this example", "attachments": [ { "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318", "filename": "avatar.png", "content_type": "image/png", "content_disposition": "inline", "content_id": "img001" } ] } } ``` > **Warning:** The webhook does **not** include the email body, headers, or attachment content — only metadata. Call the [Retrieve received email](https://www.senddart.com/docs/receiving/get-email-content) API for the body and headers, or the [List attachments](https://www.senddart.com/docs/receiving/attachments) API for attachment content. This keeps payloads small enough for serverless platforms with limited request-body sizes. ### Envelope fields The top-level envelope wraps every webhook and identifies the event: | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type. For inbound mail this is always `email.received`. | | `created_at` | string | No | ISO 8601 timestamp for when the event was generated. | | `data` | object | No | The message metadata (fields below). | ### data fields The `data` object carries the parsed addressing and threading metadata for the received message: | Name | Type | Required | Description | | --- | --- | --- | --- | | `email_id` | string | No | The received-email id. Pass it to `GET /emails/receiving/:id` to fetch the body/headers, or to `GET /emails/receiving/:id/attachments` for files. | | `created_at` | string | No | ISO 8601 timestamp (with timezone offset) for when the message was received and stored. | | `from` | string | No | The envelope/header `From` address of the inbound message. | | `from_name` | string | null | No | The display name from the `From` header, decoded; `null` when the header carried only an address. | | `to` | string[] | No | The `To` recipients the message was addressed to. Route or filter on this to decide how to handle the mail. | | `cc` | string[] | No | The `Cc` recipients, if any (empty array when none). | | `bcc` | string[] | No | The `Bcc` recipients exposed to SendDart, if any (empty array when none). | | `received_for` | string[] | No | The address(es) the message was actually delivered for at the SMTP envelope level — useful when the mail was forwarded or aliased and the visible `to` differs from the delivery target. | | `message_id` | string | No | The original `Message-ID` header (angle-bracketed, e.g. `<111-222-333@email.example.com>`). Use it as `In-Reply-To` to [reply in thread](https://www.senddart.com/docs/receiving/reply-to-emails). | | `subject` | string | No | The decoded `Subject` header. | | `attachments` | object[] | No | Attachment **metadata** only (id, filename, content_type, content_disposition, content_id) — not the bytes. See [attachment fields](https://www.senddart.com/docs/receiving/attachments). | ## What you can do with a received email - [Get the email content](https://www.senddart.com/docs/receiving/get-email-content) — HTML, plain text, and headers. - [Process attachments](https://www.senddart.com/docs/receiving/attachments) — download and inspect attached files. - [Forward the email](https://www.senddart.com/docs/receiving/forward-emails) to another address. - [Reply in the same thread](https://www.senddart.com/docs/receiving/reply-to-emails) using the original `message_id`. ## FAQ ### Will I receive mail for any address at my domain? Yes. Once the MX record is in place for your [custom domain](https://www.senddart.com/docs/receiving/custom-domains), SendDart receives mail for *any* address at that domain — `@yourdomain.tld`. Filter or route on the `to` field of the event. ### Can I receive on a subdomain? Yes. Add the MX record to any subdomain (e.g. `subdomain.yourdomain.tld`) and receive mail there. ### Will I lose mail if my webhook endpoint is down? No. SendDart stores every inbound message as soon as it arrives, so you can always retrieve it from the dashboard or via the [Receiving API](https://www.senddart.com/docs/receiving/get-email-content) even if your endpoint was unavailable. Failed webhook deliveries are retried, and you can replay individual events from the [Webhooks](https://www.senddart.com/docs/webhooks/overview) page. ### How do I confirm a webhook really came from SendDart? Every webhook is signed. Verify the signature headers before trusting the payload — see [Verify webhook requests](https://www.senddart.com/docs/webhooks/verify). --- # Custom receiving domains > Receive inbound email on your own domain by adding an MX record and subscribing a webhook to email.received. You receive email on your own domain, such as `yourdomain.tld`. Receiving takes one extra DNS record — an `MX` record — on top of the verification you already do for sending. ## 1. Add the MX record First, [verify your domain](https://www.senddart.com/docs/domains/managing) for sending if you have not already. Receiving then requires an additional `MX` record so mail for the domain is routed to SendDart: 1. **Open Domains** — Go to the Domains page in the dashboard and open the domain you want to receive on. 2. **Copy the MX record** — In the receiving section, copy the `MX` record SendDart shows you (host and priority). 3. **Add it at your DNS provider** — Paste the `MX` record into your DNS provider and save. > **Warning:** Configure receiving on a dedicated subdomain if your root domain already serves existing mailboxes. MX preference controls the order of delivery attempts; it does not duplicate mail across providers. Use the receiving records shown in SendDart, and plan any root-domain migration with your email administrator. If your existing provider supports forwarding, configure a verified recipient address at the destination rather than treating an MX server hostname as a mailbox. ## 2. Configure a webhook Create a webhook endpoint subscribed to the `email.received` event, exactly as for a managed domain: 1. **Open Webhooks** — Go to the Webhooks page in the dashboard. 2. **Add a webhook** — Click "Add Webhook" and enter your endpoint URL. 3. **Subscribe to email.received** — Select the `email.received` event type and save. ## 3. Receive email events Create a route that accepts `POST` requests and handles the `email.received` event: **Node.js** ```js // app/api/events/route.ts import type { NextRequest } from 'next/server'; import { NextResponse } from 'next/server'; export const POST = async (request: NextRequest) => { const event = await request.json(); if (event.type === 'email.received') { return NextResponse.json(event); } return NextResponse.json({}); }; ``` **Python** ```python from flask import Flask, request, jsonify app = Flask(__name__) @app.post("/api/events") def events(): event = request.get_json() if event.get("type") == "email.received": return jsonify(event) return jsonify({}) ``` After receiving the event you can fetch the message body and attachments. We recommend [verifying the webhook signature](https://www.senddart.com/docs/webhooks/verify) to secure your endpoint. The `email.received` payload shape is identical to a managed domain: ```json { "type": "email.received", "created_at": "2026-02-22T23:41:12.126Z", "data": { "email_id": "56761188-7520-42d8-8898-ff6fc54ce618", "created_at": "2026-02-22T23:41:11.894719+00:00", "from": "onboarding@test.senddart.com", "to": ["delivered@test.senddart.com"], "bcc": [], "cc": [], "received_for": ["forwarded@example.com"], "message_id": "<111-222-333@email.example.com>", "subject": "Sending this example", "attachments": [ { "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318", "filename": "avatar.png", "content_type": "image/png", "content_disposition": "inline", "content_id": "img001" } ] } } ``` ## Enabling receiving for an existing domain If you already have a verified domain, enable receiving with the toggle in the receiving section of the domain detail page. A modal then shows the `MX` record to add at your DNS provider. After you add it, click "I've added the record" and wait for the receiving record to show as **verified**. > **Note:** You do **not** need to re-verify a domain you already verified for sending. Enabling receiving only verifies the **new** `MX` record — the rest of your domain configuration stays as-is. ## FAQ ### What if I already have MX records for my domain? A receiving domain needs a deliberate routing setup. Lower-numbered MX preferences are tried first, and eligible alternatives can be used after a failure. Unrelated mailbox providers at different priorities are not independent copies of the same inbox. Use a dedicated receiving subdomain or coordinate a complete migration; see [MX conflicts](https://www.senddart.com/docs/kb/mx-conflicts) before changing existing records. ### Do I need to verify the domain again for receiving? No. A domain already verified for sending only needs receiving enabled and the new `MX` record added — SendDart verifies that one record. --- # Get email content > Fetch the HTML body, plain text, and headers of a received email with the Receiving API. A received email holds the **HTML** body, the **plain-text** body, and the message **headers**. Because the webhook carries only metadata, you fetch this content from the [Receiving API](https://www.senddart.com/docs/receiving/get-email-content) using the `email_id` from the event. > **Warning:** Webhooks do not include the body, headers, or attachment content — only metadata. Call [Retrieve received email](https://www.senddart.com/docs/receiving/get-email-content) for the body and headers, or the [Attachments API](https://www.senddart.com/docs/receiving/attachments) for attachment content. This keeps payloads small for serverless platforms with limited request-body sizes. ## Fetch the content After the `email.received` webhook arrives, issue a `GET /emails/receiving/:id` with the `email_id` to read `html`, `text`, and `headers`: **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.receiving.get('56761188-7520-42d8-8898-ff6fc54ce618'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails::Receiving.get("56761188-7520-42d8-8898-ff6fc54ce618") ``` **PHP** ```php emails->receiving->get('56761188-7520-42d8-8898-ff6fc54ce618'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.Receiving.get("56761188-7520-42d8-8898-ff6fc54ce618") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") received, err := client.Emails.Receiving.Get("56761188-7520-42d8-8898-ff6fc54ce618") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _received = mb.emails.receiving.get("56761188-7520-42d8-8898-ff6fc54ce618").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().receiving().get("56761188-7520-42d8-8898-ff6fc54ce618"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ReceivedEmailRetrieveAsync("56761188-7520-42d8-8898-ff6fc54ce618"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/emails/receiving/56761188-7520-42d8-8898-ff6fc54ce618' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails receiving get 56761188-7520-42d8-8898-ff6fc54ce618 ``` ## Response The response is the received-email object, including the parsed `html`, `text`, and `headers`. See [Retrieve received email](https://www.senddart.com/docs/receiving/get-email-content) for the full field reference. ```json { "object": "received_email", "id": "56761188-7520-42d8-8898-ff6fc54ce618", "from": "onboarding@test.senddart.com", "to": ["delivered@test.senddart.com"], "subject": "Sending this example", "message_id": "<111-222-333@email.example.com>", "html": "

Hello there!

", "text": "Hello there!", "headers": { "From": "onboarding@test.senddart.com", "To": "delivered@test.senddart.com", "Subject": "Sending this example", "Message-ID": "<111-222-333@email.example.com>" }, "read": false, "read_at": null, "created_at": "2026-02-22T23:41:11.894Z" } ``` > **Note:** Fetching content does not mark the message read — `read` stays `false` until it is opened in the dashboard Inbox or set with [PATCH /emails/receiving/:id](https://www.senddart.com/docs/api/emails-received-update). > **Note:** Need the exact bytes that arrived — for example to re-parse MIME or extract inline images? Use the raw download URL exposed on the received email (see [Forward emails](https://www.senddart.com/docs/receiving/forward-emails)) rather than the parsed `html`/`text`. --- # Process receiving attachments > List a received email’s attachments and download each one from its download_url. A common reason to receive email is to process **attachments** — airplane tickets, receipts, expenses, and so on. You can inspect attachments in the dashboard, or process them programmatically with the [Attachments API](https://www.senddart.com/docs/receiving/attachments). ## View and download in the dashboard 1. **Open Emails → Receiving** — Go to Emails and select the "Receiving" tab. 2. **Open the message** — Open the received email that includes the attachment. 3. **Download** — Click the attachment to download it locally. For automated processing, use the Attachments API instead. ## Process attachments programmatically > **Warning:** Webhooks include attachment **metadata** only — not the content. Call the [List attachments](https://www.senddart.com/docs/receiving/attachments) API to get each attachment's `download_url`, which points at the actual bytes. This keeps webhook payloads small for serverless platforms with limited request-body sizes. After the `email.received` webhook, call the Attachments API for the `email_id`. It returns a `data` array of attachments, each with metadata and a `download_url` you fetch to get the bytes. To retrieve a single attachment, use [Retrieve attachment](https://www.senddart.com/docs/receiving/attachments). > **Note:** A `download_url` is **not** a public link: fetch it with the same `Authorization: Bearer` header as every other API call. It does not expire. Attachments whose bytes were not stored have `downloadable: false` and no `download_url` — skip those rather than retrying them. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.receiving.listAttachments('56761188-7520-42d8-8898-ff6fc54ce618'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails::Receiving.list_attachments("56761188-7520-42d8-8898-ff6fc54ce618") ``` **PHP** ```php emails->receiving->listAttachments('56761188-7520-42d8-8898-ff6fc54ce618'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.Receiving.list_attachments("56761188-7520-42d8-8898-ff6fc54ce618") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") attachments, err := client.Emails.Receiving.ListAttachments("56761188-7520-42d8-8898-ff6fc54ce618", nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _attachments = mb.emails.receiving.list_attachments("56761188-7520-42d8-8898-ff6fc54ce618", None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().receiving().listAttachments("56761188-7520-42d8-8898-ff6fc54ce618"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ReceivedEmailListAttachmentsAsync("56761188-7520-42d8-8898-ff6fc54ce618"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/emails/receiving/56761188-7520-42d8-8898-ff6fc54ce618/attachments' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails receiving attachments 56761188-7520-42d8-8898-ff6fc54ce618 ``` ## Attachment fields | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | No | The attachment id, unique within the received email. | | `filename` | string | No | The attachment file name (e.g. `invoice.pdf`). | | `content_type` | string | No | MIME type of the attachment (e.g. `image/png`). | | `content_disposition` | string | No | `attachment` or `inline` (inline parts are typically embedded images). | | `content_id` | string | No | The MIME `Content-ID` for an inline part, used to reference it from the HTML body. | | `downloadable` | boolean | No | Whether the file bytes were stored and can be downloaded. `false` means no `download_url` is returned. | | `download_url` | string | No | URL to download the raw bytes. Requires your API key — send the same `Authorization: Bearer` header. Omitted when `downloadable` is `false`. | Once you have processed the attachments, you may want to [forward the email](https://www.senddart.com/docs/receiving/forward-emails) to another address. --- # Forward received emails > Forward an inbound email to another address — either with the built-in forward endpoint, or by downloading the raw message, parsing it, and re-sending via POST /emails. Received emails can be **forwarded** on to another address. There are two approaches: the built-in **forward endpoint**, which re-sends the stored parsed message body **with the original attachments** (inline images preserved) in one call, or a **manual re-send**, where you download and parse the raw message yourself for full RFC 5322 fidelity. > **Warning:** Webhooks include metadata only — not the body, headers, or attachment content. Retrieve the message with the [Receiving API](https://www.senddart.com/docs/receiving/get-email-content) (and the [Attachments API](https://www.senddart.com/docs/receiving/attachments) for files) before forwarding. ## Forward endpoint The quickest way to forward is [`POST /emails/receiving/:id/forward`](https://www.senddart.com/docs/api/emails-received-forward). It re-sends the received email's stored parsed `subject`, `html`, and `text` — along with the original attachments — as a new outbound email. Pass `from` (required) and the recipient(s); the original subject, body, and files are reused. **Body** | Name | Type | Required | Description | | --- | --- | --- | --- | | `from` | string | No | Required. The sender address for the forwarded message. Must be an address on a [verified sending domain](https://www.senddart.com/docs/domains/managing). | | `to` | string | string[] | No | The recipient address(es) to forward to. | | `subject` | string | No | Optional. Overrides the original subject on the forwarded message. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.receiving.forward('56761188-7520-42d8-8898-ff6fc54ce618', { "from": "Acme ", "to": ["delivered@test.senddart.com"] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails::Receiving.forward("56761188-7520-42d8-8898-ff6fc54ce618", { "from": "Acme ", "to": [ "delivered@test.senddart.com" ] }) ``` **PHP** ```php emails->receiving->forward('56761188-7520-42d8-8898-ff6fc54ce618', [ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.Receiving.forward("56761188-7520-42d8-8898-ff6fc54ce618", { "from": "Acme ", "to": [ "delivered@test.senddart.com" ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") forwarded, err := client.Emails.Receiving.Forward("56761188-7520-42d8-8898-ff6fc54ce618", &senddart.ForwardReceivedEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, }) ``` **Rust** ```rust use senddart::{ForwardReceivedEmailOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = ForwardReceivedEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], ); let _forwarded = mb.emails.receiving.forward("56761188-7520-42d8-8898-ff6fc54ce618", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.ForwardEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); ForwardEmailRequest request = ForwardEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .build(); SendDartResponse response = senddart.emails().receiving().forward( "56761188-7520-42d8-8898-ff6fc54ce618", request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ReceivedEmailForwardAsync("56761188-7520-42d8-8898-ff6fc54ce618", new ReceivedEmailForwardOptions { From = "Acme ", To = "delivered@test.senddart.com", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails/receiving/56761188-7520-42d8-8898-ff6fc54ce618/forward' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"] }' ``` **CLI** ```bash senddart emails receiving forward 56761188-7520-42d8-8898-ff6fc54ce618 \ --from 'Acme ' \ --to 'delivered@test.senddart.com' ``` > **Note:** The forward endpoint re-sends the parsed subject and body **and** re-attaches the original attachments — inline images are preserved via their `content_id`, so embedded images still render. Attachments are best-effort: any whose stored bytes can't be loaded are skipped, and the same per-attachment / total size caps as a normal send apply. For full RFC 5322 fidelity (exact original MIME, custom headers), use the manual re-send below instead. ## Forward by re-sending The most faithful way to forward is to download the **raw** RFC 5322 message and parse it, so you correctly extract the HTML/text bodies and every attachment — especially inline images referenced by `Content-ID`. Then re-send the extracted content with [POST /emails](https://www.senddart.com/docs/api/emails-send). The retrieved received email exposes a `raw.download_url` you can fetch to get the original bytes — it is an authenticated endpoint, so send your `Authorization: Bearer` header with that request too. Strip the angle brackets from each inline part's `content_id` so the forwarded HTML still resolves its embedded images. **Node.js** ```js // app/api/events/route.ts import type { NextRequest } from 'next/server'; import { NextResponse } from 'next/server'; import { simpleParser } from 'mailparser'; const API_KEY = 'mb_xxxxxxxxx'; export const POST = async (request: NextRequest) => { const event = await request.json(); if (event.type === 'email.received') { // 1. Get the received email (includes raw.download_url) const metaRes = await fetch( `https://www.senddart.com/api/emails/receiving/${event.data.email_id}`, { headers: { Authorization: `Bearer ${API_KEY}` } }, ); const email = await metaRes.json(); if (!email?.raw?.download_url) { return new NextResponse('Raw email not available', { status: 500 }); } // 2. Download and parse the raw RFC 5322 message const rawResponse = await fetch(email.raw.download_url, { headers: { Authorization: `Bearer ${API_KEY}` }, }); const rawEmailContent = await rawResponse.text(); const parsed = await simpleParser(rawEmailContent, { skipImageLinks: true }); // 3. Re-build attachments, keeping inline content_ids const attachments = parsed.attachments.map((attachment) => { const contentId = attachment.contentId ? attachment.contentId.replace(/^<|>$/g, '') : undefined; return { filename: attachment.filename, content: attachment.content.toString('base64'), content_type: attachment.contentType, content_id: contentId || undefined, }; }); // 4. Forward by sending a new email const sendRes = await fetch('https://www.senddart.com/api/emails', { method: 'POST', headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: email.subject || '(no subject)', html: parsed.html || undefined, text: parsed.text || undefined, attachments: attachments.length > 0 ? attachments : undefined, }), }); return NextResponse.json(await sendRes.json()); } return NextResponse.json({}); }; ``` **Python** ```python import base64, email as email_lib, requests from email import policy from flask import Flask, request, jsonify app = Flask(__name__) API_KEY = "mb_xxxxxxxxx" @app.post("/api/events") def events(): event = request.get_json() if event.get("type") != "email.received": return jsonify({}) # 1. Get the received email (includes raw.download_url) meta = requests.get( f"https://www.senddart.com/api/emails/receiving/{event['data']['email_id']}", headers={"Authorization": f"Bearer {API_KEY}"}, ).json() raw = (meta.get("raw") or {}).get("download_url") if not raw: return "Raw email not available", 500 # 2. Download and parse the raw RFC 5322 message raw_bytes = requests.get(raw, headers={"Authorization": f"Bearer {API_KEY}"}).content parsed = email_lib.message_from_bytes(raw_bytes, policy=policy.default) html = parsed.get_body(("html",)) text = parsed.get_body(("plain",)) attachments = [] for part in parsed.iter_attachments(): cid = part.get("Content-ID") attachments.append({ "filename": part.get_filename(), "content": base64.b64encode(part.get_content()).decode(), "content_type": part.get_content_type(), "content_id": cid.strip("<>") if cid else None, }) # 3. Forward by sending a new email sent = requests.post( "https://www.senddart.com/api/emails", headers={"Authorization": f"Bearer {API_KEY}"}, json={ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": meta.get("subject") or "(no subject)", "html": html.get_content() if html else None, "text": text.get_content() if text else None, "attachments": attachments or None, }, ) return jsonify(sent.json()) ``` > **Note:** The Node.js example uses [`mailparser`](https://www.npmjs.com/package/mailparser) (`npm install mailparser`). In any language, use an [RFC 5322](https://datatracker.ietf.org/doc/html/rfc5322)-capable parser — the example above uses Python's built-in `email` package. ## Forward style: passthrough vs. wrapped Re-sending the parsed `html`/`text` and attachments reproduces the original message as it arrived — a clean **passthrough** forward. If you instead want a "forwarded message" footer like an email client, send your own intro `html`/`text` and append the original content (and a quoted header block) beneath it: ```js const footer = `

See attached forwarded message.


---------- Forwarded message ----------
From: ${email.from}
Subject: ${email.subject}

`; await fetch('https://www.senddart.com/api/emails', { method: 'POST', headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: `Fwd: ${email.subject || '(no subject)'}`, html: footer + (parsed.html || ''), attachments: attachments.length > 0 ? attachments : undefined, }), }); ``` > **Warning:** The forwarding `from` must be an address on a [verified sending domain](https://www.senddart.com/docs/domains/managing) — it is a brand-new outbound send via `POST /emails`, not a relay of the original envelope. --- # Reply to received emails > Reply in-thread by setting In-Reply-To (and References) to the received message_id when sending via POST /emails. Email clients **thread** messages using the `Message-ID` header. To reply to a received email so it lands in the same conversation, send a new email via [POST /emails](https://www.senddart.com/docs/api/emails-send) with an `In-Reply-To` header set to the original message's `message_id`. Start the subject with `Re:` so clients group the replies together. ## The quick way: the reply endpoint You usually don't need to manage threading headers yourself. [`POST /emails/receiving/:id/reply`](https://www.senddart.com/docs/api/receiving-reply) does all of it in one call: it derives the recipient from the received email's `Reply-To` (falling back to `From`), sets `In-Reply-To`/`References` to the received `message_id`, and defaults the subject to `Re: …`. Pass a verified `from` and the reply `html`/`text`. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.receiving.reply('56761188-7520-42d8-8898-ff6fc54ce618', { "from": "Acme ", "html": "

Thanks for your email!

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails::Receiving.reply("56761188-7520-42d8-8898-ff6fc54ce618", { "from": "Acme ", "html": "

Thanks for your email!

" }) ``` **PHP** ```php emails->receiving->reply('56761188-7520-42d8-8898-ff6fc54ce618', [ 'from' => "Acme ", 'html' => "

Thanks for your email!

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.Receiving.reply("56761188-7520-42d8-8898-ff6fc54ce618", { "from": "Acme ", "html": "

Thanks for your email!

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") replied, err := client.Emails.Receiving.Reply("56761188-7520-42d8-8898-ff6fc54ce618", &senddart.ReplyReceivedEmailRequest{ From: "Acme ", Html: "

Thanks for your email!

", }) ``` **Rust** ```rust use senddart::{ReplyReceivedEmailOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = ReplyReceivedEmailOptions::new("Acme ") .with_html("

Thanks for your email!

"); let _replied = mb.emails.receiving.reply("56761188-7520-42d8-8898-ff6fc54ce618", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.ReplyEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); ReplyEmailRequest request = ReplyEmailRequest.builder() .from("Acme ") .html("

Thanks for your email!

") .build(); SendDartResponse response = senddart.emails().receiving().reply( "56761188-7520-42d8-8898-ff6fc54ce618", request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ReceivedEmailReplyAsync("56761188-7520-42d8-8898-ff6fc54ce618", new ReceivedEmailReplyOptions { From = "Acme ", HtmlBody = "

Thanks for your email!

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails/receiving/56761188-7520-42d8-8898-ff6fc54ce618/reply' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "html": "

Thanks for your email!

" }' ``` **CLI** ```bash senddart emails receiving reply 56761188-7520-42d8-8898-ff6fc54ce618 \ --from 'Acme ' \ --html '

Thanks for your email!

' ``` The rest of this guide covers the **manual** approach — replying via [POST /emails](https://www.senddart.com/docs/api/emails-send) with explicit threading headers — for when you need full control over the recipient, headers, or thread structure. ## Get the message ID The `message_id` is included in the [email.received](https://www.senddart.com/docs/receiving/introduction) webhook payload: ```json { "type": "email.received", "data": { "email_id": "56761188-7520-42d8-8898-ff6fc54ce618", "message_id": "<111-222-333@email.example.com>", "subject": "Sending this example", "from": "Acme ", "to": ["delivered@test.senddart.com"] } } ``` Use `event.data.message_id` as the `In-Reply-To` header value when sending your reply. ## Send a reply in thread Set the `In-Reply-To` header to the received `message_id` and prefix the subject with `Re:`. See [Custom headers](https://www.senddart.com/docs/emails/headers) for how SendDart writes custom MIME headers. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Re: Sending this example", "html": "

Thanks for your email!

", "headers": { "In-Reply-To": "<111-222-333@email.example.com>" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Re: Sending this example", "html": "

Thanks for your email!

", "headers": { "In-Reply-To": "<111-222-333@email.example.com>" } }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Re: Sending this example", 'html' => "

Thanks for your email!

", 'headers' => [ 'In-Reply-To' => "<111-222-333@email.example.com>" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Re: Sending this example", "html": "

Thanks for your email!

", "headers": { "In-Reply-To": "<111-222-333@email.example.com>" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Re: Sending this example", Html: "

Thanks for your email!

", Headers: map[string]string{"In-Reply-To": "<111-222-333@email.example.com>"}, }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Re: Sending this example", ) .with_html("

Thanks for your email!

") .with_header("In-Reply-To", "<111-222-333@email.example.com>"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Re: Sending this example") .html("

Thanks for your email!

") .header("In-Reply-To", "<111-222-333@email.example.com>") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Re: Sending this example", HtmlBody = "

Thanks for your email!

", Headers = new Dictionary { ["In-Reply-To"] = "<111-222-333@email.example.com>", }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Re: Sending this example", "html": "

Thanks for your email!

", "headers": { "In-Reply-To": "<111-222-333@email.example.com>" } }' ``` **CLI** ```bash senddart emails send \ --from 'Acme ' \ --to 'delivered@test.senddart.com' \ --subject 'Re: Sending this example' \ --html '

Thanks for your email!

' \ --headers '{"In-Reply-To":"<111-222-333@email.example.com>"}' ``` ## Reply headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `In-Reply-To` | string | Yes | The `message_id` of the message you are replying to (e.g. `<111-222-333@email.example.com>`). | | `References` | string | No | Space-separated list of every prior `message_id` in the thread, ending with the one you are replying to. Used for deep threading across multiple replies. | ## Replying multiple times in a thread When you reply more than once in the same conversation, also set the `References` header to all previous `message_id`s separated by spaces, ending with the current one. This helps clients keep the thread structure correct. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Re: Sending this example", "html": "

Thanks for your email!

", "headers": { "In-Reply-To": "<111-222-333@email.example.com>", "References": " <111-222-333@email.example.com>" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Re: Sending this example", "html": "

Thanks for your email!

", "headers": { "In-Reply-To": "<111-222-333@email.example.com>", "References": " <111-222-333@email.example.com>" } }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Re: Sending this example", 'html' => "

Thanks for your email!

", 'headers' => [ 'In-Reply-To' => "<111-222-333@email.example.com>", 'References' => " <111-222-333@email.example.com>" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Re: Sending this example", "html": "

Thanks for your email!

", "headers": { "In-Reply-To": "<111-222-333@email.example.com>", "References": " <111-222-333@email.example.com>" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Re: Sending this example", Html: "

Thanks for your email!

", Headers: map[string]string{ "In-Reply-To": "<111-222-333@email.example.com>", "References": " <111-222-333@email.example.com>", }, }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Re: Sending this example", ) .with_html("

Thanks for your email!

") .with_header("In-Reply-To", "<111-222-333@email.example.com>") .with_header("References", " <111-222-333@email.example.com>"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Re: Sending this example") .html("

Thanks for your email!

") .header("In-Reply-To", "<111-222-333@email.example.com>") .header("References", " <111-222-333@email.example.com>") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Re: Sending this example", HtmlBody = "

Thanks for your email!

", Headers = new Dictionary { ["In-Reply-To"] = "<111-222-333@email.example.com>", ["References"] = " <111-222-333@email.example.com>", }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Re: Sending this example", "html": "

Thanks for your email!

", "headers": { "In-Reply-To": "<111-222-333@email.example.com>", "References": " <111-222-333@email.example.com>" } }' ``` **CLI** ```bash senddart emails send \ --from 'Acme ' \ --to 'delivered@test.senddart.com' \ --subject 'Re: Sending this example' \ --html '

Thanks for your email!

' \ --headers '{"In-Reply-To":"<111-222-333@email.example.com>","References":" <111-222-333@email.example.com>"}' ``` > **Note:** The reply's `from` must be on a [verified sending domain](https://www.senddart.com/docs/domains/managing). The reply is an ordinary outbound send via `POST /emails`; the `In-Reply-To` / `References` headers are what place it in the existing thread. --- # Managing campaigns > Compose a marketing email against a sending domain, preview merge tags, then send it now or schedule it for later — with a per-contact unsubscribe and budget-capped async delivery. A **campaign** is a single marketing email sent to every subscribed contact on one of your sending **domains** — the domain’s [contact pool](https://www.senddart.com/docs/audiences/overview). You compose it once — `from`, `subject`, and an HTML and/or text body — and SendDart fans it out, personalizing each copy with merge tags and appending a per-contact unsubscribe. Campaigns are owner-scoped and created as a **draft**. A draft can be edited freely; once you send or schedule it, the body is locked and delivery proceeds asynchronously. ## The campaign object A campaign is returned in this shape: ```json { "object": "campaign", "id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", "name": "June newsletter", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "segment_id": null, "topic_id": null, "from": "Acme ", "subject": "What's new in June", "html": "

Hi {{FIRST_NAME}}, here's the latest…

", "text": "Hi {{FIRST_NAME}}, here's the latest…", "reply_to": null, "preview_text": null, "status": "draft", "scheduled_at": null, "sent_at": null, "created_at": "2026-06-23T10:00:00.000Z", "ab_test": { "enabled": false }, "recurrence": null, "parent_campaign_id": null } ``` ## Compose against a domain Create a draft with [`POST /campaigns`](https://www.senddart.com/docs/api/campaigns-create). The `domain` picks the recipients — the campaign fans out to that domain’s contact pool — and the `from` address must be on a **verified domain** you own (it does not have to match `domain`). Provide `html`, `text`, or both. For a manual batch, send POST /campaigns/:id/send with {"recipient_limit":5000}. This selects up to 5,000 eligible unsent contacts and stops after that batch. Once completed, call the same endpoint with another recipient_limit, or use Send next batch in campaign details. Previous attempts are excluded even after delivery-log retention. GET /campaigns/:id/batches shows remaining recipients and batch progress. Manual batches support one-time campaigns without A/B testing. Email quotas and credits still apply; this is separate from daily_batch_size, which automatically continues delivery on later days. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.create({ "domain": "yourdomain.com", "from": "Acme ", "subject": "What's new in June", "html": "

Hi {{FIRST_NAME}}, here's the latest…

", "name": "June newsletter" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.create({ "domain": "yourdomain.com", "from": "Acme ", "subject": "What's new in June", "html": "

Hi {{FIRST_NAME}}, here's the latest…

", "name": "June newsletter" }) ``` **PHP** ```php campaigns->create([ 'domain' => "yourdomain.com", 'from' => "Acme ", 'subject' => "What's new in June", 'html' => "

Hi {{FIRST_NAME}}, here's the latest…

", 'name' => "June newsletter" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.create({ "domain": "yourdomain.com", "from": "Acme ", "subject": "What's new in June", "html": "

Hi {{FIRST_NAME}}, here's the latest…

", "name": "June newsletter" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") campaign, err := client.Campaigns.Create(&senddart.CreateCampaignRequest{ Domain: "yourdomain.com", From: "Acme ", Subject: "What's new in June", Html: "

Hi {{FIRST_NAME}}, here's the latest…

", Name: "June newsletter", }) ``` **Rust** ```rust use senddart::{CreateCampaignOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateCampaignOptions::new( "yourdomain.com", "Acme ", "What's new in June", ) .with_html("

Hi {{FIRST_NAME}}, here's the latest…

") .with_name("June newsletter"); let _campaign = mb.campaigns.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateCampaignRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateCampaignRequest request = CreateCampaignRequest.builder() .domain("yourdomain.com") .from("Acme ") .subject("What's new in June") .html("

Hi {{FIRST_NAME}}, here's the latest…

") .name("June newsletter") .build(); SendDartResponse response = senddart.campaigns().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignCreateAsync(new CampaignCreateOptions { Domain = "yourdomain.com", From = "Acme ", Subject = "What's new in June", HtmlBody = "

Hi {{FIRST_NAME}}, here's the latest…

", Name = "June newsletter", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/campaigns' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "domain": "yourdomain.com", "from": "Acme ", "subject": "What'\''s new in June", "html": "

Hi {{FIRST_NAME}}, here'\''s the latest…

", "name": "June newsletter" }' ``` **CLI** ```bash senddart campaigns create \ --domain 'yourdomain.com' \ --from 'Acme ' \ --subject 'What'\''s new in June' \ --html '

Hi {{FIRST_NAME}}, here'\''s the latest…

' \ --name 'June newsletter' ``` ## Merge tags Before each copy is sent, SendDart substitutes the following tags for that contact. Unknown or missing fields render as an empty string — substitution never fails. | Tag | Replaced with | | --- | --- | | `{{FIRST_NAME}}` | The contact's first name (empty if unset). | | `{{LAST_NAME}}` | The contact's last name (empty if unset). | | `{{EMAIL}}` | The contact's email address. | | `{{{SENDDART_UNSUBSCRIBE_URL}}}` | This contact's unique one-click unsubscribe URL. Use the triple-brace form so the URL is inserted raw. | > **Note:** Whitespace inside the braces is tolerated — `{{ FIRST_NAME }}` works the same as `{{FIRST_NAME}}`. ## Unsubscribe is automatic Every campaign copy gets a **per-contact unsubscribe footer** and an [RFC 8058](https://www.rfc-editor.org/rfc/rfc8058) `List-Unsubscribe` header injected automatically, so recipients can always opt out (and inbox providers can offer one-click unsubscribe). Unsubscribing flips the contact to `unsubscribed` in that audience, and they are skipped on future campaigns. You can also place the unsubscribe link inline by including `{{{SENDDART_UNSUBSCRIBE_URL}}}` in your body — the automatic footer is added regardless. ## Send or schedule When the draft is ready, call [`POST /campaigns/:id/send`](https://www.senddart.com/docs/api/campaigns-send). With no body the campaign sends as soon as possible (status → `queued`). Pass `scheduled_at` with a future ISO timestamp to schedule it (status → `scheduled`). **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.send('CAMPAIGN_ID', { "scheduled_at": "2026-07-01T09:00:00Z" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.send("CAMPAIGN_ID", { "scheduled_at": "2026-07-01T09:00:00Z" }) ``` **PHP** ```php campaigns->send('CAMPAIGN_ID', [ 'scheduled_at' => "2026-07-01T09:00:00Z" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.send("CAMPAIGN_ID", { "scheduled_at": "2026-07-01T09:00:00Z" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Campaigns.Send("CAMPAIGN_ID", &senddart.SendCampaignRequest{ ScheduledAt: "2026-07-01T09:00:00Z", }) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _sent = mb.campaigns.send("CAMPAIGN_ID", Some("2026-07-01T09:00:00Z")).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.campaigns().send( "CAMPAIGN_ID", "2026-07-01T09:00:00Z"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignSendAsync("CAMPAIGN_ID", "2026-07-01T09:00:00Z"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/campaigns/CAMPAIGN_ID/send' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "scheduled_at": "2026-07-01T09:00:00Z" }' ``` **CLI** ```bash senddart campaigns send CAMPAIGN_ID \ --scheduled-at '2026-07-01T09:00:00Z' ``` > **Warning:** Sending checks the campaign has a `from`, `subject`, and a body, and that the from-domain is verified. A draft is the only state you can send — once `queued`, `scheduled`, or `sent`, the send endpoint returns a `validation_error`. ## Cancel or stop a campaign Changed your mind before a scheduled send fires? Call [`POST /campaigns/:id/cancel`](https://www.senddart.com/docs/api/campaigns-cancel). This cancels the pending delivery and returns the campaign to `draft`, so you can edit it and send or schedule it again. A reputation-`paused` campaign can also be returned to draft; already-sent recipients remain in its deduplication ledger. The same endpoint **stops** a campaign that is already `queued`. Copies already handed to the delivery provider cannot be recalled, but all remaining work is cancelled — for a staggered campaign (`daily_batch_size`) that means every future batch-day. A stopped campaign becomes `canceled` rather than `draft`, because it is partly mailed and a draft would be re-sendable; already-sent recipients stay in its deduplication ledger. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.cancel('CAMPAIGN_ID'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.cancel("CAMPAIGN_ID") ``` **PHP** ```php campaigns->cancel('CAMPAIGN_ID'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.cancel("CAMPAIGN_ID") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") campaign, err := client.Campaigns.Cancel("CAMPAIGN_ID") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _campaign = mb.campaigns.cancel("CAMPAIGN_ID").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.campaigns().cancel("CAMPAIGN_ID"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignCancelAsync("CAMPAIGN_ID"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/campaigns/CAMPAIGN_ID/cancel' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart campaigns cancel CAMPAIGN_ID ``` ## Async, budget-capped delivery Delivery is handled by a background fan-out job — the send call returns immediately. Each recipient is sent as an individual email. The complete campaign must fit inside the remaining monthly plan allowance plus prepaid credits before it is accepted; a 10,000-recipient campaign with only 500 sends available is rejected before sending any recipient. A **staggered** campaign (one with `daily_batch_size`) is budgeted one batch-day at a time instead, so it is accepted as long as the next day’s batch fits and it waits for the rolling window to refill when it does not. Daily and reputation warm-up capacity are pacing limits instead: eligible recipients are sent in safe batches and the untouched remainder resumes at the next rolling-window reset. Suppressed and unsubscribed contacts are skipped. ## Statuses The API reports a campaign in one of the following states. | Status | Meaning | | --- | --- | | `draft` | Created but not sent. Editable; the only state from which you can send. | | `scheduled` | A future `scheduled_at` was set. Will start sending at that time. Canceling a scheduled campaign returns it to `draft` and prevents the send. | | `recurring` | The campaign has a `recurrence` and acts as a template: each occurrence is sent as its own child campaign while the template stays in this status. Canceling it stops the recurrence and returns the template to `draft`. | | `paused` | Reputation protection stopped the remaining fan-out. Contact support for review; an admin reinstatement resumes only recipients that have not already been sent. | | `queued` | The send is in flight — the fan-out job is delivering copies to the audience. (Internally this is the `sending` phase; the API surfaces it as `queued`.) | | `canceled` | A `queued` send was stopped before it finished. Copies already handed off were still delivered; no further recipients are mailed. Terminal — a canceled campaign cannot be resumed or re-sent (unlike a canceled `scheduled` campaign, which returns to `draft`). | | `sent` | All copies have been handed off for delivery. | | `failed` | The campaign could not be delivered. | > **Note:** Campaigns in `draft`, `scheduled`, `recurring`, `sent`, `failed` or `canceled` status can be deleted. Deletion stops pending jobs and follow-ups while retaining sent emails and delivery events. Stop a queued or paused campaign before deleting it; running work must finish first. Individual copies already handed to the delivery provider cannot be recalled — but a `queued` campaign can be **stopped**, which cancels all remaining work (for a staggered campaign, every future batch-day) and moves it to `canceled`. --- # Performance tracking > Every campaign recipient is sent as an individual tracked email, so opens, clicks, bounces, and complaints surface per-contact in the dashboard and via webhooks. A campaign is not a single send — it fans out into **one tracked email per recipient**. Each of those emails is logged exactly like a transactional [`POST /emails`](https://www.senddart.com/docs/api/emails-send) send, with its own `id`, status, and event timeline. That means campaign performance reuses the same delivery, open, and click tracking as the rest of the platform — there is no separate analytics surface to learn. ## What is tracked - **Delivery** — `email.sent`, `email.delivered`, and `email.delivery_delayed` per recipient. - **Engagement** — `email.opened` and `email.clicked`, when open/click tracking is enabled on the sending domain. - **Negative signals** — `email.bounced` and `email.complained`, which also add the address to your account suppression list. - **Unsubscribes** — recipients who opt out via the per-campaign unsubscribe link, flipping that contact to `unsubscribed` in the audience. > **Note:** Open and click tracking is a per-domain setting. If a campaign shows deliveries but no opens, confirm tracking is enabled on the from-domain under Domains. ## Headline metrics Open a sent campaign in the dashboard to see its performance right away. The headline insights are: - **Emails delivered** — how many copies the receiving servers accepted. - **Open rate** — the share of delivered emails that were opened. - **Click rate** — the share of delivered emails with at least one tracked-link click. - **Replied**, **Bounced** and **Complained** — the raw counts behind those signals. > **Warning:** Open rates can be inaccurate. Some inbox providers pre-fetch or proxy the tracking pixel (e.g. Apple Mail Privacy Protection), inflating opens, while others block it entirely, suppressing them. Treat open rate as a directional signal, not an exact count. ## Reading results Each recipient email carries an event log you can read the same way as any other email: - In the **dashboard**, open the campaign to see per-recipient status and aggregate delivery, open, and click counts. - Via the **API**, retrieve an individual recipient email with [`GET /emails/:id`](https://www.senddart.com/docs/api/emails-get) to inspect its `last_event` and status. - Via **webhooks**, subscribe to the `email.*` events to stream delivery and engagement to your own systems in real time. See [Event types](https://www.senddart.com/docs/webhooks/events). ## Aggregate stats endpoint For a single rolled-up view, call `GET /campaigns/:id/stats`. It returns the campaign’s aggregate open and click counts (with the underlying delivered/sent totals, plus replies, bounces and complaints) and the top clicked links — the same numbers shown on the dashboard, fetched in one request. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.stats('CAMPAIGN_ID'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.stats("CAMPAIGN_ID") ``` **PHP** ```php campaigns->stats('CAMPAIGN_ID'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.stats("CAMPAIGN_ID") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") stats, err := client.Campaigns.Stats("CAMPAIGN_ID") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _stats = mb.campaigns.stats("CAMPAIGN_ID").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.campaigns().stats("CAMPAIGN_ID"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignRetrieveStatsAsync("CAMPAIGN_ID"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/campaigns/CAMPAIGN_ID/stats' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart campaigns stats CAMPAIGN_ID ``` It returns a `campaign_stats` object. The counts are `total` (one per recipient copy sent), `delivered`, `opened`, `clicked`, `replied`, `bounced` and `complained` — `opened`, `clicked` and `replied` are unique per recipient, not raw event counts. The `rates` object carries `delivery`, `open`, `click`, `reply`, `bounce` and `complaint` as percentages: `open`, `click` and `reply` are measured against `delivered` (falling back to `total` when no delivery events were recorded), while `delivery`, `bounce` and `complaint` are measured against `total`. Every rate is a percentage rounded to **one decimal place** (so `98.1`, not `98.06`). `links` lists the top clicked tracked links as `{ url, clicks }`, ordered by clicks descending, and is capped at the **50** most-clicked links. ```json { "object": "campaign_stats", "campaign_id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", "total": 1240, "delivered": 1216, "opened": 498, "clicked": 96, "replied": 12, "bounced": 18, "complained": 1, "rates": { "delivery": 98.1, "open": 41, "click": 7.9, "reply": 1, "bounce": 1.5, "complaint": 0.1 }, "links": [ { "url": "https://yourdomain.com/whats-new", "clicks": 74 }, { "url": "https://yourdomain.com/pricing", "clicks": 22 } ] } ``` The same fields (without `object`, `campaign_id` and `links`) are returned inline as the `statistics` field of [`GET /campaigns/:id`](https://www.senddart.com/docs/api/campaigns-get). Errors: `not_found` if the campaign does not exist or is not yours. Because bounces and complaints feed account-wide suppression, contacts that hard-bounce or complain are automatically excluded from subsequent campaigns — keeping your sender reputation healthy without manual list hygiene. --- # Automations > Automate emails with custom events. Automations allow you to **create email steps** based on custom events from your application. You can use automations for use cases like: - Welcome emails - Drip campaigns - Payment recovery - Abandoned cart - Trial expiration Automations support `{{{SENDDART_UNSUBSCRIBE_URL}}}` for compliance with non-transactional product and marketing messaging. ## How it works To start executing an automation, you need to: 1. **Create Automation** — Outline the sequence of steps to be executed. 2. **Add Trigger** — Define the [event name](https://www.senddart.com/docs/automations/trigger) that will trigger the automation. 3. **Define Steps** — Configure the [steps](https://www.senddart.com/docs/automations/steps) to be executed. 4. **Send an Event** — Trigger the automation by sending an event from your application. 5. **Monitor Runs** — Track and debug your automation executions using [runs](https://www.senddart.com/docs/automations/runs). ## 1. Create an automation The **Automations** page in the dashboard shows all existing automations. You can search by name and filter by status (**All Statuses**, **Enabled**, or **Disabled**) to quickly find the automation you need. Click **Create automation** to start a new automation. An automation is either **enabled** or **disabled**. New automations start out disabled; only enabled automations create runs when a matching event is received. Over the API, you can create an entire automation flow with a single request (`status` is optional and defaults to `disabled`): - `name` — the name of the automation. - `domain` — **required**: the sending domain this automation belongs to (one of your domains). Only [events](https://www.senddart.com/docs/api/events-send) sent with the same `domain` trigger it. - `status` — the status of the automation (`enabled` or `disabled`). - `steps` — the [steps](https://www.senddart.com/docs/automations/steps) that compose the automation graph. - `connections` — the [connections between steps](https://www.senddart.com/docs/automations/connections) in the automation graph. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }) ``` **PHP** ```php automations->create([ 'name' => "Welcome series", 'domain' => "yourdomain.com", 'steps' => [ [ 'key' => "start", 'type' => "trigger", 'config' => [ 'event_name' => "user.created" ] ], [ 'key' => "welcome", 'type' => "send_email", 'config' => [ 'template' => [ 'id' => "34a080c9-b17d-4187-ad80-5af20266e535" ] ] ] ], 'connections' => [ [ 'from' => "start", 'to' => "welcome" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Create(&senddart.CreateAutomationRequest{ Name: "Welcome series", Domain: "yourdomain.com", Steps: []senddart.AutomationStepInput{ { Key: "start", Type: "trigger", Config: map[string]any{"event_name": "user.created"}, }, { Key: "welcome", Type: "send_email", Config: map[string]any{ "template": map[string]any{"id": "34a080c9-b17d-4187-ad80-5af20266e535"}, }, }, }, Connections: []senddart.AutomationConnectionInput{{From: "start", To: "welcome"}}, }) ``` **Rust** ```rust use senddart::{AutomationStepInput, ConnectionInput, CreateAutomationOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateAutomationOptions::new("Welcome series", "yourdomain.com") .with_step(AutomationStepInput::new("trigger") .with_key("start") .with_config(serde_json::json!({"event_name":"user.created"}))) .with_step(AutomationStepInput::new("send_email") .with_key("welcome") .with_config(serde_json::json!({ "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } }))) .with_connection(ConnectionInput::new("start", "welcome")); let _automation = mb.automations.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationConnection; import com.senddart.requests.AutomationStep; import com.senddart.requests.CreateAutomationRequest; import java.util.Map; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateAutomationRequest request = CreateAutomationRequest.builder() .name("Welcome series") .domain("yourdomain.com") .step(AutomationStep.builder() .key("start") .type("trigger") .config("event_name", "user.created") .build()) .step(AutomationStep.builder() .key("welcome") .type("send_email") .config("template", Map.of("id", "34a080c9-b17d-4187-ad80-5af20266e535")) .build()) .connection(AutomationConnection.of("start", "welcome")) .build(); SendDartResponse response = senddart.automations().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationCreateAsync(new AutomationCreateOptions { Name = "Welcome series", Domain = "yourdomain.com", Steps = new List { new() { Key = "start", Type = "trigger", Config = new Dictionary { ["event_name"] = "user.created", }, }, new() { Key = "welcome", Type = "send_email", Config = new Dictionary { ["template"] = new Dictionary { ["id"] = "34a080c9-b17d-4187-ad80-5af20266e535", }, }, }, }, Connections = new List { new() { From = "start", To = "welcome" }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }' ``` The [trigger](https://www.senddart.com/docs/automations/trigger) is defined as the first item in the `steps` array with `type: "trigger"`. `domain` ties the automation to one of your sending domains — only events sent with that `domain` trigger it, so running several products on one account can never cross-fire automations. For more help creating an automation via the API, see the [Create Automation API reference](https://www.senddart.com/docs/api/automations-create). > **Note:** Creating an automation with `status: "enabled"` requires at least one step besides the trigger. ## 2. Define steps There are several [step types](https://www.senddart.com/docs/automations/steps) you can add to your automation: | Step type | Description | | --- | --- | | [Condition](https://www.senddart.com/docs/automations/condition) | Branches the workflow based on rules. | | A/B split | Randomly splits contacts between two branches by a percentage (deterministic per contact). Add a step with `type: "split"` and `config.percent` — branch A rides the True edge, branch B the False edge. | | [Delay](https://www.senddart.com/docs/automations/delay) | Pauses execution for a specified duration. | | [Wait for Event](https://www.senddart.com/docs/automations/wait-for-event) | Pauses execution until a specific event is received. | | [Send Email](https://www.senddart.com/docs/automations/send-email) | Sends an email using a template. | | [Contact Update](https://www.senddart.com/docs/automations/contact-update) | Updates a contact's fields. | | [Contact Delete](https://www.senddart.com/docs/automations/contact-delete) | Deletes the contact. | | [Add to Segment](https://www.senddart.com/docs/automations/add-to-segment) | Adds the contact to a segment. | ## 3. Send an event Trigger the automation by sending an event from your application. `domain` names the sending domain the event belongs to — only that domain's automations fire. Identify the contact with a `contact_id` or an `email`. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.events.send({ "event": "user.created", "domain": "yourdomain.com", "contact_id": "7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b", "payload": { "plan": "pro" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Events.send({ "event": "user.created", "domain": "yourdomain.com", "contact_id": "7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b", "payload": { "plan": "pro" } }) ``` **PHP** ```php events->send([ 'event' => "user.created", 'domain' => "yourdomain.com", 'contact_id' => "7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b", 'payload' => [ 'plan' => "pro" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Events.send({ "event": "user.created", "domain": "yourdomain.com", "contact_id": "7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b", "payload": { "plan": "pro" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") event, err := client.Events.Send(&senddart.SendEventRequest{ Event: "user.created", Domain: "yourdomain.com", ContactId: "7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b", Payload: map[string]any{"plan": "pro"}, }) ``` **Rust** ```rust use senddart::{SendDart, SendEventOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEventOptions::new("user.created", "yourdomain.com") .with_contact_id("7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b") .with_payload_entry("plan", serde_json::json!("pro")); let _event = mb.events.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEventRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEventRequest request = SendEventRequest.builder() .event("user.created") .domain("yourdomain.com") .contactId("7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b") .payload("plan", "pro") .build(); SendDartResponse response = senddart.events().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EventSendAsync(new EventSendOptions { Event = "user.created", Domain = "yourdomain.com", ContactId = "7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b", Payload = new Dictionary { ["plan"] = "pro" }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/events/send' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "event": "user.created", "domain": "yourdomain.com", "contact_id": "7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b", "payload": { "plan": "pro" } }' ``` **CLI** ```bash senddart events send \ --name 'user.created' \ --domain 'yourdomain.com' \ --contact-id '7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b' \ --data '{"plan":"pro"}' ``` **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.events.send({ "event": "user.created", "domain": "yourdomain.com", "email": "user@example.com", "payload": { "plan": "pro" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Events.send({ "event": "user.created", "domain": "yourdomain.com", "email": "user@example.com", "payload": { "plan": "pro" } }) ``` **PHP** ```php events->send([ 'event' => "user.created", 'domain' => "yourdomain.com", 'email' => "user@example.com", 'payload' => [ 'plan' => "pro" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Events.send({ "event": "user.created", "domain": "yourdomain.com", "email": "user@example.com", "payload": { "plan": "pro" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") event, err := client.Events.Send(&senddart.SendEventRequest{ Event: "user.created", Domain: "yourdomain.com", Email: "user@example.com", Payload: map[string]any{"plan": "pro"}, }) ``` **Rust** ```rust use senddart::{SendDart, SendEventOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEventOptions::new("user.created", "yourdomain.com") .with_email("user@example.com") .with_payload_entry("plan", serde_json::json!("pro")); let _event = mb.events.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEventRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEventRequest request = SendEventRequest.builder() .event("user.created") .domain("yourdomain.com") .email("user@example.com") .payload("plan", "pro") .build(); SendDartResponse response = senddart.events().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EventSendAsync(new EventSendOptions { Event = "user.created", Domain = "yourdomain.com", Email = "user@example.com", Payload = new Dictionary { ["plan"] = "pro" }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/events/send' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "event": "user.created", "domain": "yourdomain.com", "email": "user@example.com", "payload": { "plan": "pro" } }' ``` **CLI** ```bash senddart events send \ --name 'user.created' \ --domain 'yourdomain.com' \ --email 'user@example.com' \ --data '{"plan":"pro"}' ``` View the [Send Event API reference](https://www.senddart.com/docs/api/events-send) for more details. ## 4. Monitor runs After sending events, track your automation executions through runs. Each time an event triggers an automation, a run is created to track the execution. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.runs('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **PHP** ```php automations->runs('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") runs, err := client.Automations.Runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _runs = mb.automations.runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationListRunsAsync("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/runs' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart automations runs c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd ``` You can filter runs by status (`running`, `completed`, `failed`, `skipped`). Learn how to: - View run statuses and execution details - Filter runs by status - Debug failed runs with step-level error information - Stop automations when needed See the [Runs documentation](https://www.senddart.com/docs/automations/runs) and the [List Automation Runs API reference](https://www.senddart.com/docs/api/automations-list-runs) for more details. --- # Steps > Steps and their properties in automation workflows. ## How it works Steps are the building blocks of automation workflows. They define the actions that will be executed when the automation runs. The following steps are available: - [Trigger](https://www.senddart.com/docs/automations/trigger) - [Condition](https://www.senddart.com/docs/automations/condition) - [Delay](https://www.senddart.com/docs/automations/delay) - [Wait for Event](https://www.senddart.com/docs/automations/wait-for-event) - [Send Email](https://www.senddart.com/docs/automations/send-email) - [Add to Segment](https://www.senddart.com/docs/automations/add-to-segment) - [Contact Update](https://www.senddart.com/docs/automations/contact-update) - [Contact Delete](https://www.senddart.com/docs/automations/contact-delete) ## Step properties Every step in an automation has the following base properties: | Name | Type | Required | Description | | --- | --- | --- | --- | | `key` | string | Yes | A unique identifier for the step. Used in [connection](https://www.senddart.com/docs/automations/connections) definitions to connect steps. | | `type` | string | Yes | The type of step. Possible values: `trigger`, `send_email`, `delay`, `wait_for_event`, `condition`, `split`, `contact_update`, `contact_delete`, `add_to_segment`. | | `config` | object | Yes | The configuration object for the step. The shape depends on the step `type`. | Below is a list of all the possible step types and their configurations. ### trigger The [trigger](https://www.senddart.com/docs/automations/trigger) step starts the automation when a matching event is received. | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.event_name` | string | Yes | The name of the event that triggers the automation. | ```json { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } } ``` ### send_email Sends an email using a [template](https://www.senddart.com/docs/automations/send-email). | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.template` | object | Yes | The published template to send. Provide `id` and optionally `variables`. | | `config.template.id` | string | Yes | The ID or alias of the template to send. | | `config.template.variables` | object | No | A key-value map of template variables. Each value can be a static string or a variable reference object (`{ "var": "event.fieldName" }`) that resolves dynamically from the `event.*`, `contact.*`, or `wait_events.*` namespaces. | | `config.from` | string | No | The sender email address. If provided, this value will override the template's default value. | | `config.subject` | string | No | The email subject line. If provided, this value will override the template's default value. | | `config.reply_to` | string | No | Reply-to email address. If provided, this value will override the template's default value. | ```json { "key": "welcome", "type": "send_email", "config": { "template": { "id": "062f8ef4-fbfa-44f1-b5e0-ff8e1e8ffa96", "variables": { "name": { "var": "event.firstName" } } }, "from": "hello@example.com", "subject": "Welcome!", "reply_to": "support@example.com" } } ``` ### delay Pauses execution for a [specified duration](https://www.senddart.com/docs/automations/delay). | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.duration` | string | Yes | The delay duration in natural language (e.g. `"1 hour"`, `"3 days"`). Maximum: 30 days. | ```json { "key": "wait_1_hour", "type": "delay", "config": { "duration": "1 hour" } } ``` ### wait_for_event Pauses execution until a [specific event](https://www.senddart.com/docs/automations/wait-for-event) is received or a timeout is reached. | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.event_name` | string | Yes | The name of the event to wait for. | | `config.timeout` | string | No | The maximum time to wait before timing out (e.g. `"3 days"`, `"1 hour"`). Maximum: 30 days. | | `config.filter_rule` | object | No | An optional rule object to filter incoming events. | ```json { "key": "wait_for_purchase", "type": "wait_for_event", "config": { "event_name": "purchase.completed", "timeout": "3 days" } } ``` ### condition Branches the workflow based on [rules](https://www.senddart.com/docs/automations/condition). Condition configs can be a single rule or a logical group (`and`/`or`) of rules. | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.type` | string | Yes | The type of condition node: `rule`, `and`, or `or`. | | `config.field` | string | Yes | For `rule` type — the field to evaluate. Must use the `event.` or `contact.` namespace prefix (e.g. `event.amount`, `contact.email`). | | `config.operator` | string | Yes | For `rule` type — the comparison operator: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains`, `starts_with`, `ends_with`, `exists`, `is_empty`. | | `config.value` | string | number | boolean | null | No | For `rule` type — the value to compare against. Not required for `exists` and `is_empty` operators. | | `config.rules` | object[] | No | For `and` / `or` types — a flat array of `{ field, operator, value }` rules (not nested groups). Must contain at least one item. | **Single rule** ```json { "key": "check_plan", "type": "condition", "config": { "type": "rule", "field": "event.plan", "operator": "eq", "value": "pro" } } ``` **Combined rules** ```json { "key": "check_plan_and_amount", "type": "condition", "config": { "type": "and", "rules": [ { "type": "rule", "field": "event.plan", "operator": "eq", "value": "pro" }, { "type": "rule", "field": "event.amount", "operator": "gte", "value": 100 } ] } } ``` ### split A/B split: randomly routes contacts between two branches by percentage. Assignment is deterministic per contact+step (re-runs keep the same branch). Branch A rides the `condition_met` edge, branch B `condition_not_met`. | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.percent` | number | Yes | Share of contacts taking branch A, an integer from 1 to 99. | ```json { "key": "ab", "type": "split", "config": { "percent": 50 } } ``` ### contact_update Updates a [contact's fields](https://www.senddart.com/docs/automations/contact-update). Each field value can be either a hardcoded value or a dynamic variable reference using the `{ "var": "..." }` syntax, with the `event.*` or `contact.*` scope. | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.first_name` | string | object | No | The contact's first name. Accepts a hardcoded string or a variable reference. | | `config.last_name` | string | object | No | The contact's last name. Accepts a hardcoded string or a variable reference. | | `config.unsubscribed` | boolean | object | No | The contact's unsubscribed status. Accepts a boolean or a variable reference. | | `config.properties` | object | No | A map of custom contact properties to update. Each value can be a hardcoded value (string, number, boolean) or a variable reference. | ```json { "key": "update_contact", "type": "contact_update", "config": { "properties": { "company": { "var": "event.company" }, "vip": true } } } ``` ### contact_delete [Deletes the contact](https://www.senddart.com/docs/automations/contact-delete) from the audience. This step does not require any configuration fields. Pass an empty object `{}` as the config. ```json { "key": "remove_contact", "type": "contact_delete", "config": {} } ``` ### add_to_segment Adds the contact to a [segment](https://www.senddart.com/docs/automations/add-to-segment). | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.segment_id` | string | Yes | The ID of the segment to add the contact to. | ```json { "key": "add_to_vip", "type": "add_to_segment", "config": { "segment_id": "83a1e324-26dc-47eb-9b28-ba8b6d1fe808" } } ``` --- # Trigger > The first step of every automation — the event that starts a run for a contact. A **trigger** is the first step in every automation. It defines which event starts the automation when SendDart receives it. When your application sends an event to SendDart, every **enabled** automation with a matching trigger **on the event's domain** executes its workflow for the identified contact. Every automation belongs to one of your sending domains (shown on the trigger step), and [`POST /events/send`](https://www.senddart.com/docs/api/events-send) names the domain it targets — so the same event name used across several products never cross-fires. See [Using automations](https://www.senddart.com/docs/automations/overview) for how the steps fit together. ## How it works The trigger is the first node in the editor. Choose an existing [custom event](https://www.senddart.com/docs/automations/custom-events) or type a new event name, and pick the **domain** the automation belongs to (selected automatically when you have one domain). When creating an automation over the API, the trigger is the first item in the `steps` array with `type: "trigger"`, and `domain` is a required top-level field. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } } ], "connections": [] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } } ], "connections": [] }) ``` **PHP** ```php automations->create([ 'name' => "Welcome series", 'domain' => "yourdomain.com", 'steps' => [ [ 'key' => "start", 'type' => "trigger", 'config' => [ 'event_name' => "user.created" ] ] ], 'connections' => [] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } } ], "connections": [] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Create(&senddart.CreateAutomationRequest{ Name: "Welcome series", Domain: "yourdomain.com", Steps: []senddart.AutomationStepInput{ { Key: "start", Type: "trigger", Config: map[string]any{"event_name": "user.created"}, }, }, Connections: []senddart.AutomationConnectionInput{}, }) ``` **Rust** ```rust use senddart::{AutomationStepInput, CreateAutomationOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateAutomationOptions::new("Welcome series", "yourdomain.com") .with_step(AutomationStepInput::new("trigger") .with_key("start") .with_config(serde_json::json!({"event_name":"user.created"}))); let _automation = mb.automations.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationStep; import com.senddart.requests.CreateAutomationRequest; import java.util.List; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateAutomationRequest request = CreateAutomationRequest.builder() .name("Welcome series") .domain("yourdomain.com") .step(AutomationStep.builder() .key("start") .type("trigger") .config("event_name", "user.created") .build()) .connections(List.of()) .build(); SendDartResponse response = senddart.automations().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationCreateAsync(new AutomationCreateOptions { Name = "Welcome series", Domain = "yourdomain.com", Steps = new List { new() { Key = "start", Type = "trigger", Config = new Dictionary { ["event_name"] = "user.created", }, }, }, Connections = new List(), }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } } ], "connections": [] }' ``` > **Warning:** Custom event names cannot start with the `senddart:` prefix, which is reserved for system events. The one built-in exception is the `senddart:schedule` scheduled trigger — set it with a `trigger_config` of `{ at, timezone }` to run the automation once for every contact in the domain’s audience at that time (see [Create Automation](https://www.senddart.com/docs/api/automations-create)). ## Engagement triggers Besides custom events, an automation can start when a contact **engages** with one of your emails. Set the trigger to one of these built-in events — no code required, the platform enrolls the contact automatically: | Trigger | Starts a run when… | | --- | --- | | `email.opened` | the contact opens one of your emails | | `email.clicked` | the contact clicks a link in one of your emails | | `email.replied` | the contact replies to one of your emails | | `email.bounced` | an email to the contact bounces (e.g. tag or notify on bounce) | | `email.delivered` | an email to the contact is delivered (post-delivery sequences) | In the editor, pick one under **Event trigger… → When a recipient…**. Over the API, pass the event name as the trigger string (or the trigger step's `config.event_name`). **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.create({ "name": "Re-engage on click", "domain": "yourdomain.com", "trigger": "email.clicked", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "email.clicked" } } ], "connections": [] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.create({ "name": "Re-engage on click", "domain": "yourdomain.com", "trigger": "email.clicked", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "email.clicked" } } ], "connections": [] }) ``` **PHP** ```php automations->create([ 'name' => "Re-engage on click", 'domain' => "yourdomain.com", 'trigger' => "email.clicked", 'steps' => [ [ 'key' => "start", 'type' => "trigger", 'config' => [ 'event_name' => "email.clicked" ] ] ], 'connections' => [] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.create({ "name": "Re-engage on click", "domain": "yourdomain.com", "trigger": "email.clicked", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "email.clicked" } } ], "connections": [] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Create(&senddart.CreateAutomationRequest{ Name: "Re-engage on click", Domain: "yourdomain.com", Trigger: "email.clicked", Steps: []senddart.AutomationStepInput{ { Key: "start", Type: "trigger", Config: map[string]any{"event_name": "email.clicked"}, }, }, Connections: []senddart.AutomationConnectionInput{}, }) ``` **Rust** ```rust use senddart::{AutomationStepInput, CreateAutomationOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateAutomationOptions::new("Re-engage on click", "yourdomain.com") .with_trigger("email.clicked") .with_step(AutomationStepInput::new("trigger") .with_key("start") .with_config(serde_json::json!({"event_name":"email.clicked"}))); let _automation = mb.automations.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationStep; import com.senddart.requests.CreateAutomationRequest; import java.util.List; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateAutomationRequest request = CreateAutomationRequest.builder() .name("Re-engage on click") .domain("yourdomain.com") .trigger("email.clicked") .step(AutomationStep.builder() .key("start") .type("trigger") .config("event_name", "email.clicked") .build()) .connections(List.of()) .build(); SendDartResponse response = senddart.automations().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationCreateAsync(new AutomationCreateOptions { Name = "Re-engage on click", Domain = "yourdomain.com", Trigger = "email.clicked", Steps = new List { new() { Key = "start", Type = "trigger", Config = new Dictionary { ["event_name"] = "email.clicked", }, }, }, Connections = new List(), }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Re-engage on click", "domain": "yourdomain.com", "trigger": "email.clicked", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "email.clicked" } } ], "connections": [] }' ``` > **Note:** Engagement on an email that an automation itself sent does not re-trigger an automation — this prevents send → open → re-enrol loops. Only opens, clicks and replies on your regular (API, campaign, or manual) sends start engagement automations. Engagement triggers are domain-scoped like everything else: a click on an email sent from `abc.com` only starts `abc.com`'s automations. A **poll vote** also emits a trigger. When a recipient answers an in-email poll, a `poll.responded` event fires for the contact with the chosen answer available as `event.answer` — set an automation trigger (or a `wait_for_event` step) to `poll.responded` to branch on how they voted. Only existing contacts trigger it. ## Identifying contacts When you send an event to start an automation, you must identify the contact with either a `contact_id` or an `email`, and name the `domain` the event belongs to. Use `contact_id` when the contact already exists in your [audience](https://www.senddart.com/docs/audiences/overview); use `email` to look the contact up by address. If no contact with the provided email exists in that domain's contacts, SendDart creates one when the run starts — each domain keeps its own contact records, so unsubscribe state stays separate per product. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.events.send({ "event": "user.created", "domain": "yourdomain.com", "contact_id": "26e2b838-bf6d-4515-b6a7-17525b12b05a", "payload": { "plan": "pro" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Events.send({ "event": "user.created", "domain": "yourdomain.com", "contact_id": "26e2b838-bf6d-4515-b6a7-17525b12b05a", "payload": { "plan": "pro" } }) ``` **PHP** ```php events->send([ 'event' => "user.created", 'domain' => "yourdomain.com", 'contact_id' => "26e2b838-bf6d-4515-b6a7-17525b12b05a", 'payload' => [ 'plan' => "pro" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Events.send({ "event": "user.created", "domain": "yourdomain.com", "contact_id": "26e2b838-bf6d-4515-b6a7-17525b12b05a", "payload": { "plan": "pro" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") event, err := client.Events.Send(&senddart.SendEventRequest{ Event: "user.created", Domain: "yourdomain.com", ContactId: "26e2b838-bf6d-4515-b6a7-17525b12b05a", Payload: map[string]any{"plan": "pro"}, }) ``` **Rust** ```rust use senddart::{SendDart, SendEventOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEventOptions::new("user.created", "yourdomain.com") .with_contact_id("26e2b838-bf6d-4515-b6a7-17525b12b05a") .with_payload_entry("plan", serde_json::json!("pro")); let _event = mb.events.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEventRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEventRequest request = SendEventRequest.builder() .event("user.created") .domain("yourdomain.com") .contactId("26e2b838-bf6d-4515-b6a7-17525b12b05a") .payload("plan", "pro") .build(); SendDartResponse response = senddart.events().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EventSendAsync(new EventSendOptions { Event = "user.created", Domain = "yourdomain.com", ContactId = "26e2b838-bf6d-4515-b6a7-17525b12b05a", Payload = new Dictionary { ["plan"] = "pro" }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/events/send' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "event": "user.created", "domain": "yourdomain.com", "contact_id": "26e2b838-bf6d-4515-b6a7-17525b12b05a", "payload": { "plan": "pro" } }' ``` **CLI** ```bash senddart events send \ --name 'user.created' \ --domain 'yourdomain.com' \ --contact-id '26e2b838-bf6d-4515-b6a7-17525b12b05a' \ --data '{"plan":"pro"}' ``` **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.events.send({ "event": "user.created", "domain": "yourdomain.com", "email": "user@example.com", "payload": { "plan": "pro" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Events.send({ "event": "user.created", "domain": "yourdomain.com", "email": "user@example.com", "payload": { "plan": "pro" } }) ``` **PHP** ```php events->send([ 'event' => "user.created", 'domain' => "yourdomain.com", 'email' => "user@example.com", 'payload' => [ 'plan' => "pro" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Events.send({ "event": "user.created", "domain": "yourdomain.com", "email": "user@example.com", "payload": { "plan": "pro" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") event, err := client.Events.Send(&senddart.SendEventRequest{ Event: "user.created", Domain: "yourdomain.com", Email: "user@example.com", Payload: map[string]any{"plan": "pro"}, }) ``` **Rust** ```rust use senddart::{SendDart, SendEventOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEventOptions::new("user.created", "yourdomain.com") .with_email("user@example.com") .with_payload_entry("plan", serde_json::json!("pro")); let _event = mb.events.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEventRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEventRequest request = SendEventRequest.builder() .event("user.created") .domain("yourdomain.com") .email("user@example.com") .payload("plan", "pro") .build(); SendDartResponse response = senddart.events().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EventSendAsync(new EventSendOptions { Event = "user.created", Domain = "yourdomain.com", Email = "user@example.com", Payload = new Dictionary { ["plan"] = "pro" }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/events/send' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "event": "user.created", "domain": "yourdomain.com", "email": "user@example.com", "payload": { "plan": "pro" } }' ``` **CLI** ```bash senddart events send \ --name 'user.created' \ --domain 'yourdomain.com' \ --email 'user@example.com' \ --data '{"plan":"pro"}' ``` ## Event payload Include a `payload` object with your event to pass data into the automation. This data becomes available as variables in later steps through the `event.*` namespace. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.events.send({ "event": "payment.failed", "domain": "yourdomain.com", "contact_id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "payload": { "amount": 49.99, "currency": "USD", "retryDate": "2026-11-01" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Events.send({ "event": "payment.failed", "domain": "yourdomain.com", "contact_id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "payload": { "amount": 49.99, "currency": "USD", "retryDate": "2026-11-01" } }) ``` **PHP** ```php events->send([ 'event' => "payment.failed", 'domain' => "yourdomain.com", 'contact_id' => "e169aa45-1ecf-4183-9955-b1499d5701d3", 'payload' => [ 'amount' => 49.99, 'currency' => "USD", 'retryDate' => "2026-11-01" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Events.send({ "event": "payment.failed", "domain": "yourdomain.com", "contact_id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "payload": { "amount": 49.99, "currency": "USD", "retryDate": "2026-11-01" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") event, err := client.Events.Send(&senddart.SendEventRequest{ Event: "payment.failed", Domain: "yourdomain.com", ContactId: "e169aa45-1ecf-4183-9955-b1499d5701d3", Payload: map[string]any{ "amount": 49.99, "currency": "USD", "retryDate": "2026-11-01", }, }) ``` **Rust** ```rust use senddart::{SendDart, SendEventOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEventOptions::new("payment.failed", "yourdomain.com") .with_contact_id("e169aa45-1ecf-4183-9955-b1499d5701d3") .with_payload_entry("amount", serde_json::json!(49.99)) .with_payload_entry("currency", serde_json::json!("USD")) .with_payload_entry("retryDate", serde_json::json!("2026-11-01")); let _event = mb.events.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEventRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEventRequest request = SendEventRequest.builder() .event("payment.failed") .domain("yourdomain.com") .contactId("e169aa45-1ecf-4183-9955-b1499d5701d3") .payload("amount", 49.99) .payload("currency", "USD") .payload("retryDate", "2026-11-01") .build(); SendDartResponse response = senddart.events().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EventSendAsync(new EventSendOptions { Event = "payment.failed", Domain = "yourdomain.com", ContactId = "e169aa45-1ecf-4183-9955-b1499d5701d3", Payload = new Dictionary { ["amount"] = 49.99, ["currency"] = "USD", ["retryDate"] = "2026-11-01", }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/events/send' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "event": "payment.failed", "domain": "yourdomain.com", "contact_id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "payload": { "amount": 49.99, "currency": "USD", "retryDate": "2026-11-01" } }' ``` **CLI** ```bash senddart events send \ --name 'payment.failed' \ --domain 'yourdomain.com' \ --contact-id 'e169aa45-1ecf-4183-9955-b1499d5701d3' \ --data '{"amount":49.99,"currency":"USD","retryDate":"2026-11-01"}' ``` In this example, `event.amount`, `event.currency`, and `event.retryDate` become available in email templates, [conditions](https://www.senddart.com/docs/automations/condition), and other steps. ## Configuration | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.event_name` | string | Yes | The name of the event that triggers the automation. | ```json { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } } ``` --- # Condition > Branch a contact down one of two paths based on event or contact data. A **condition** step evaluates a rule against event or contact data and routes the automation down one of two paths: **condition met** or **condition not met**. See [Using automations](https://www.senddart.com/docs/automations/overview) for the surrounding workflow. Common use cases: - **Plan-based emails** — send different content to free vs. paid users. - **Engagement splits** — take different actions based on user activity. - **Personalization** — tailor follow-ups based on event payload values. ## How it works The condition step accepts a `type` and the corresponding rule fields, plus two outgoing connections — one for each outcome. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.create({ "name": "Plan-based welcome", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "check_plan", "type": "condition", "config": { "type": "rule", "field": "event.plan", "operator": "eq", "value": "pro" } }, { "key": "send_pro_email", "type": "send_email", "config": { "template": { "id": "pro-welcome-template-id" } } }, { "key": "send_free_email", "type": "send_email", "config": { "template": { "id": "free-welcome-template-id" } } } ], "connections": [ { "from": "start", "to": "check_plan", "type": "default" }, { "from": "check_plan", "to": "send_pro_email", "type": "condition_met" }, { "from": "check_plan", "to": "send_free_email", "type": "condition_not_met" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.create({ "name": "Plan-based welcome", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "check_plan", "type": "condition", "config": { "type": "rule", "field": "event.plan", "operator": "eq", "value": "pro" } }, { "key": "send_pro_email", "type": "send_email", "config": { "template": { "id": "pro-welcome-template-id" } } }, { "key": "send_free_email", "type": "send_email", "config": { "template": { "id": "free-welcome-template-id" } } } ], "connections": [ { "from": "start", "to": "check_plan", "type": "default" }, { "from": "check_plan", "to": "send_pro_email", "type": "condition_met" }, { "from": "check_plan", "to": "send_free_email", "type": "condition_not_met" } ] }) ``` **PHP** ```php automations->create([ 'name' => "Plan-based welcome", 'domain' => "yourdomain.com", 'steps' => [ [ 'key' => "start", 'type' => "trigger", 'config' => [ 'event_name' => "user.created" ] ], [ 'key' => "check_plan", 'type' => "condition", 'config' => [ 'type' => "rule", 'field' => "event.plan", 'operator' => "eq", 'value' => "pro" ] ], [ 'key' => "send_pro_email", 'type' => "send_email", 'config' => [ 'template' => [ 'id' => "pro-welcome-template-id" ] ] ], [ 'key' => "send_free_email", 'type' => "send_email", 'config' => [ 'template' => [ 'id' => "free-welcome-template-id" ] ] ] ], 'connections' => [ [ 'from' => "start", 'to' => "check_plan", 'type' => "default" ], [ 'from' => "check_plan", 'to' => "send_pro_email", 'type' => "condition_met" ], [ 'from' => "check_plan", 'to' => "send_free_email", 'type' => "condition_not_met" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.create({ "name": "Plan-based welcome", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "check_plan", "type": "condition", "config": { "type": "rule", "field": "event.plan", "operator": "eq", "value": "pro" } }, { "key": "send_pro_email", "type": "send_email", "config": { "template": { "id": "pro-welcome-template-id" } } }, { "key": "send_free_email", "type": "send_email", "config": { "template": { "id": "free-welcome-template-id" } } } ], "connections": [ { "from": "start", "to": "check_plan", "type": "default" }, { "from": "check_plan", "to": "send_pro_email", "type": "condition_met" }, { "from": "check_plan", "to": "send_free_email", "type": "condition_not_met" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Create(&senddart.CreateAutomationRequest{ Name: "Plan-based welcome", Domain: "yourdomain.com", Steps: []senddart.AutomationStepInput{ { Key: "start", Type: "trigger", Config: map[string]any{"event_name": "user.created"}, }, { Key: "check_plan", Type: "condition", Config: map[string]any{ "type": "rule", "field": "event.plan", "operator": "eq", "value": "pro", }, }, { Key: "send_pro_email", Type: "send_email", Config: map[string]any{ "template": map[string]any{"id": "pro-welcome-template-id"}, }, }, { Key: "send_free_email", Type: "send_email", Config: map[string]any{ "template": map[string]any{"id": "free-welcome-template-id"}, }, }, }, Connections: []senddart.AutomationConnectionInput{ {From: "start", To: "check_plan", Type: "default"}, {From: "check_plan", To: "send_pro_email", Type: "condition_met"}, { From: "check_plan", To: "send_free_email", Type: "condition_not_met", }, }, }) ``` **Rust** ```rust use senddart::{AutomationStepInput, ConnectionInput, CreateAutomationOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateAutomationOptions::new("Plan-based welcome", "yourdomain.com") .with_step(AutomationStepInput::new("trigger") .with_key("start") .with_config(serde_json::json!({"event_name":"user.created"}))) .with_step(AutomationStepInput::new("condition") .with_key("check_plan") .with_config(serde_json::json!({ "type": "rule", "field": "event.plan", "operator": "eq", "value": "pro" }))) .with_step(AutomationStepInput::new("send_email") .with_key("send_pro_email") .with_config(serde_json::json!({"template":{"id":"pro-welcome-template-id"}}))) .with_step(AutomationStepInput::new("send_email") .with_key("send_free_email") .with_config(serde_json::json!({"template":{"id":"free-welcome-template-id"}}))) .with_connection(ConnectionInput::new("start", "check_plan").with_type("default")) .with_connection(ConnectionInput::new("check_plan", "send_pro_email") .with_type("condition_met")) .with_connection(ConnectionInput::new("check_plan", "send_free_email") .with_type("condition_not_met")); let _automation = mb.automations.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationConnection; import com.senddart.requests.AutomationStep; import com.senddart.requests.CreateAutomationRequest; import java.util.Map; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateAutomationRequest request = CreateAutomationRequest.builder() .name("Plan-based welcome") .domain("yourdomain.com") .step(AutomationStep.builder() .key("start") .type("trigger") .config("event_name", "user.created") .build()) .step(AutomationStep.builder() .key("check_plan") .type("condition") .config("type", "rule") .config("field", "event.plan") .config("operator", "eq") .config("value", "pro") .build()) .step(AutomationStep.builder() .key("send_pro_email") .type("send_email") .config("template", Map.of("id", "pro-welcome-template-id")) .build()) .step(AutomationStep.builder() .key("send_free_email") .type("send_email") .config("template", Map.of("id", "free-welcome-template-id")) .build()) .connection(AutomationConnection.of("start", "check_plan", "default")) .connection(AutomationConnection.of("check_plan", "send_pro_email", "condition_met")) .connection(AutomationConnection.of("check_plan", "send_free_email", "condition_not_met")) .build(); SendDartResponse response = senddart.automations().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationCreateAsync(new AutomationCreateOptions { Name = "Plan-based welcome", Domain = "yourdomain.com", Steps = new List { new() { Key = "start", Type = "trigger", Config = new Dictionary { ["event_name"] = "user.created", }, }, new() { Key = "check_plan", Type = "condition", Config = new Dictionary { ["type"] = "rule", ["field"] = "event.plan", ["operator"] = "eq", ["value"] = "pro", }, }, new() { Key = "send_pro_email", Type = "send_email", Config = new Dictionary { ["template"] = new Dictionary { ["id"] = "pro-welcome-template-id", }, }, }, new() { Key = "send_free_email", Type = "send_email", Config = new Dictionary { ["template"] = new Dictionary { ["id"] = "free-welcome-template-id", }, }, }, }, Connections = new List { new() { From = "start", To = "check_plan", Type = "default", }, new() { From = "check_plan", To = "send_pro_email", Type = "condition_met", }, new() { From = "check_plan", To = "send_free_email", Type = "condition_not_met", }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Plan-based welcome", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "check_plan", "type": "condition", "config": { "type": "rule", "field": "event.plan", "operator": "eq", "value": "pro" } }, { "key": "send_pro_email", "type": "send_email", "config": { "template": { "id": "pro-welcome-template-id" } } }, { "key": "send_free_email", "type": "send_email", "config": { "template": { "id": "free-welcome-template-id" } } } ], "connections": [ { "from": "start", "to": "check_plan", "type": "default" }, { "from": "check_plan", "to": "send_pro_email", "type": "condition_met" }, { "from": "check_plan", "to": "send_free_email", "type": "condition_not_met" } ] }' ``` ## Connection types A condition step always produces two outgoing connections: | Connection type | Description | | --- | --- | | `condition_met` | Taken when the condition evaluates to true. | | `condition_not_met` | Taken when the condition evaluates to false. | ## Operators A `rule` condition compares a `field` against a `value` using one of the following operators: | Operator | Meaning | | --- | --- | | `eq` | Equals. | | `neq` | Not equals. | | `gt` | Greater than. | | `gte` | Greater than or equal to. | | `lt` | Less than. | | `lte` | Less than or equal to. | | `contains` | Contains a given value. | | `starts_with` | Starts with a given value. | | `ends_with` | Ends with a given value. | | `exists` | Field exists (no `value` required). | | `is_empty` | Field is empty (no `value` required). | ## Combining rules Use `and` or `or` to combine multiple rules into a single branch. Each entry in `rules` is a single `{ field, operator, value }` rule — groups do not nest; chain condition steps to build one. ```json { "key": "check_plan_and_amount", "type": "condition", "config": { "type": "and", "rules": [ { "type": "rule", "field": "event.plan", "operator": "eq", "value": "pro" }, { "type": "rule", "field": "event.amount", "operator": "gte", "value": 100 } ] } } ``` ## Configuration | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.type` | string | Yes | The type of condition node: `rule`, `and`, or `or`. | | `config.field` | string | Yes | For `rule` type — the field to evaluate. Must use the `event.` or `contact.` namespace prefix (e.g. `event.amount`, `contact.email`). | | `config.operator` | string | Yes | For `rule` type — the comparison operator. See the operators table above. | | `config.value` | string | number | boolean | null | No | For `rule` type — the value to compare against. Not required for `exists` and `is_empty`. | | `config.rules` | object[] | No | For `and` / `or` types — a flat array of `{ field, operator, value }` rules (not nested groups). Must contain at least one item. | --- # Delay > Pause an automation for a fixed duration before continuing to the next step. A **delay** step pauses the automation for a specified duration before continuing to the next step. See [Using automations](https://www.senddart.com/docs/automations/overview) for how steps chain together. Common use cases: - **Email sequences** — space out emails in an onboarding series. - **Cooldowns** — prevent sending too many emails in a short period. - **Follow-ups** — give users time to take action before sending a reminder. ## How it works In the dashboard you configure a delay duration in natural language. Over the API, the delay step accepts a single `duration` field with a human-readable time value. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "wait_1_day", "type": "delay", "config": { "duration": "1 day" } } ], "connections": [ { "from": "start", "to": "wait_1_day", "type": "default" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "wait_1_day", "type": "delay", "config": { "duration": "1 day" } } ], "connections": [ { "from": "start", "to": "wait_1_day", "type": "default" } ] }) ``` **PHP** ```php automations->create([ 'name' => "Welcome series", 'domain' => "yourdomain.com", 'steps' => [ [ 'key' => "start", 'type' => "trigger", 'config' => [ 'event_name' => "user.created" ] ], [ 'key' => "wait_1_day", 'type' => "delay", 'config' => [ 'duration' => "1 day" ] ] ], 'connections' => [ [ 'from' => "start", 'to' => "wait_1_day", 'type' => "default" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "wait_1_day", "type": "delay", "config": { "duration": "1 day" } } ], "connections": [ { "from": "start", "to": "wait_1_day", "type": "default" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Create(&senddart.CreateAutomationRequest{ Name: "Welcome series", Domain: "yourdomain.com", Steps: []senddart.AutomationStepInput{ { Key: "start", Type: "trigger", Config: map[string]any{"event_name": "user.created"}, }, { Key: "wait_1_day", Type: "delay", Config: map[string]any{"duration": "1 day"}, }, }, Connections: []senddart.AutomationConnectionInput{ {From: "start", To: "wait_1_day", Type: "default"}, }, }) ``` **Rust** ```rust use senddart::{AutomationStepInput, ConnectionInput, CreateAutomationOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateAutomationOptions::new("Welcome series", "yourdomain.com") .with_step(AutomationStepInput::new("trigger") .with_key("start") .with_config(serde_json::json!({"event_name":"user.created"}))) .with_step(AutomationStepInput::new("delay") .with_key("wait_1_day") .with_config(serde_json::json!({"duration":"1 day"}))) .with_connection(ConnectionInput::new("start", "wait_1_day").with_type("default")); let _automation = mb.automations.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationConnection; import com.senddart.requests.AutomationStep; import com.senddart.requests.CreateAutomationRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateAutomationRequest request = CreateAutomationRequest.builder() .name("Welcome series") .domain("yourdomain.com") .step(AutomationStep.builder() .key("start") .type("trigger") .config("event_name", "user.created") .build()) .step(AutomationStep.builder() .key("wait_1_day") .type("delay") .config("duration", "1 day") .build()) .connection(AutomationConnection.of("start", "wait_1_day", "default")) .build(); SendDartResponse response = senddart.automations().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationCreateAsync(new AutomationCreateOptions { Name = "Welcome series", Domain = "yourdomain.com", Steps = new List { new() { Key = "start", Type = "trigger", Config = new Dictionary { ["event_name"] = "user.created", }, }, new() { Key = "wait_1_day", Type = "delay", Config = new Dictionary { ["duration"] = "1 day" }, }, }, Connections = new List { new() { From = "start", To = "wait_1_day", Type = "default", }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "wait_1_day", "type": "delay", "config": { "duration": "1 day" } } ], "connections": [ { "from": "start", "to": "wait_1_day", "type": "default" } ] }' ``` Example durations: `"30 minutes"`, `"1 hour"`, `"12 hours"`, `"1 day"`, `"3 days"`, `"1 week"`. > **Warning:** The maximum delay is **30 days**. ## Configuration | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.duration` | string | Yes | The delay duration in natural language (e.g. `"1 hour"`, `"3 days"`). Maximum: 30 days. | ```json { "key": "wait_1_hour", "type": "delay", "config": { "duration": "1 hour" } } ``` --- # Wait for Event > Hold an automation until a specific event arrives, with an optional timeout and filter rule. A **wait for event** step holds the automation until a specific event is received. Unlike a [delay](https://www.senddart.com/docs/automations/delay), which resumes after a fixed time, this step resumes when something happens in your application. See [Using automations](https://www.senddart.com/docs/automations/overview) for the surrounding workflow. Common use cases: - **Payment** — wait for a payment to succeed before sending a receipt. - **Adoption** — wait for a user to complete an action to unlock a feature. - **Verification** — wait for the user to verify their email before continuing. ## How it works Add a `wait_for_event` step to the `steps` array, naming the event to wait for and an optional `timeout`. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.create({ "name": "Verification reminder", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "verification", "type": "wait_for_event", "config": { "event_name": "email.verified", "timeout": "1 day" } } ], "connections": [ { "from": "start", "to": "verification", "type": "default" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.create({ "name": "Verification reminder", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "verification", "type": "wait_for_event", "config": { "event_name": "email.verified", "timeout": "1 day" } } ], "connections": [ { "from": "start", "to": "verification", "type": "default" } ] }) ``` **PHP** ```php automations->create([ 'name' => "Verification reminder", 'domain' => "yourdomain.com", 'steps' => [ [ 'key' => "start", 'type' => "trigger", 'config' => [ 'event_name' => "user.created" ] ], [ 'key' => "verification", 'type' => "wait_for_event", 'config' => [ 'event_name' => "email.verified", 'timeout' => "1 day" ] ] ], 'connections' => [ [ 'from' => "start", 'to' => "verification", 'type' => "default" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.create({ "name": "Verification reminder", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "verification", "type": "wait_for_event", "config": { "event_name": "email.verified", "timeout": "1 day" } } ], "connections": [ { "from": "start", "to": "verification", "type": "default" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Create(&senddart.CreateAutomationRequest{ Name: "Verification reminder", Domain: "yourdomain.com", Steps: []senddart.AutomationStepInput{ { Key: "start", Type: "trigger", Config: map[string]any{"event_name": "user.created"}, }, { Key: "verification", Type: "wait_for_event", Config: map[string]any{ "event_name": "email.verified", "timeout": "1 day", }, }, }, Connections: []senddart.AutomationConnectionInput{ {From: "start", To: "verification", Type: "default"}, }, }) ``` **Rust** ```rust use senddart::{AutomationStepInput, ConnectionInput, CreateAutomationOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateAutomationOptions::new("Verification reminder", "yourdomain.com") .with_step(AutomationStepInput::new("trigger") .with_key("start") .with_config(serde_json::json!({"event_name":"user.created"}))) .with_step(AutomationStepInput::new("wait_for_event") .with_key("verification") .with_config(serde_json::json!({"event_name":"email.verified","timeout":"1 day"}))) .with_connection(ConnectionInput::new("start", "verification").with_type("default")); let _automation = mb.automations.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationConnection; import com.senddart.requests.AutomationStep; import com.senddart.requests.CreateAutomationRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateAutomationRequest request = CreateAutomationRequest.builder() .name("Verification reminder") .domain("yourdomain.com") .step(AutomationStep.builder() .key("start") .type("trigger") .config("event_name", "user.created") .build()) .step(AutomationStep.builder() .key("verification") .type("wait_for_event") .config("event_name", "email.verified") .config("timeout", "1 day") .build()) .connection(AutomationConnection.of("start", "verification", "default")) .build(); SendDartResponse response = senddart.automations().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationCreateAsync(new AutomationCreateOptions { Name = "Verification reminder", Domain = "yourdomain.com", Steps = new List { new() { Key = "start", Type = "trigger", Config = new Dictionary { ["event_name"] = "user.created", }, }, new() { Key = "verification", Type = "wait_for_event", Config = new Dictionary { ["event_name"] = "email.verified", ["timeout"] = "1 day", }, }, }, Connections = new List { new() { From = "start", To = "verification", Type = "default", }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Verification reminder", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "verification", "type": "wait_for_event", "config": { "event_name": "email.verified", "timeout": "1 day" } } ], "connections": [ { "from": "start", "to": "verification", "type": "default" } ] }' ``` ## Timeouts When you set a `timeout`, the step stops waiting after that duration, which prevents automations from waiting indefinitely. A wait-for-event step produces two possible connection types so you can branch on whether the event arrived in time: | Connection type | When it is used | | --- | --- | | `event_received` | The event arrived before the timeout. | | `timeout` | The timeout elapsed without receiving the event. | ```json { "key": "payment", "type": "wait_for_event", "config": { "event_name": "payment.completed", "timeout": "3 days" } } ``` > **Warning:** The maximum timeout is **30 days**. ## Filter rules Use `filter_rule` to match only events that meet specific criteria — useful when the same event name is sent with different payloads. The rule is evaluated against the incoming event's payload. For example, to wait specifically for a successful payment: ```json { "key": "payment", "type": "wait_for_event", "config": { "event_name": "payment.completed", "filter_rule": { "type": "rule", "field": "event.status", "operator": "eq", "value": "succeeded" } } } ``` The filter rule supports the same rule shapes and [operators](https://www.senddart.com/docs/automations/condition) as [condition](https://www.senddart.com/docs/automations/condition) steps — including `and`/`or` groups. ## Configuration | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.event_name` | string | Yes | The name of the event to wait for. | | `config.timeout` | string | No | The maximum time to wait before timing out (e.g. `"3 days"`, `"1 hour"`). Maximum: 30 days. | | `config.filter_rule` | object | No | An optional rule object to filter incoming events. Uses the same shape as a condition rule. | --- # Send Email > Send a templated email to the contact as a step in your automation. The **send email** step sends a [template](https://www.senddart.com/docs/templates/overview) email to the contact running through the automation. After adding a [trigger](https://www.senddart.com/docs/automations/trigger), add this step, select a published template, and configure the subject and sender address. Over the API, add a `send_email` step to the `steps` array. See [Using automations](https://www.senddart.com/docs/automations/overview) for the wider flow. ## How it works **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "044db673-fff6-420f-a566-f6aba05d60e7" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "044db673-fff6-420f-a566-f6aba05d60e7" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }) ``` **PHP** ```php automations->create([ 'name' => "Welcome series", 'domain' => "yourdomain.com", 'steps' => [ [ 'key' => "start", 'type' => "trigger", 'config' => [ 'event_name' => "user.created" ] ], [ 'key' => "welcome", 'type' => "send_email", 'config' => [ 'template' => [ 'id' => "044db673-fff6-420f-a566-f6aba05d60e7" ] ] ] ], 'connections' => [ [ 'from' => "start", 'to' => "welcome" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "044db673-fff6-420f-a566-f6aba05d60e7" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Create(&senddart.CreateAutomationRequest{ Name: "Welcome series", Domain: "yourdomain.com", Steps: []senddart.AutomationStepInput{ { Key: "start", Type: "trigger", Config: map[string]any{"event_name": "user.created"}, }, { Key: "welcome", Type: "send_email", Config: map[string]any{ "template": map[string]any{"id": "044db673-fff6-420f-a566-f6aba05d60e7"}, }, }, }, Connections: []senddart.AutomationConnectionInput{{From: "start", To: "welcome"}}, }) ``` **Rust** ```rust use senddart::{AutomationStepInput, ConnectionInput, CreateAutomationOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateAutomationOptions::new("Welcome series", "yourdomain.com") .with_step(AutomationStepInput::new("trigger") .with_key("start") .with_config(serde_json::json!({"event_name":"user.created"}))) .with_step(AutomationStepInput::new("send_email") .with_key("welcome") .with_config(serde_json::json!({ "template": { "id": "044db673-fff6-420f-a566-f6aba05d60e7" } }))) .with_connection(ConnectionInput::new("start", "welcome")); let _automation = mb.automations.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationConnection; import com.senddart.requests.AutomationStep; import com.senddart.requests.CreateAutomationRequest; import java.util.Map; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateAutomationRequest request = CreateAutomationRequest.builder() .name("Welcome series") .domain("yourdomain.com") .step(AutomationStep.builder() .key("start") .type("trigger") .config("event_name", "user.created") .build()) .step(AutomationStep.builder() .key("welcome") .type("send_email") .config("template", Map.of("id", "044db673-fff6-420f-a566-f6aba05d60e7")) .build()) .connection(AutomationConnection.of("start", "welcome")) .build(); SendDartResponse response = senddart.automations().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationCreateAsync(new AutomationCreateOptions { Name = "Welcome series", Domain = "yourdomain.com", Steps = new List { new() { Key = "start", Type = "trigger", Config = new Dictionary { ["event_name"] = "user.created", }, }, new() { Key = "welcome", Type = "send_email", Config = new Dictionary { ["template"] = new Dictionary { ["id"] = "044db673-fff6-420f-a566-f6aba05d60e7", }, }, }, }, Connections = new List { new() { From = "start", To = "welcome" }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "044db673-fff6-420f-a566-f6aba05d60e7" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }' ``` > **Note:** Only **published** templates can be used in an automation. ## Template variables Use the `variables` field to pass data into your template. Each value can be a dynamic reference or a static string. | Type | Format | Description | | --- | --- | --- | | Event data | `{ "var": "event." }` | Resolves a field from the triggering event's payload. | | Contact data | `{ "var": "contact." }` | Resolves a field from the contact record. | | Waited event data | `{ "var": "wait_events.." }` | Resolves a field from a preceding [wait for event](https://www.senddart.com/docs/automations/wait-for-event) step's payload. | | Static value | `""` | Passed as-is to the template. | ```json { "key": "welcome", "type": "send_email", "config": { "template": { "id": "044db673-fff6-420f-a566-f6aba05d60e7", "variables": { "firstName": { "var": "event.firstName" }, "orderNumber": { "var": "event.orderId" }, "total": { "var": "event.amount" }, "company": { "var": "contact.properties.company" }, "feedback": { "var": "wait_events.feedback.received.response" }, "supportEmail": "help@example.com" } } } } ``` Template variables must exist in your referenced template and the key names must match the template variable names exactly. > **Note:** If a branch has multiple [wait for event](https://www.senddart.com/docs/automations/wait-for-event) steps with the same key, the resolved data comes from the last event received before the current step. ## Configuration | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.template` | object | Yes | The published template to send. Provide `id` and optionally `variables`. | | `config.template.id` | string | Yes | The ID or alias of the template to send. | | `config.template.variables` | object | No | A key/value map of template variables. Each value is a static string or a variable reference (`{ "var": "event.field" }`) resolved from the `event.*`, `contact.*`, or `wait_events.*` namespaces. | | `config.from` | string | No | The sender email address. Overrides the template default when provided. | | `config.subject` | string | No | The email subject line. Overrides the template default when provided. | | `config.reply_to` | string | No | The reply-to email address. Overrides the template default when provided. | ```json { "key": "welcome", "type": "send_email", "config": { "template": { "id": "062f8ef4-fbfa-44f1-b5e0-ff8e1e8ffa96", "variables": { "name": { "var": "event.firstName" } } }, "from": "hello@yourdomain.com", "subject": "Welcome!", "reply_to": "support@yourdomain.com" } } ``` --- # Add to Segment > Add the current contact to a segment as a step in your automation. The **add to segment** step adds the current contact to a specified [segment](https://www.senddart.com/docs/segments/overview) when the automation reaches it. See [Using automations](https://www.senddart.com/docs/automations/overview) for the surrounding workflow. Common use cases: - **Cohorts** — add contacts to a cohort segment after a specific event. - **Lifecycle** — segment contacts as they progress through onboarding. - **Engagement** — group contacts who completed a specific action. ## How it works In the dashboard, add an **Add to segment** step and select the segment from the dropdown. Over the API, the `add_to_segment` step accepts a single `segment_id` field. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.create({ "name": "Tag VIP users", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "purchase.completed" } }, { "key": "vip_users", "type": "add_to_segment", "config": { "segment_id": "83a1e324-26dc-47eb-9b28-ba8b6d1fe808" } } ], "connections": [ { "from": "start", "to": "vip_users", "type": "default" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.create({ "name": "Tag VIP users", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "purchase.completed" } }, { "key": "vip_users", "type": "add_to_segment", "config": { "segment_id": "83a1e324-26dc-47eb-9b28-ba8b6d1fe808" } } ], "connections": [ { "from": "start", "to": "vip_users", "type": "default" } ] }) ``` **PHP** ```php automations->create([ 'name' => "Tag VIP users", 'domain' => "yourdomain.com", 'steps' => [ [ 'key' => "start", 'type' => "trigger", 'config' => [ 'event_name' => "purchase.completed" ] ], [ 'key' => "vip_users", 'type' => "add_to_segment", 'config' => [ 'segment_id' => "83a1e324-26dc-47eb-9b28-ba8b6d1fe808" ] ] ], 'connections' => [ [ 'from' => "start", 'to' => "vip_users", 'type' => "default" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.create({ "name": "Tag VIP users", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "purchase.completed" } }, { "key": "vip_users", "type": "add_to_segment", "config": { "segment_id": "83a1e324-26dc-47eb-9b28-ba8b6d1fe808" } } ], "connections": [ { "from": "start", "to": "vip_users", "type": "default" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Create(&senddart.CreateAutomationRequest{ Name: "Tag VIP users", Domain: "yourdomain.com", Steps: []senddart.AutomationStepInput{ { Key: "start", Type: "trigger", Config: map[string]any{"event_name": "purchase.completed"}, }, { Key: "vip_users", Type: "add_to_segment", Config: map[string]any{ "segment_id": "83a1e324-26dc-47eb-9b28-ba8b6d1fe808", }, }, }, Connections: []senddart.AutomationConnectionInput{ {From: "start", To: "vip_users", Type: "default"}, }, }) ``` **Rust** ```rust use senddart::{AutomationStepInput, ConnectionInput, CreateAutomationOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateAutomationOptions::new("Tag VIP users", "yourdomain.com") .with_step(AutomationStepInput::new("trigger") .with_key("start") .with_config(serde_json::json!({"event_name":"purchase.completed"}))) .with_step(AutomationStepInput::new("add_to_segment") .with_key("vip_users") .with_config(serde_json::json!({"segment_id":"83a1e324-26dc-47eb-9b28-ba8b6d1fe808"}))) .with_connection(ConnectionInput::new("start", "vip_users").with_type("default")); let _automation = mb.automations.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationConnection; import com.senddart.requests.AutomationStep; import com.senddart.requests.CreateAutomationRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateAutomationRequest request = CreateAutomationRequest.builder() .name("Tag VIP users") .domain("yourdomain.com") .step(AutomationStep.builder() .key("start") .type("trigger") .config("event_name", "purchase.completed") .build()) .step(AutomationStep.builder() .key("vip_users") .type("add_to_segment") .config("segment_id", "83a1e324-26dc-47eb-9b28-ba8b6d1fe808") .build()) .connection(AutomationConnection.of("start", "vip_users", "default")) .build(); SendDartResponse response = senddart.automations().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationCreateAsync(new AutomationCreateOptions { Name = "Tag VIP users", Domain = "yourdomain.com", Steps = new List { new() { Key = "start", Type = "trigger", Config = new Dictionary { ["event_name"] = "purchase.completed", }, }, new() { Key = "vip_users", Type = "add_to_segment", Config = new Dictionary { ["segment_id"] = "83a1e324-26dc-47eb-9b28-ba8b6d1fe808", }, }, }, Connections = new List { new() { From = "start", To = "vip_users", Type = "default", }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Tag VIP users", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "purchase.completed" } }, { "key": "vip_users", "type": "add_to_segment", "config": { "segment_id": "83a1e324-26dc-47eb-9b28-ba8b6d1fe808" } } ], "connections": [ { "from": "start", "to": "vip_users", "type": "default" } ] }' ``` ## Configuration | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.segment_id` | string | Yes | The ID of the segment to add the contact to. | ```json { "key": "add_to_vip", "type": "add_to_segment", "config": { "segment_id": "83a1e324-26dc-47eb-9b28-ba8b6d1fe808" } } ``` --- # Contact Update > Update a contact's name, subscription status, or custom properties during an automation. The **contact update** step modifies the current contact's fields as the automation runs. You can update the contact's name, subscription status, or custom properties. See [Using automations](https://www.senddart.com/docs/automations/overview) for the surrounding workflow. Common use cases: - **Enrich profiles** — copy event data into the contact record. - **Set flags** — mark contacts as VIP or churned based on their activity. - **Sync properties** — keep custom properties up to date as events flow in. ## How it works Add a `contact_update` step to the `steps` array and set the fields you want to change. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.create({ "name": "Enrich contact on signup", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "update", "type": "contact_update", "config": { "first_name": { "var": "event.firstName" }, "last_name": { "var": "event.lastName" }, "properties": { "company": { "var": "event.company" }, "vip": true } } } ], "connections": [ { "from": "start", "to": "update", "type": "default" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.create({ "name": "Enrich contact on signup", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "update", "type": "contact_update", "config": { "first_name": { "var": "event.firstName" }, "last_name": { "var": "event.lastName" }, "properties": { "company": { "var": "event.company" }, "vip": true } } } ], "connections": [ { "from": "start", "to": "update", "type": "default" } ] }) ``` **PHP** ```php automations->create([ 'name' => "Enrich contact on signup", 'domain' => "yourdomain.com", 'steps' => [ [ 'key' => "start", 'type' => "trigger", 'config' => [ 'event_name' => "user.created" ] ], [ 'key' => "update", 'type' => "contact_update", 'config' => [ 'first_name' => [ 'var' => "event.firstName" ], 'last_name' => [ 'var' => "event.lastName" ], 'properties' => [ 'company' => [ 'var' => "event.company" ], 'vip' => true ] ] ] ], 'connections' => [ [ 'from' => "start", 'to' => "update", 'type' => "default" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.create({ "name": "Enrich contact on signup", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "update", "type": "contact_update", "config": { "first_name": { "var": "event.firstName" }, "last_name": { "var": "event.lastName" }, "properties": { "company": { "var": "event.company" }, "vip": True } } } ], "connections": [ { "from": "start", "to": "update", "type": "default" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Create(&senddart.CreateAutomationRequest{ Name: "Enrich contact on signup", Domain: "yourdomain.com", Steps: []senddart.AutomationStepInput{ { Key: "start", Type: "trigger", Config: map[string]any{"event_name": "user.created"}, }, { Key: "update", Type: "contact_update", Config: map[string]any{ "first_name": map[string]any{"var": "event.firstName"}, "last_name": map[string]any{"var": "event.lastName"}, "properties": map[string]any{ "company": map[string]any{"var": "event.company"}, "vip": true, }, }, }, }, Connections: []senddart.AutomationConnectionInput{ {From: "start", To: "update", Type: "default"}, }, }) ``` **Rust** ```rust use senddart::{AutomationStepInput, ConnectionInput, CreateAutomationOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateAutomationOptions::new("Enrich contact on signup", "yourdomain.com") .with_step(AutomationStepInput::new("trigger") .with_key("start") .with_config(serde_json::json!({"event_name":"user.created"}))) .with_step(AutomationStepInput::new("contact_update") .with_key("update") .with_config(serde_json::json!({ "first_name": { "var": "event.firstName" }, "last_name": { "var": "event.lastName" }, "properties": { "company": { "var": "event.company" }, "vip": true } }))) .with_connection(ConnectionInput::new("start", "update").with_type("default")); let _automation = mb.automations.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationConnection; import com.senddart.requests.AutomationStep; import com.senddart.requests.CreateAutomationRequest; import java.util.Map; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateAutomationRequest request = CreateAutomationRequest.builder() .name("Enrich contact on signup") .domain("yourdomain.com") .step(AutomationStep.builder() .key("start") .type("trigger") .config("event_name", "user.created") .build()) .step(AutomationStep.builder() .key("update") .type("contact_update") .config("first_name", Map.of("var", "event.firstName")) .config("last_name", Map.of("var", "event.lastName")) .config("properties", Map.of( "company", Map.of("var", "event.company"), "vip", true)) .build()) .connection(AutomationConnection.of("start", "update", "default")) .build(); SendDartResponse response = senddart.automations().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationCreateAsync(new AutomationCreateOptions { Name = "Enrich contact on signup", Domain = "yourdomain.com", Steps = new List { new() { Key = "start", Type = "trigger", Config = new Dictionary { ["event_name"] = "user.created", }, }, new() { Key = "update", Type = "contact_update", Config = new Dictionary { ["first_name"] = new Dictionary { ["var"] = "event.firstName", }, ["last_name"] = new Dictionary { ["var"] = "event.lastName", }, ["properties"] = new Dictionary { ["company"] = new Dictionary { ["var"] = "event.company", }, ["vip"] = true, }, }, }, }, Connections = new List { new() { From = "start", To = "update", Type = "default", }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Enrich contact on signup", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "update", "type": "contact_update", "config": { "first_name": { "var": "event.firstName" }, "last_name": { "var": "event.lastName" }, "properties": { "company": { "var": "event.company" }, "vip": true } } } ], "connections": [ { "from": "start", "to": "update", "type": "default" } ] }' ``` ## Dynamic variables Each field value can be a hardcoded value (string, number, boolean) or a dynamic variable reference using the `{ "var": "..." }` syntax. Variable references use dot-notation with one of these scopes: - `event.*` — references a field from the triggering event payload (e.g. `event.firstName`). - `contact.*` — references a field from the current contact (e.g. `contact.last_name`, `contact.properties.company`). For more on variables, see the [Send Email](https://www.senddart.com/docs/automations/send-email) step documentation. ```json { "key": "update", "type": "contact_update", "config": { "first_name": { "var": "event.firstName" }, "last_name": { "var": "event.lastName" }, "properties": { "company": { "var": "event.company" }, "vip": true } } } ``` ## Configuration | Name | Type | Required | Description | | --- | --- | --- | --- | | `config.first_name` | string | object | No | The contact's first name. Accepts a hardcoded string or a variable reference. | | `config.last_name` | string | object | No | The contact's last name. Accepts a hardcoded string or a variable reference. | | `config.unsubscribed` | boolean | object | No | The contact's unsubscribed status. Accepts a boolean or a variable reference. | | `config.properties` | object | No | A map of custom contact properties to update. Keys correspond to your [contact properties](https://www.senddart.com/docs/audiences/properties). Each value is a hardcoded value or a variable reference. | --- # Contact Delete > Remove the contact that triggered the automation from its audience. The **contact delete** step removes the contact that triggered the automation from its [audience](https://www.senddart.com/docs/audiences/overview). Once deleted, the contact no longer receives emails from that audience and any remaining steps in the run are skipped. See [Using automations](https://www.senddart.com/docs/automations/overview) for the surrounding workflow. Common use cases: - **Compliance** — delete contacts as part of a data-removal workflow. - **Churn** — remove a contact when a user stops using your service. - **Unsubscribe flows** — automatically remove contacts who opt out. ## How it works In the dashboard, add the **Delete contact** step — no configuration is required; it is ready as soon as you add it. Over the API, add a `contact_delete` step with an empty `config` object. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.create({ "name": "Remove churned users", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.deleted" } }, { "key": "remove", "type": "contact_delete", "config": {} } ], "connections": [ { "from": "start", "to": "remove", "type": "default" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.create({ "name": "Remove churned users", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.deleted" } }, { "key": "remove", "type": "contact_delete", "config": {} } ], "connections": [ { "from": "start", "to": "remove", "type": "default" } ] }) ``` **PHP** ```php automations->create([ 'name' => "Remove churned users", 'domain' => "yourdomain.com", 'steps' => [ [ 'key' => "start", 'type' => "trigger", 'config' => [ 'event_name' => "user.deleted" ] ], [ 'key' => "remove", 'type' => "contact_delete", 'config' => [] ] ], 'connections' => [ [ 'from' => "start", 'to' => "remove", 'type' => "default" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.create({ "name": "Remove churned users", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.deleted" } }, { "key": "remove", "type": "contact_delete", "config": {} } ], "connections": [ { "from": "start", "to": "remove", "type": "default" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Create(&senddart.CreateAutomationRequest{ Name: "Remove churned users", Domain: "yourdomain.com", Steps: []senddart.AutomationStepInput{ { Key: "start", Type: "trigger", Config: map[string]any{"event_name": "user.deleted"}, }, {Key: "remove", Type: "contact_delete", Config: map[string]any{}}, }, Connections: []senddart.AutomationConnectionInput{ {From: "start", To: "remove", Type: "default"}, }, }) ``` **Rust** ```rust use senddart::{AutomationStepInput, ConnectionInput, CreateAutomationOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateAutomationOptions::new("Remove churned users", "yourdomain.com") .with_step(AutomationStepInput::new("trigger") .with_key("start") .with_config(serde_json::json!({"event_name":"user.deleted"}))) .with_step(AutomationStepInput::new("contact_delete") .with_key("remove") .with_config(serde_json::json!({}))) .with_connection(ConnectionInput::new("start", "remove").with_type("default")); let _automation = mb.automations.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationConnection; import com.senddart.requests.AutomationStep; import com.senddart.requests.CreateAutomationRequest; import java.util.Map; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateAutomationRequest request = CreateAutomationRequest.builder() .name("Remove churned users") .domain("yourdomain.com") .step(AutomationStep.builder() .key("start") .type("trigger") .config("event_name", "user.deleted") .build()) .step(AutomationStep.builder() .key("remove") .type("contact_delete") .config(Map.of()) .build()) .connection(AutomationConnection.of("start", "remove", "default")) .build(); SendDartResponse response = senddart.automations().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationCreateAsync(new AutomationCreateOptions { Name = "Remove churned users", Domain = "yourdomain.com", Steps = new List { new() { Key = "start", Type = "trigger", Config = new Dictionary { ["event_name"] = "user.deleted", }, }, new() { Key = "remove", Type = "contact_delete", Config = new Dictionary(), }, }, Connections = new List { new() { From = "start", To = "remove", Type = "default", }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Remove churned users", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.deleted" } }, { "key": "remove", "type": "contact_delete", "config": {} } ], "connections": [ { "from": "start", "to": "remove", "type": "default" } ] }' ``` > **Warning:** Deleting a contact is **permanent**. The contact and all of its properties are removed from the audience. If the contact needs to be re-added later, it must be created again. ## Configuration The `config` object is empty — no additional fields are required. ```json { "key": "remove_contact", "type": "contact_delete", "config": {} } ``` --- # Custom Events > Define custom events to trigger automations. Custom events are used to [trigger](https://www.senddart.com/docs/automations/trigger) automations and can be defined with an optional schema for payload validation. If a schema is defined, payloads are validated when the event is sent. Fields that don't match the expected type are rejected with a `422` error and the event is not delivered. ## How it works In the dashboard, the **Events** page shows all existing events. Click **Add event**, enter the event name and an optional schema to define the event payload you will send with the event, then **Save**. Over the API, all existing events can be retrieved with the [List Events API](https://www.senddart.com/docs/api/events-list). To create a new event, use the [Create Event API](https://www.senddart.com/docs/api/events-create). **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.events.create({ "name": "user.created", "schema": { "plan": "string" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Events.create({ "name": "user.created", "schema": { "plan": "string" } }) ``` **PHP** ```php events->create([ 'name' => "user.created", 'schema' => [ 'plan' => "string" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Events.create({ "name": "user.created", "schema": { "plan": "string" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") definition, err := client.Events.Create(&senddart.CreateEventRequest{ Name: "user.created", Schema: map[string]string{"plan": "string"}, }) ``` **Rust** ```rust use senddart::{CreateEventOptions, EventFieldType, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateEventOptions::new("user.created") .with_schema_field("plan", EventFieldType::String); let _definition = mb.events.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateEventRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateEventRequest request = CreateEventRequest.builder() .name("user.created") .schema("plan", "string") .build(); SendDartResponse response = senddart.events().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EventCreateAsync(new EventCreateOptions { Name = "user.created", Schema = new Dictionary { ["plan"] = "string" }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/events' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "user.created", "schema": { "plan": "string" } }' ``` **CLI** ```bash senddart events create \ --name 'user.created' \ --schema '{"plan":"string"}' ``` **Response** ```json { "object": "event", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "name": "user.created", "schema": { "plan": "string" }, "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:00:00.000Z" } ``` > **Note:** The event name can be any string (e.g. `user.created`, `welcome`, `my-custom-event`). Dot notation is a recommended convention but is not required. If multiple enabled automations use the same event name, **all** of them will be triggered. ## Sending events Trigger your automations by sending an event with [`POST /events/send`](https://www.senddart.com/docs/api/events-send). Name the `domain` the event belongs to (only that domain's automations fire), identify the contact by `contact_id` or `email`, and optionally attach a `payload` object — its fields become available as `event.*` variables in templates, [conditions](https://www.senddart.com/docs/automations/condition), and other steps. See [Trigger](https://www.senddart.com/docs/automations/trigger) for details. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.events.send({ "event": "user.created", "domain": "yourdomain.com", "contact_id": "479e3145-dd38-476b-932c-529ceb705947", "payload": { "plan": "pro" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Events.send({ "event": "user.created", "domain": "yourdomain.com", "contact_id": "479e3145-dd38-476b-932c-529ceb705947", "payload": { "plan": "pro" } }) ``` **PHP** ```php events->send([ 'event' => "user.created", 'domain' => "yourdomain.com", 'contact_id' => "479e3145-dd38-476b-932c-529ceb705947", 'payload' => [ 'plan' => "pro" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Events.send({ "event": "user.created", "domain": "yourdomain.com", "contact_id": "479e3145-dd38-476b-932c-529ceb705947", "payload": { "plan": "pro" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") event, err := client.Events.Send(&senddart.SendEventRequest{ Event: "user.created", Domain: "yourdomain.com", ContactId: "479e3145-dd38-476b-932c-529ceb705947", Payload: map[string]any{"plan": "pro"}, }) ``` **Rust** ```rust use senddart::{SendDart, SendEventOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEventOptions::new("user.created", "yourdomain.com") .with_contact_id("479e3145-dd38-476b-932c-529ceb705947") .with_payload_entry("plan", serde_json::json!("pro")); let _event = mb.events.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEventRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEventRequest request = SendEventRequest.builder() .event("user.created") .domain("yourdomain.com") .contactId("479e3145-dd38-476b-932c-529ceb705947") .payload("plan", "pro") .build(); SendDartResponse response = senddart.events().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EventSendAsync(new EventSendOptions { Event = "user.created", Domain = "yourdomain.com", ContactId = "479e3145-dd38-476b-932c-529ceb705947", Payload = new Dictionary { ["plan"] = "pro" }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/events/send' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "event": "user.created", "domain": "yourdomain.com", "contact_id": "479e3145-dd38-476b-932c-529ceb705947", "payload": { "plan": "pro" } }' ``` **CLI** ```bash senddart events send \ --name 'user.created' \ --domain 'yourdomain.com' \ --contact-id '479e3145-dd38-476b-932c-529ceb705947' \ --data '{"plan":"pro"}' ``` ## Configuration | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | Yes | The name of the custom event to create. Used to match events to automation triggers. Cannot start with the `senddart:` prefix, which is reserved for system events. | | `schema` | object | No | An optional schema definition for the event payload. Must be an object with flat key/type pairs. Supported types: `string`, `number`, `boolean`, `date`. | **Example** ```json { "schema": { "plan": "string", "amount": "number", "date": "date", "is_active": "boolean" } } ``` > **Warning:** Event names cannot start with the `senddart:` prefix, which is reserved for system events. Creating a definition with a name that already exists returns a `validation_error`. --- # Connections > Connections between steps in automation workflows. ## How it works Connections are the code definitions for the links between [steps](https://www.senddart.com/docs/automations/steps) in the automation graph and are defined and retrieved using the API. If creating an automation via the API, define connections as an array of objects. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }) ``` **PHP** ```php automations->create([ 'name' => "Welcome series", 'domain' => "yourdomain.com", 'steps' => [ [ 'key' => "start", 'type' => "trigger", 'config' => [ 'event_name' => "user.created" ] ], [ 'key' => "welcome", 'type' => "send_email", 'config' => [ 'template' => [ 'id' => "34a080c9-b17d-4187-ad80-5af20266e535" ] ] ] ], 'connections' => [ [ 'from' => "start", 'to' => "welcome" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Create(&senddart.CreateAutomationRequest{ Name: "Welcome series", Domain: "yourdomain.com", Steps: []senddart.AutomationStepInput{ { Key: "start", Type: "trigger", Config: map[string]any{"event_name": "user.created"}, }, { Key: "welcome", Type: "send_email", Config: map[string]any{ "template": map[string]any{"id": "34a080c9-b17d-4187-ad80-5af20266e535"}, }, }, }, Connections: []senddart.AutomationConnectionInput{{From: "start", To: "welcome"}}, }) ``` **Rust** ```rust use senddart::{AutomationStepInput, ConnectionInput, CreateAutomationOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateAutomationOptions::new("Welcome series", "yourdomain.com") .with_step(AutomationStepInput::new("trigger") .with_key("start") .with_config(serde_json::json!({"event_name":"user.created"}))) .with_step(AutomationStepInput::new("send_email") .with_key("welcome") .with_config(serde_json::json!({ "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } }))) .with_connection(ConnectionInput::new("start", "welcome")); let _automation = mb.automations.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationConnection; import com.senddart.requests.AutomationStep; import com.senddart.requests.CreateAutomationRequest; import java.util.Map; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateAutomationRequest request = CreateAutomationRequest.builder() .name("Welcome series") .domain("yourdomain.com") .step(AutomationStep.builder() .key("start") .type("trigger") .config("event_name", "user.created") .build()) .step(AutomationStep.builder() .key("welcome") .type("send_email") .config("template", Map.of("id", "34a080c9-b17d-4187-ad80-5af20266e535")) .build()) .connection(AutomationConnection.of("start", "welcome")) .build(); SendDartResponse response = senddart.automations().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationCreateAsync(new AutomationCreateOptions { Name = "Welcome series", Domain = "yourdomain.com", Steps = new List { new() { Key = "start", Type = "trigger", Config = new Dictionary { ["event_name"] = "user.created", }, }, new() { Key = "welcome", Type = "send_email", Config = new Dictionary { ["template"] = new Dictionary { ["id"] = "34a080c9-b17d-4187-ad80-5af20266e535", }, }, }, }, Connections = new List { new() { From = "start", To = "welcome" }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }' ``` When retrieving automations, the API returns the connections as an array. **Response** ```json { "object": "automation", "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "domain": "yourdomain.com", "name": "Welcome series", "trigger": "user.created", "status": "disabled", "created_at": "2026-10-01T12:00:00.000Z", "updated_at": "2026-10-01T12:00:00.000Z", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "key": "welcome", "type": "send_email", "position": 0, "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome", "type": "default" } ] } ``` > **Note:** Connections must form an acyclic graph — cyclic graphs are rejected. Editing connections requires the automation to be **disabled**. ## Connection properties Connections define the links between steps in the automation graph. | Name | Type | Required | Description | | --- | --- | --- | --- | | `from` | string | Yes | This is the `key` of the origin step. | | `to` | string | Yes | This is the `key` of the destination step. | | `type` | string | No | The type of connection between the origin and destination steps. Most automations use the default connection type. Use a non-default `type` only when the origin step can branch to multiple destinations: for [wait_for_event](https://www.senddart.com/docs/automations/wait-for-event), use `event_received` or `timeout`; for [condition](https://www.senddart.com/docs/automations/condition), use `condition_met` or `condition_not_met`. Possible values: `default`, `condition_met`, `condition_not_met`, `timeout`, `event_received`. | **Example** ```json { "from": "start", "to": "welcome", "type": "default" } ``` --- # Runs > Monitor and debug your automation executions. Every time an event [triggers](https://www.senddart.com/docs/automations/trigger) an automation, SendDart creates a **run**. A run tracks the execution of each step in the workflow, including its status and timing, along with any errors. ## How it works Each run has one of the following statuses: | Status | Description | | --- | --- | | `running` | The automation is currently executing steps. | | `completed` | All steps finished successfully. | | `failed` | A step encountered an error and the run stopped. | | `skipped` | The run ended on a Send Email step that was skipped because the contact has unsubscribed. | ### Skipped steps When a contact unsubscribes, any remaining [Send Email](https://www.senddart.com/docs/automations/send-email) steps in the automation will be skipped automatically. Other step types (such as Delay, Condition, or Contact Update) will still be executed as normal. ## Listing runs In the dashboard, select an automation to view its runs — each run shows its **status**, when it **started**, and its **duration**. Over the API, list all runs for an automation with `GET /automations/:id/runs`. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.runs('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **PHP** ```php automations->runs('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") runs, err := client.Automations.Runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _runs = mb.automations.runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationListRunsAsync("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/runs' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart automations runs c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd ``` **Response** ```json { "object": "list", "has_more": false, "data": [ { "object": "automation_run", "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "contact_id": "26e2b838-bf6d-4515-b6a7-17525b12b05a", "contact_email": "jordan@acme.com", "status": "completed", "started_at": "2026-10-01T12:00:00.000Z", "completed_at": "2026-10-01T12:05:00.000Z", "created_at": "2026-10-01T12:00:00.000Z" } ] } ``` View the [List Automation Runs API reference](https://www.senddart.com/docs/api/automations-list-runs) for more details. ## Filtering runs by status You can filter runs by status to find specific executions. Over the API, filter by multiple statuses using a comma-separated list. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.runs('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', { status: 'running,completed' }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", { "status": "running,completed" }) ``` **PHP** ```php automations->runs('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', [ 'status' => "running,completed" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", { "status": "running,completed" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") runs, err := client.Automations.RunsFiltered("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", &senddart.ListAutomationRunsRequest{ Status: []string{"running", "completed"}, }) ``` **Rust** ```rust use senddart::{ListAutomationRunsParams, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = Some(ListAutomationRunsParams::new().with_status(["running", "completed"])); let _runs = mb.automations.runs_filtered("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.ListAutomationRunsParams; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().runs( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", ListAutomationRunsParams.builder().status("running", "completed").build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationListRunsAsync("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", new AutomationRunListOptions { Status = new[] { "running", "completed" }, }); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/runs?status=running,completed' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart automations runs c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd \ --status 'running,completed' ``` ## Viewing a single run In the dashboard, click on a run to view its details and select the step you want to debug. Over the API, retrieve the full details of one run — including the `steps` array — with `GET /automations/:id/runs/:runId`. The first entry in `steps` is the trigger step. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.getRun('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.get_run("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890") ``` **PHP** ```php automations->getRun('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.get_run("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") run, err := client.Automations.GetRun("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _run = mb.automations.get_run("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().getRun( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationRetrieveRunAsync( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/runs/a1b2c3d4-e5f6-7890-abcd-ef1234567890' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart automations run c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd a1b2c3d4-e5f6-7890-abcd-ef1234567890 ``` **Response** ```json { "object": "automation_run", "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "automation_id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "contact_id": "26e2b838-bf6d-4515-b6a7-17525b12b05a", "contact_email": "jordan@acme.com", "status": "completed", "error": null, "started_at": "2026-10-01T12:00:00.000Z", "completed_at": "2026-10-01T12:05:00.000Z", "created_at": "2026-10-01T12:00:00.000Z", "steps": [ { "key": "start", "type": "trigger", "status": "completed", "started_at": "2026-10-01T12:00:00.000Z", "completed_at": "2026-10-01T12:00:01.000Z", "output": null, "error": null }, { "key": "welcome", "type": "send_email", "status": "completed", "started_at": "2026-10-01T12:00:01.000Z", "completed_at": "2026-10-01T12:00:02.000Z", "output": { "to": "user@example.com", "email_id": "6278820d-2421-42d0-85f0-80e9e28c1c69", "template": { "id": "caa9851e-e7bf-4a50-a408-56024edc19c0", "variables": null } }, "error": null } ] } ``` Each step in the response includes: | Field | Description | | --- | --- | | `key` | The unique key of the step in the automation graph. | | `type` | The step type (e.g. `trigger`, `send_email`, `delay`). | | `status` | The step's execution status: `completed`, `failed`, or `skipped`. | | `started_at` | When the step started executing. | | `completed_at` | When the step finished. | | `output` | Output data from the step (if any). | | `error` | Error details if the step failed. | View the [Retrieve Automation Run API reference](https://www.senddart.com/docs/api/automations-get-run) for more details. ## Debugging failed runs When a run fails, use the step-level details to identify the issue: 1. **List failed runs** — filter runs by `status=failed` to find problematic executions. 2. **Retrieve the run** — get the full run details, including the `steps` array. 3. **Find the failed step** — look for the step with a `failed` status. 4. **Check the error** — the `error` field on the failed step contains details about what went wrong. Common failure scenarios: - **Condition error** — a referenced field may not exist in the event payload. See [Condition](https://www.senddart.com/docs/automations/condition) for how conditions are evaluated. - **Wait for event timeout** — the expected event was not received within the timeout window. See [Wait for Event](https://www.senddart.com/docs/automations/wait-for-event). - **Send email failed** — the template may not be published, or the sender address may not be verified. See [Send Email](https://www.senddart.com/docs/automations/send-email). ## Stopping an automation In the dashboard, click the **Stop** button to stop an automation. Over the API, stop it with `POST /automations/:id/stop` — this sets the status to `disabled`. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.stop('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **PHP** ```php automations->stop('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _automation = mb.automations.stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationStopAsync("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/stop' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart automations stop c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd ``` > **Note:** Stopping an automation prevents new runs from being created. Existing in-progress runs will continue to completion. View the [Stop Automation API reference](https://www.senddart.com/docs/api/automations-stop) for more details. ## Viewing metrics In the dashboard, you can view overall metrics for any automation. In the **Observability** panel for any automation, select **Metrics**. > **Note:** The API currently does not support fetching metrics for an automation. --- # Templates > Save reusable email content and render it with variables at send time. A **template** is reusable email content — a name plus an optional `subject`, `html`, and `text` body. Instead of hard-coding the same markup in your app, save it once as a template and reference it by `id` when you send. Templates support `{{ variable }}` placeholders that you fill per send. ## Create a template Create templates from the dashboard (**Templates → New**) or via the API. Provide a `name` and at least one of `html` or `text`; `subject` is optional but recommended. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.templates.create({ "name": "Welcome email", "subject": "Welcome, {{first_name}}!", "html": "

Hi {{first_name}} 👋

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Templates.create({ "name": "Welcome email", "subject": "Welcome, {{first_name}}!", "html": "

Hi {{first_name}} 👋

" }) ``` **PHP** ```php templates->create([ 'name' => "Welcome email", 'subject' => "Welcome, {{first_name}}!", 'html' => "

Hi {{first_name}} 👋

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Templates.create({ "name": "Welcome email", "subject": "Welcome, {{first_name}}!", "html": "

Hi {{first_name}} 👋

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") template, err := client.Templates.Create(&senddart.CreateTemplateRequest{ Name: "Welcome email", Subject: "Welcome, {{first_name}}!", Html: "

Hi {{first_name}} 👋

", }) ``` **Rust** ```rust use senddart::{CreateTemplateOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateTemplateOptions::new("Welcome email") .with_subject("Welcome, {{first_name}}!") .with_html("

Hi {{first_name}} 👋

"); let _template = mb.templates.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateTemplateRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateTemplateRequest request = CreateTemplateRequest.builder() .name("Welcome email") .subject("Welcome, {{first_name}}!") .html("

Hi {{first_name}} 👋

") .build(); SendDartResponse response = senddart.templates().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TemplateCreateAsync(new TemplateCreateOptions { Name = "Welcome email", Subject = "Welcome, {{first_name}}!", HtmlBody = "

Hi {{first_name}} 👋

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/templates' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Welcome email", "subject": "Welcome, {{first_name}}!", "html": "

Hi {{first_name}} 👋

" }' ``` **CLI** ```bash senddart templates create \ --name 'Welcome email' \ --subject 'Welcome, {{first_name}}!' \ --html '

Hi {{first_name}} 👋

' ``` ## Variables Anywhere in the `subject`, `html`, or `text`, write `{{ key }}` and pass matching `variables` when sending. Whitespace inside the braces is ignored, so `{{first_name}}` and `{{ first_name }}` are equivalent. Unknown placeholders render as an empty string, so a recipient never sees a raw `{{ ... }}` tag. A template may contain up to **50 variables**. We recommend capitalizing keys (e.g. `PRODUCT_NAME`). Each variable can declare a `type` of `string` or `number` and an optional `fallback_value` — the value used when you don't supply one at send time. If a variable has no fallback and you omit its value, the send fails with a validation error. > **Warning:** These variable names are reserved and cannot be used: `FIRST_NAME`, `LAST_NAME`, `EMAIL`, `UNSUBSCRIBE_URL`, `contact`, `this`. > **Note:** Variables are simple string substitution — there is no logic (no conditionals or loops). For per-recipient marketing merge tags in bulk sends, see [Campaigns](https://www.senddart.com/docs/campaigns/managing). ## Next - [Publish a template](https://www.senddart.com/docs/api/templates-publish) — required before any send can use it. - [Send with a template](https://www.senddart.com/docs/templates/sending) — use a template in `POST /emails`. - [Create template (API)](https://www.senddart.com/docs/api/templates-create) — full API reference. --- # Send with a template > Reference a saved template from POST /emails and fill its variables. To send an email from a template, pass `template_id` (and any `variables`) to `POST /emails` instead of inline `html`/`text`. SendDart loads the template, substitutes the variables, and sends the result. Everything else about the send — `from`, `to`, attachments, scheduling, tracking — works exactly as a normal send. > **Warning:** The template must be **published** first. Sends always read the published snapshot, so a template that is still a `draft` (which is what [`POST /templates`](https://www.senddart.com/docs/api/templates-create) creates) returns a `validation_error` reading *"Template ... has not been published. Publish it before sending."* Call [`POST /templates/:id/publish`](https://www.senddart.com/docs/api/templates-publish) once before your first send, and again after every edit you want live. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "template_id": "43f68331-0622-4e15-8202-246a0388854b", "variables": { "first_name": "Ada", "company": "Acme" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "template_id": "43f68331-0622-4e15-8202-246a0388854b", "variables": { "first_name": "Ada", "company": "Acme" } }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'template_id' => "43f68331-0622-4e15-8202-246a0388854b", 'variables' => [ 'first_name' => "Ada", 'company' => "Acme" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "template_id": "43f68331-0622-4e15-8202-246a0388854b", "variables": { "first_name": "Ada", "company": "Acme" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, TemplateId: "43f68331-0622-4e15-8202-246a0388854b", Variables: map[string]any{"first_name": "Ada", "company": "Acme"}, }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let email = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "hello world", ).with_html("

it works!

"); let _sent = mb.emails.send(email).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .templateId("43f68331-0622-4e15-8202-246a0388854b") .variable("first_name", "Ada") .variable("company", "Acme") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", TemplateId = "43f68331-0622-4e15-8202-246a0388854b", Variables = new Dictionary { ["first_name"] = "Ada", ["company"] = "Acme", }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "template_id": "43f68331-0622-4e15-8202-246a0388854b", "variables": { "first_name": "Ada", "company": "Acme" } }' ``` ## Overrides Any field you set directly on the request wins over the template. For example, passing `subject` alongside `template_id` uses your subject and the template's body. This lets one template back many variations. The `from`, `subject`, and `reply_to` in the payload take precedence over the template's defaults for these fields; if the template defines no default for one of them, you must supply it in the payload. > **Warning:** When a `template_id` is provided, you cannot also send `html` or `text` in the same request — doing so returns a `validation_error`. ## Variables and fallbacks Each value in `variables` replaces the matching `{{ key }}` placeholder. If you omit a variable that the template defines, its `fallback_value` is used. If that variable has no fallback value, the email is **not** sent and a `validation_error` is returned. > **Warning:** If the resolved email has neither `html` nor `text` (e.g. the template has only a subject and you sent no body), the request fails with `validation_error`. An unpublished template also fails with `validation_error`. A `template_id` that isn't yours — or one that does not exist — returns `not_found`. --- # Working with variables > Define custom variables with types and fallback values on a template, then supply their values when you send. Custom template variables let you reuse one template across many sends and fill in the per-recipient details at send time. You declare each variable on the template — with a `key`, a `type`, and an optional `fallback_value` — and reference it in the body. When you send, SendDart substitutes the values you supply (falling back to the declared default where you do not). ## Declaring variables Reference a variable in the `html` (or `text`) body with triple braces, e.g. `{{{PRODUCT}}}`, and declare it in the `variables` array when you [create the template](https://www.senddart.com/docs/api/templates-create). A template may contain up to **50** variables. **Variable fields** | Name | Type | Required | Description | | --- | --- | --- | --- | | `key` | string | Yes | The variable name referenced in the body. We recommend uppercase (e.g. `PRODUCT_NAME`). | | `type` | string | Yes | Either `string` or `number`. | | `fallback_value` | string | number | No | Used when you do not supply a value at send time. Must match `type`. If omitted, a value is required on every send. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.templates.create({ "name": "order-confirmation", "html": "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

", "variables": [ { "key": "PRODUCT", "type": "string", "fallback_value": "item" }, { "key": "PRICE", "type": "number", "fallback_value": 25 } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Templates.create({ "name": "order-confirmation", "html": "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

", "variables": [ { "key": "PRODUCT", "type": "string", "fallback_value": "item" }, { "key": "PRICE", "type": "number", "fallback_value": 25 } ] }) ``` **PHP** ```php templates->create([ 'name' => "order-confirmation", 'html' => "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

", 'variables' => [ [ 'key' => "PRODUCT", 'type' => "string", 'fallback_value' => "item" ], [ 'key' => "PRICE", 'type' => "number", 'fallback_value' => 25 ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Templates.create({ "name": "order-confirmation", "html": "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

", "variables": [ { "key": "PRODUCT", "type": "string", "fallback_value": "item" }, { "key": "PRICE", "type": "number", "fallback_value": 25 } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") template, err := client.Templates.Create(&senddart.CreateTemplateRequest{ Name: "order-confirmation", Html: "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

", Variables: []senddart.TemplateVariableInput{ {Key: "PRODUCT", Type: "string", FallbackValue: "item"}, {Key: "PRICE", Type: "number", FallbackValue: 25}, }, }) ``` **Rust** ```rust use senddart::{CreateTemplateOptions, SendDart, TemplateVariableInput, TemplateVariableType}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateTemplateOptions::new("order-confirmation") .with_html("

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

") .with_variable(TemplateVariableInput::new("PRODUCT") .with_type(TemplateVariableType::String) .with_fallback_value(serde_json::json!("item"))) .with_variable(TemplateVariableInput::new("PRICE") .with_type(TemplateVariableType::Number) .with_fallback_value(serde_json::json!(25))); let _template = mb.templates.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateTemplateRequest; import com.senddart.requests.TemplateVariable; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateTemplateRequest request = CreateTemplateRequest.builder() .name("order-confirmation") .html("

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

") .variable(TemplateVariable.of("PRODUCT", "string", "item")) .variable(TemplateVariable.of("PRICE", "number", 25)) .build(); SendDartResponse response = senddart.templates().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TemplateCreateAsync(new TemplateCreateOptions { Name = "order-confirmation", HtmlBody = "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

", Variables = new List { new() { Key = "PRODUCT", Type = "string", FallbackValue = "item", }, new() { Key = "PRICE", Type = "number", FallbackValue = 25, }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/templates' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "order-confirmation", "html": "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

", "variables": [ { "key": "PRODUCT", "type": "string", "fallback_value": "item" }, { "key": "PRICE", "type": "number", "fallback_value": 25 } ] }' ``` **CLI** ```bash senddart templates create \ --name 'order-confirmation' \ --html '

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

' \ --variables '[{"key":"PRODUCT","type":"string","fallback_value":"item"},{"key":"PRICE","type":"number","fallback_value":25}]' ``` > **Warning:** These names are reserved and cannot be used as a variable `key`: `FIRST_NAME`, `LAST_NAME`, `EMAIL`, `UNSUBSCRIBE_URL`, `contact`, and `this`. ## Fallback values A fallback value is used whenever you do not pass a value for that variable at send time. If a variable has **no** fallback, you must supply a value on every send or the request is rejected — so set fallbacks for any variable that is not always present. ## Sending with variables To send with a template, reference the **published** template by `id` and pass a `variables` object. Both [POST /emails](https://www.senddart.com/docs/api/emails-send) and [POST /emails/batch](https://www.senddart.com/docs/api/emails-batch) accept a template. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Your order", "template": { "id": "f3b9756c-f4f4-44da-bc00-9f7903c8a83f", "variables": { "PRODUCT": "Laptop" } } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Your order", "template": { "id": "f3b9756c-f4f4-44da-bc00-9f7903c8a83f", "variables": { "PRODUCT": "Laptop" } } }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Your order", 'template' => [ 'id' => "f3b9756c-f4f4-44da-bc00-9f7903c8a83f", 'variables' => [ 'PRODUCT' => "Laptop" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Your order", "template": { "id": "f3b9756c-f4f4-44da-bc00-9f7903c8a83f", "variables": { "PRODUCT": "Laptop" } } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Your order", Template: &senddart.TemplateRef{ Id: "f3b9756c-f4f4-44da-bc00-9f7903c8a83f", Variables: map[string]any{"PRODUCT": "Laptop"}, }, }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions, TemplateRef}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Your order", ) .with_template(TemplateRef::by_id("f3b9756c-f4f4-44da-bc00-9f7903c8a83f") .with_variable("PRODUCT", serde_json::json!("Laptop"))); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; import com.senddart.requests.TemplateRef; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Your order") .template(TemplateRef.builder() .id("f3b9756c-f4f4-44da-bc00-9f7903c8a83f") .variable("PRODUCT", "Laptop") .build()) .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Your order", Template = new TemplateReference { Id = "f3b9756c-f4f4-44da-bc00-9f7903c8a83f", Variables = new Dictionary { ["PRODUCT"] = "Laptop" }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Your order", "template": { "id": "f3b9756c-f4f4-44da-bc00-9f7903c8a83f", "variables": { "PRODUCT": "Laptop" } } }' ``` > **Warning:** When you send a `template`, you cannot also pass `html` or `text` in the same request — doing so returns a `validation_error`. The request’s `from`, `subject`, and `reply_to` override the template’s defaults; if the template sets no default for one of those, you must provide it in the request. > **Note:** Only a **published** template can be used to send. See [Version history](https://www.senddart.com/docs/templates/version-history) for the draft → publish workflow. --- # Version history > Templates have a draft vs published lifecycle and a full version history, so you can iterate safely without disrupting live sends. Templates used in production need a workflow that lets you change them safely without disrupting active emails. SendDart gives you a **draft vs published** lifecycle plus a full version history, so you can edit and test freely while live sends keep using the last published version. ## Draft vs published A template starts as a **draft** and must be **published** before it can be used to send. Keeping the two separate lets you: - Test a template thoroughly before it goes live. - Make edits without affecting emails that are already sending. - Maintain version control over your email content. Once you publish, that published version is used for every send until you publish again. You can keep working on the draft in the meantime — the editor autosaves your progress and live sends are unaffected. ## Create then publish Create a template, then publish it with a separate call. Sending references the published version by id. **cURL** ```bash # Create the template (starts as a draft) curl -X POST 'https://www.senddart.com/api/templates' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "order-confirmation", "from": "Acme Store ", "subject": "Thanks for your order!", "html": "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

", "variables": [ { "key": "PRODUCT", "type": "string", "fallback_value": "item" }, { "key": "PRICE", "type": "number", "fallback_value": 20 } ] }' # Publish it curl -X POST 'https://www.senddart.com/api/templates/{template_id}/publish' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **Node.js** ```js // Create the template (starts as a draft) const created = await fetch('https://www.senddart.com/api/templates', { method: 'POST', headers: { 'Authorization': 'Bearer mb_xxxxxxxxx', 'Content-Type': 'application/json', }, body: JSON.stringify({ name: 'order-confirmation', from: 'Acme Store ', subject: 'Thanks for your order!', html: '

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

', variables: [ { key: 'PRODUCT', type: 'string', fallback_value: 'item' }, { key: 'PRICE', type: 'number', fallback_value: 20 }, ], }), }); const { id } = await created.json(); // Publish it await fetch(\`https://www.senddart.com/api/templates/\${id}/publish\`, { method: 'POST', headers: { 'Authorization': 'Bearer mb_xxxxxxxxx' }, }); ``` **Python** ```python import requests # Create the template (starts as a draft) created = requests.post( "https://www.senddart.com/api/templates", headers={"Authorization": "Bearer mb_xxxxxxxxx"}, json={ "name": "order-confirmation", "from": "Acme Store ", "subject": "Thanks for your order!", "html": "

Name: {{{PRODUCT}}}

Total: {{{PRICE}}}

", "variables": [ {"key": "PRODUCT", "type": "string", "fallback_value": "item"}, {"key": "PRICE", "type": "number", "fallback_value": 20}, ], }, ) template_id = created.json()["id"] # Publish it requests.post( f"https://www.senddart.com/api/templates/{template_id}/publish", headers={"Authorization": "Bearer mb_xxxxxxxxx"}, ) ``` After publishing you can keep editing the template through the editor or [via the API](https://www.senddart.com/docs/api/templates-update) without affecting the published version, so you can validate new edits before they reach recipients. ## Version history As you work, changes are saved as a draft (you can also save manually with **Cmd/Ctrl + S**). Nothing reaches live sends until you publish again. Each template keeps a **version history** so you can track what your team changed over time — open it from the three-dot menu in the top-right of the editor. From the version history you can preview each version, see who made it and when, and revert to an earlier one. Reverting creates a **new draft** based on that version’s content; it does not change the published template. ## Iterating on a live template You can build a new draft of a published template — redesign it, rework the copy, add or remove variables — and test it thoroughly before publishing again. Your sends keep using the current published version until you make the switch, so there is no need to spin up a separate template and no risk of leaking unfinished changes (like a new logo) into live email. > **Note:** Because draft edits do not affect the published version, you can safely add or remove variables on a production template without breaking existing sends or raising validation errors. --- # Your audience > An audience is a named contact list. Build one, fill it with contacts, and send a campaign to everyone on it. An **audience** is a named list of contacts — the people you send marketing email to. Each audience is a simple container: it has a `name`, a generated `id`, and a `created_at` timestamp. Contacts live **inside** an audience, addressed at `/audiences/:audience_id/contacts`. You build audiences in the dashboard under **Audiences**, or through the [API](https://www.senddart.com/docs/api/audiences-create). When you send a campaign, you point it at one audience and SendDart delivers a copy to every subscribed contact on the list. ## What an audience holds An audience brings together everything you need to send marketing email to a group of people: - **[Contacts](https://www.senddart.com/docs/audiences/contacts)** — the individual email addresses on the list. Each contact is associated with a single email address, can carry custom properties, can belong to zero or more [segments](https://www.senddart.com/docs/segments/overview), and can be opted in or out of individual [topics](https://www.senddart.com/docs/topics/overview). - **[Properties](https://www.senddart.com/docs/audiences/properties)** — the fields stored on each contact. Every contact has the default properties `email`, `first_name`, `last_name`, and `unsubscribed`; you can also add custom properties to store extra data and personalize campaigns. - **[Segments](https://www.senddart.com/docs/segments/overview)** — saved filters that resolve to a subset of the audience, so you can send to a specific group rather than the whole list. - **[Topics](https://www.senddart.com/docs/topics/overview)** — subscription categories within the audience that let a contact opt out of one kind of email without unsubscribing from everything. > **Note:** Each contact keeps a history of its marketing interactions (sends, opens, clicks, unsubscribes), so you can see how a person has engaged with your campaigns over time. ## Importing contacts in bulk Upload CSV files up to **5 MB** in the dashboard (the super-admin has no product file-size cap). Stored contacts are **unlimited on every plan**. The source is archived privately in S3, fully validated, and previewed with the first 20 contacts before confirmation. Non-email columns become built-in fields or custom properties for campaign merge tags. ## The audience object ```json { "object": "audience", "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Registered Users", "created_at": "2026-06-23T17:22:43.000Z" } ``` ## Creating an audience Give the audience a `name` — that is the only field. The response is the new audience object, including the `id` you use to add contacts and send campaigns. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.audiences.create({ "name": "Registered Users" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Audiences.create({ "name": "Registered Users" }) ``` **PHP** ```php audiences->create([ 'name' => "Registered Users" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Audiences.create({ "name": "Registered Users" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") audience, err := client.Audiences.Create(&senddart.CreateAudienceRequest{ Name: "Registered Users", }) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _audience = mb.audiences.create("Registered Users").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.audiences().create("Registered Users"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AudienceCreateAsync("Registered Users"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/audiences' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Registered Users" }' ``` **CLI** ```bash senddart audiences create \ --name 'Registered Users' ``` ## How campaigns use an audience - A campaign targets exactly **one audience** — every contact on the list receives a copy. - Contacts marked **`unsubscribed`** are skipped, so opted-out recipients never get the send. See [Managing unsubscribed contacts](https://www.senddart.com/docs/audiences/unsubscribed). - Each recipient gets a personal unsubscribe link; clicking it flips that contact to `unsubscribed` for future campaigns. > **Note:** Deleting an audience is blocked while a campaign still references it — delete the campaign(s) first. See [Delete audience](https://www.senddart.com/docs/api/audiences-delete). ## Next steps - [Manage contacts](https://www.senddart.com/docs/audiences/contacts) — add people to an audience and edit their details. - [Manage unsubscribed contacts](https://www.senddart.com/docs/audiences/unsubscribed) — how opt-outs work. - [Create an audience via the API](https://www.senddart.com/docs/api/audiences-create). --- # Managing contacts > Add contacts to an audience with an email and optional name, track their subscribe state, and address them by id or email. A **contact** is a single person on an audience. Contacts are nested under the audience that owns them — every contact operation runs against `/audiences/:audience_id/contacts`. The only required field is `email`. You can optionally store a `first_name` and `last_name`, an `unsubscribed` flag that controls whether campaigns reach them, and a `properties` map of custom fields you can use to personalize campaigns. ## The contact object ```json { "object": "contact", "id": "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6", "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false, "properties": { "company_name": "Acme Corp" }, "created_at": "2026-06-23T17:30:11.000Z" } ``` Emails are stored lowercased. `first_name` and `last_name` are `null` when not provided. `properties` is always present and includes every registered custom property, merged with fallback values. ## Adding a contact Send the `email` (required) plus any optional fields to the audience’s contacts collection. Alongside `first_name`, `last_name`, and `unsubscribed`, you can include a `properties` object of custom field values — each key must already be registered as a contact property on your account and the value must match its type. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.create({ audienceId: 'AUDIENCE_ID', "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false }); console.log({ data, error }); ``` **Ruby** ```ruby require 'net/http' require 'uri' uri = URI('https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Post.new(uri) req['Authorization'] = 'Bearer mb_xxxxxxxxx' req['Content-Type'] = 'application/json' req.body = <<~JSON { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false } JSON res = http.request(req) puts res.body ``` **PHP** ```php contacts->create([ 'audienceId' => "AUDIENCE_ID", 'email' => "steve@example.com", 'first_name' => "Steve", 'last_name' => "Wozniak", 'unsubscribed' => false ]); ``` **Python** ```python import requests res = requests.post( "https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts", headers={"Authorization": "Bearer mb_xxxxxxxxx", "Content-Type": "application/json"}, json={ "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false }, ) print(res.json()) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") contact, err := client.Contacts.Create(&senddart.CreateContactRequest{ AudienceId: "AUDIENCE_ID", Email: "steve@example.com", FirstName: "Steve", LastName: "Wozniak", Unsubscribed: false, }) ``` **Rust** ```rust use senddart::{CreateContactOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateContactOptions::new("steve@example.com") .with_audience_id("AUDIENCE_ID") .with_first_name("Steve") .with_last_name("Wozniak") .with_unsubscribed(false); let _contact = mb.contacts.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateContactRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateContactRequest request = CreateContactRequest.builder() .audienceId("AUDIENCE_ID") .email("steve@example.com") .firstName("Steve") .lastName("Wozniak") .unsubscribed(false) .build(); SendDartResponse response = senddart.contacts().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactCreateAsync(new ContactCreateOptions { AudienceId = "AUDIENCE_ID", Email = "steve@example.com", FirstName = "Steve", LastName = "Wozniak", Unsubscribed = false, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false }' ``` ## Upsert by email Contacts are **unique by email within an audience**. If you create a contact whose email already exists in that audience, SendDart **merges** into the existing contact instead of creating a duplicate. This makes the create call safe to call repeatedly (for example, on every signup) without producing duplicates. > **Note:** The merge never destroys data: an omitted `first_name`/`last_name` keeps the value already stored, `properties` are merged key by key (incoming keys win), and `unsubscribed` is monotonic — a create can suppress a contact but can never re-subscribe one, so sending `unsubscribed: false` for an opted-out contact leaves the opt-out in place. Use [PATCH](https://www.senddart.com/docs/api/contacts-update) to re-subscribe a contact or to clear a name. ## Addressing a contact by id or email Anywhere a contact identifier appears in the path — get, update, delete — you can pass either the contact `id` or its `email`. SendDart detects which you provided. Both of these refer to the same contact: ```bash GET https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6 GET https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/steve@example.com ``` ## Contact properties Every contact has four **default properties** — `email`, `first_name`, `last_name`, and `unsubscribed`. You can also register **custom properties** to store additional information (for example `company_name` or `plan`) and use those values to personalize campaigns. Properties are registered once per account with [POST /contact-properties](https://www.senddart.com/docs/audiences/properties) — there is no per-audience registry, so a registered key is valid for every contact in every audience. Set custom values by passing a `properties` map when you create or [update](https://www.senddart.com/docs/api/contacts-update) a contact: ```json { "email": "steve@example.com", "first_name": "Steve", "properties": { "company_name": "Acme Corp", "plan": "pro" } } ``` > **Warning:** A property key must already be registered on your account and the value must match its declared type. On `POST /contacts` (and the audience-scoped `POST /audiences/:audience_id/contacts`) unknown keys or mismatched types are rejected and the contact is not changed. Property keys are case-sensitive — `company_name` and `companyName` are different keys. ## Bulk import by CSV Upload a CSV up to **5 MB**, choose a segment, and review validation counts and the first 20 contacts before importing. The super-admin is exempt from the file-size limit. All plans have unlimited stored contacts. Overlapping imports merge by normalized email; segment membership is unique and existing unsubscribe preferences are preserved. The original CSV stays in private S3 storage; sending uses validated database contacts and current suppression preferences. | on_conflict | Behavior | | --- | --- | | `upsert` | Update the existing contact with the values from the CSV row. | | `skip` | Leave the existing contact untouched and skip the row. | ## Automatic creation > **Note:** Contacts are also created automatically when an [automation](https://www.senddart.com/docs/automations/overview) runs for an email address that does not yet exist on the audience, so you do not have to pre-add every recipient. ## Next steps - [Create a contact via the API](https://www.senddart.com/docs/api/contacts-create). - [Update a contact](https://www.senddart.com/docs/api/contacts-update) — change a name, a property, or the subscribe state. - [Manage unsubscribed contacts](https://www.senddart.com/docs/audiences/unsubscribed). --- # Managing unsubscribed contacts > How a contact becomes unsubscribed and why campaigns skip them. Every contact carries an **`unsubscribed`** boolean. When it is `true`, the contact has opted out: **campaigns skip them entirely** and they receive no further campaign email to that audience. Honoring opt-outs is not optional — it keeps your sending compliant and protects your domain reputation. ## Why it matters Keeping your list up to date as people unsubscribe protects your sender reputation. Specifically, honoring opt-outs: - reduces the likelihood of your emails being marked as spam, and - improves deliverability for every other marketing and transactional email you send. ## Subscription statuses A contact’s status reflects the `unsubscribed` flag: | Status | Meaning | | --- | --- | | **Subscribed** | `unsubscribed: false` — the contact still receives campaigns to this audience. | | **Unsubscribed** | `unsubscribed: true` — the contact has opted out and is skipped by every campaign. | The audience-wide `unsubscribed` flag is the **global** subscription state. It is distinct from per-[topic](https://www.senddart.com/docs/topics/overview) subscriptions: a contact can stay subscribed to the audience while opting out of an individual topic. The global flag always wins — a globally unsubscribed contact is never emailed even if they are opted in to a topic. ## How a contact becomes unsubscribed - **Campaign unsubscribe link** — every campaign includes a per-contact unsubscribe link. When a recipient clicks it, that contact is flipped to `unsubscribed: true`. - **Manual toggle** — you can set `unsubscribed` yourself when [creating](https://www.senddart.com/docs/api/contacts-create) a contact or by [updating](https://www.senddart.com/docs/api/contacts-update) one with `PATCH`. ## Unsubscribing a contact via the API Patch the contact (by id or email) with `unsubscribed: true`. Patches are partial, so this changes only the subscribe state and leaves the name fields untouched. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.update({ audienceId: 'AUDIENCE_ID', id: 'steve@example.com', "unsubscribed": true }); console.log({ data, error }); ``` **Ruby** ```ruby require 'net/http' require 'uri' uri = URI('https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/steve@example.com') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Patch.new(uri) req['Authorization'] = 'Bearer mb_xxxxxxxxx' req['Content-Type'] = 'application/json' req.body = <<~JSON { "unsubscribed": true } JSON res = http.request(req) puts res.body ``` **PHP** ```php contacts->update([ 'audienceId' => "AUDIENCE_ID", 'id' => "steve@example.com", 'unsubscribed' => true ]); ``` **Python** ```python import requests res = requests.patch( "https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/steve@example.com", headers={"Authorization": "Bearer mb_xxxxxxxxx", "Content-Type": "application/json"}, json={ "unsubscribed": true }, ) print(res.json()) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") updated, err := client.Contacts.Update(&senddart.UpdateContactRequest{ AudienceId: "AUDIENCE_ID", Id: "steve@example.com", Unsubscribed: senddart.Bool(true), }) ``` **Rust** ```rust use senddart::{SendDart, UpdateContactOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateContactOptions::new("steve@example.com") .with_audience_id("AUDIENCE_ID") .with_unsubscribed(true); let _updated = mb.contacts.update(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.UpdateContactRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); UpdateContactRequest request = UpdateContactRequest.builder() .audienceId("AUDIENCE_ID") .id("steve@example.com") .unsubscribed(true) .build(); SendDartResponse response = senddart.contacts().update(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactUpdateAsync(new ContactUpdateOptions { AudienceId = "AUDIENCE_ID", Id = "steve@example.com", Unsubscribed = true, }); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/steve@example.com' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "unsubscribed": true }' ``` To re-subscribe a contact (for example, if they opted back in), patch the same contact with `unsubscribed: false`. > **Note:** Unsubscribed contacts stay on the audience — they are not deleted — so your list size and history are preserved. They are simply excluded from every campaign until re-subscribed. --- # Segments > Save reusable filters over a sending domain’s contacts and target campaigns at a subset of them. A **segment** is a saved, reusable filter over the contacts on one of your sending **domains**. Instead of sending a [campaign](https://www.senddart.com/docs/campaigns/managing) to a domain’s entire contact pool, you can target a segment — a subset matched by a filter. A segment belongs to exactly one domain: names are unique within a domain but freely reusable across domains, and every domain also carries an auto-created **General** segment that matches all of its contacts. Segments are for **your own internal organization** — they are never visible to your contacts. Use them to group contacts however makes sense for your sending (by signup source, plan, engagement, email domain, and so on). ## Filters A segment filter is a set of predicates, all combined with AND: **Filter** | Name | Type | Required | Description | | --- | --- | --- | --- | | `status` | 'all' | 'subscribed' | 'unsubscribed' | 'members_only' | No | Match by subscription status. Defaults to `all`. `members_only` (matches nobody by filter — the segment resolves to its explicitly added contacts only). | | `email_contains` | string | No | Match contacts whose email contains this substring (case-insensitive). | | `property_filters` | array | No | Optional list of custom-property predicates combined with AND. Each entry requires a `key` (registered contact property), an `operator` (`eq`, `contains`, or `exists`), and (for `eq`/`contains`) a `value`. Register properties first with `POST /contact-properties`. | | `engagement` | object | null | No | Optional engagement predicate against one campaign: `{ event, campaign_id }`. `event` is one of `clicked`, `not_clicked`, `opened`, `not_opened`. `null` (the default) means no engagement predicate. | ## Create a segment **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.segments.create({ "domain": "yourdomain.com", "name": "Gmail subscribers", "filter": { "status": "subscribed", "email_contains": "@gmail.com" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Segments.create({ "domain": "yourdomain.com", "name": "Gmail subscribers", "filter": { "status": "subscribed", "email_contains": "@gmail.com" } }) ``` **PHP** ```php segments->create([ 'domain' => "yourdomain.com", 'name' => "Gmail subscribers", 'filter' => [ 'status' => "subscribed", 'email_contains' => "@gmail.com" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Segments.create({ "domain": "yourdomain.com", "name": "Gmail subscribers", "filter": { "status": "subscribed", "email_contains": "@gmail.com" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") segment, err := client.Segments.Create(&senddart.CreateSegmentRequest{ Domain: "yourdomain.com", Name: "Gmail subscribers", Filter: &senddart.SegmentFilterInput{ Status: "subscribed", EmailContains: "@gmail.com", }, }) ``` **Rust** ```rust use senddart::{CreateSegmentOptions, SegmentFilterOptions, SegmentStatus, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateSegmentOptions::new("yourdomain.com", "Gmail subscribers") .with_filter(SegmentFilterOptions::new() .with_status(SegmentStatus::Subscribed) .with_email_contains("@gmail.com")); let _segment = mb.segments.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateSegmentRequest; import com.senddart.requests.SegmentFilter; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateSegmentRequest request = CreateSegmentRequest.builder() .domain("yourdomain.com") .name("Gmail subscribers") .filter(SegmentFilter.builder() .status("subscribed") .emailContains("@gmail.com") .build()) .build(); SendDartResponse response = senddart.segments().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.SegmentCreateAsync(new SegmentCreateOptions { Domain = "yourdomain.com", Name = "Gmail subscribers", Filter = new SegmentFilterOptions { Status = "subscribed", EmailContains = "@gmail.com", }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/segments' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "domain": "yourdomain.com", "name": "Gmail subscribers", "filter": { "status": "subscribed", "email_contains": "@gmail.com" } }' ``` **CLI** ```bash senddart segments create \ --domain 'yourdomain.com' \ --name 'Gmail subscribers' \ --filter '{"status":"subscribed","email_contains":"@gmail.com"}' ``` ## Preview who matches List the contacts a segment currently resolves to — useful to sanity-check a filter before sending. ```ts const { data } = await mb.segments.contacts('4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93'); console.log(data.data.length, 'contacts match'); ``` ## Send a campaign to a segment Pass `segment_id` when creating a campaign. The campaign then fans out only to the segment’s matching contacts (still excluding anyone unsubscribed, for compliance). ```ts await mb.campaigns.create({ domain: 'yourdomain.com', segment_id: '4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93', from: 'Acme ', subject: 'A note for our Gmail folks', html: '

Hi {{FIRST_NAME}}

', }); ``` > **Note:** For compliance, a campaign never sends to unsubscribed contacts even if a segment’s `status` would include them — the `status` filter is most useful for previewing/auditing, while `email_contains` is what narrows a send. > **Note:** Include the `{{{SENDDART_UNSUBSCRIBE_URL}}}` merge tag in a segment campaign and SendDart automatically replaces it with the correct per-contact unsubscribe link — so opt-outs are handled for you. See [Managing unsubscribed contacts](https://www.senddart.com/docs/audiences/unsubscribed). --- # Topics > Subscription categories within a sending domain. Contacts choose which topics they receive; a campaign can target a single topic. A **topic** is a category of mail within one of your sending **domains** — for example “Product updates” or “Weekly newsletter”. Topics give your contacts finer-grained control: a contact can opt out of one kind of email on a hosted **preference page** instead of unsubscribing from everything you send. A contact can belong to **multiple topics**. > **Note:** Topics are the more deliverability-friendly alternative to all-or-nothing unsubscribes: letting a contact drop a single topic keeps them on your list for the mail they still want. They differ from [segments](https://www.senddart.com/docs/segments/overview) — segments are your private filters for organizing contacts, while topics are user-facing preferences your contacts manage themselves. ## Default subscription: opt-in vs opt-out When you create a topic you choose its **default subscription** — how contacts start out relative to it: | Default | Behavior | | --- | --- | | **Opt-in** | Every contact receives this topic unless they have explicitly unsubscribed from it. | | **Opt-out** | No contact receives this topic unless they have explicitly subscribed to it. | > **Warning:** The default subscription is fixed at creation and **cannot be changed later**. Pick it carefully — to switch a topic between opt-in and opt-out you would have to create a new topic. ## Visibility: public vs private Each topic also has a **visibility** that controls whether it appears on the contact’s preference page: | Visibility | Who sees it on the preference page | | --- | --- | | **Public** | All contacts can see and toggle the topic. | | **Private** | Only contacts who are already opted in to the topic can see it. | Unlike the default subscription, a topic’s **name**, **description**, and **visibility** can be edited after creation. ## How topics affect sending - A [campaign](https://www.senddart.com/docs/campaigns/managing) may target a single topic via `topic_id`. - So may a single send: [`POST /emails`](https://www.senddart.com/docs/api/emails-send) accepts `topic_id` too. - When either does, the send skips any recipient who is not subscribed to that topic (per its opt-in/opt-out default and the recipient’s own choices) — on top of the audience-wide unsubscribe and the account suppression list. - Topics never override compliance: a contact who unsubscribed from the whole audience is never emailed, regardless of topic. ## A topic send always carries an opt-out Setting `topic_id` marks a send as **subscription mail**, so SendDart gives every recipient a way to leave — the same two mechanisms a campaign gets, added automatically: - an **unsubscribe footer** in the HTML body (skipped if your body already carries a SendDart unsubscribe link, e.g. via the `{{{SENDDART_UNSUBSCRIBE_URL}}}` merge tag), and - an RFC 8058 **`List-Unsubscribe`** header with **`List-Unsubscribe-Post`** for native one-click unsubscribe. The link is minted **per recipient**, so each `to`/`cc`/`bcc` address receives its own copy with only its own opt-out link. The recipient does not need to be a contact — a topic opt-out can be recorded against a bare email address, which is what makes `topic_id` safe to use for mail sent to addresses that are not on your list. > **Note:** The scope of the opt-out is **that one topic** — never a global unsubscribe. The address keeps receiving your other topics, your campaigns, and your transactional mail; only later sends carrying the same `topic_id` skip it. Conversely, a send **without** a `topic_id` is transactional and carries **no** unsubscribe footer or header at all: an unsubscribe writes a suppression that blocks every later send to the address, so SendDart never puts one on a receipt or a password reset. See [Unsubscribe links](https://www.senddart.com/docs/emails/unsubscribe). Both kinds of opt-out are listed together in the dashboard under **Audiences → Topics → View opt-outs**: contacts who turned the topic off on their preference page, and email addresses that used the unsubscribe link on a topic send. > **Note:** The audience-wide **Subscribed** status is the master switch. If a contact’s global `unsubscribed` flag is `true`, they receive nothing — even from a topic they are opted in to. Only when the global status is subscribed do per-topic subscriptions decide what they receive. See [Managing unsubscribed contacts](https://www.senddart.com/docs/audiences/unsubscribed). ## The preference page Each per-contact unsubscribe link resolves to a hosted preference page where the contact can: - unsubscribe from one or more individual **topics** (and keep receiving the rest), or - unsubscribe from **everything** you send (this flips their global `unsubscribed` flag and stops all campaigns). The page lists every **public** topic; **private** topics appear only for contacts already opted in to them. Include the link in a campaign with the `{{{SENDDART_UNSUBSCRIBE_URL}}}` merge tag. The unsubscribe link on a **topic send** is different: it names the topic being left and offers only that choice — no “unsubscribe from everything” box — because a topic link is not consent to stop the sender’s account and transactional mail. --- # Contact properties > Store extra data on contacts with default and custom properties, then use them to personalize campaigns. Contact properties store additional information about your contacts that you can then use to personalize your [campaigns](https://www.senddart.com/docs/campaigns/managing). Alongside a set of default properties, you can define your own **custom properties**. ## Default properties Every contact already carries these built-in properties: - `first_name` — the contact’s first name. - `last_name` — the contact’s last name. - `email` — the contact’s email address. - `unsubscribed` — whether the contact has unsubscribed from all campaigns. ## Custom properties Create additional custom properties to store whatever you need — a company name, a plan tier, a signup source. Each property has a key, a value, and an optional fallback value. **Property fields** | Name | Type | Required | Description | | --- | --- | --- | --- | | `key` | string | Yes | The property name. Alphanumeric and underscores only, max 50 characters. Case-sensitive. | | `type` | string | Yes | Either `string` or `number`. | | `fallback_value` | string | number | No | Used for contacts that have no value set for this property. Must match `type`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contactProperties.create({ "key": "company_name", "type": "string", "fallback_value": "Acme Corp" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::ContactProperties.create({ "key": "company_name", "type": "string", "fallback_value": "Acme Corp" }) ``` **PHP** ```php contactProperties->create([ 'key' => "company_name", 'type' => "string", 'fallback_value' => "Acme Corp" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.ContactProperties.create({ "key": "company_name", "type": "string", "fallback_value": "Acme Corp" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") property, err := client.ContactProperties.Create(&senddart.CreateContactPropertyRequest{ Key: "company_name", Type: "string", FallbackValue: "Acme Corp", }) ``` **Rust** ```rust use senddart::{ContactPropertyType, CreateContactPropertyOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateContactPropertyOptions::new( "company_name", ContactPropertyType::String, ) .with_fallback_value(serde_json::json!("Acme Corp")); let _property = mb.contact_properties.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateContactPropertyRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateContactPropertyRequest request = CreateContactPropertyRequest.builder() .key("company_name") .type("string") .fallbackValue("Acme Corp") .build(); SendDartResponse response = senddart.contactProperties().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactPropertyCreateAsync(new ContactPropertyCreateOptions { Key = "company_name", Type = "string", FallbackValue = "Acme Corp", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/contact-properties' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "key": "company_name", "type": "string", "fallback_value": "Acme Corp" }' ``` **CLI** ```bash senddart contact-properties create \ --key 'company_name' \ --type 'string' \ --fallback-value 'Acme Corp' ``` ## Setting a value on a contact A property’s fallback value is used for any contact that has no explicit value. To set a per-contact value, pass a `properties` object when you [create a contact](https://www.senddart.com/docs/api/contacts-create) or [update one](https://www.senddart.com/docs/api/contacts-update). You can update a contact by `id` or by `email`. **cURL** ```bash # Set a property while creating a contact curl -X POST 'https://www.senddart.com/api/contacts' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "domain": "yourdomain.com", "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false, "properties": { "company_name": "Acme Corp" } }' # Or update an existing contact by email curl -X PATCH 'https://www.senddart.com/api/contacts/steve@example.com' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "properties": { "company_name": "Acme Corp" } }' ``` **Node.js** ```js // Set a property while creating a contact await fetch('https://www.senddart.com/api/contacts', { method: 'POST', headers: { 'Authorization': 'Bearer mb_xxxxxxxxx', 'Content-Type': 'application/json', }, body: JSON.stringify({ domain: 'yourdomain.com', email: 'steve@example.com', first_name: 'Steve', last_name: 'Wozniak', unsubscribed: false, properties: { company_name: 'Acme Corp' }, }), }); // Or update an existing contact by email await fetch('https://www.senddart.com/api/contacts/steve@example.com', { method: 'PATCH', headers: { 'Authorization': 'Bearer mb_xxxxxxxxx', 'Content-Type': 'application/json', }, body: JSON.stringify({ properties: { company_name: 'Acme Corp' } }), }); ``` **Python** ```python import requests # Set a property while creating a contact requests.post( "https://www.senddart.com/api/contacts", headers={"Authorization": "Bearer mb_xxxxxxxxx"}, json={ "domain": "yourdomain.com", "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": False, "properties": {"company_name": "Acme Corp"}, }, ) # Or update an existing contact by email requests.patch( "https://www.senddart.com/api/contacts/steve@example.com", headers={"Authorization": "Bearer mb_xxxxxxxxx"}, json={"properties": {"company_name": "Acme Corp"}}, ) ``` ## Validation rules A property is only applied to a contact if the property **key already exists** and the supplied value matches the property’s declared **type**. Otherwise the value is not set and the call fails with an error. - **Unknown key** — if the property key does not exist, it is not added and the request fails. - **Wrong type** — if the value’s type does not match the property’s `type`, it is not added and the request fails. - **Case-sensitive keys** — `company_name`, `CompanyName`, and `company_Name` are three different keys. Match the key exactly. > **Note:** List every property you have defined with [GET /contact-properties](https://www.senddart.com/docs/audiences/properties) to confirm the exact keys and types before setting values. ## Using properties in campaigns Reference any property — default or custom — in your campaign HTML and text content to personalize each recipient’s message. Properties are resolved per-contact when the campaign is sent, using each contact’s value or the property’s fallback. You can also set this up when you [create a campaign](https://www.senddart.com/docs/api/campaigns-create) via the API. --- # Migrating from Audiences to Segments > How SendDart moved from per-audience Contacts to a global Contacts model with Segments and Topics — what changed, how unsubscribes work now, and what to do. SendDart has changed how contacts are organized. Previously, each contact belonged to exactly one **audience**, and creating a contact with the same email address in a different audience produced a completely separate object. In the new model, contacts are **independent of audiences** — audiences are now called **[segments](https://www.senddart.com/docs/segments/overview)**. A contact can belong to zero, one, or many segments and still counts as a single contact toward your quota. > **Note:** Contact API endpoints that previously took an `audience_id` are now scoped by **sending domain**: pass `domain` when creating a contact and `?domain=` when listing (passing `audience_id` is rejected). Each domain keeps its own contact pool with separate consent, and `segment_id` scopes a query to a segment within that domain. ## What’s changing? We are moving to a **global contacts** model. - **Before:** if a contact with the same email appeared in multiple audiences, it was counted as multiple contacts. - **Now:** each email address is a single contact per sending domain, even when it appears in multiple segments. (The same address on two domains is two contact records with separate consent.) The new model has three concepts: **Concepts** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Contact` | per-domain entity | No | A single record keyed to an email address within a sending domain’s contact pool. | | `Segment` | internal tool | No | An internal segmentation tool your team uses to organize who to send to. A contact can be in many segments; every domain carries an auto-created General segment matching all of its contacts. | | `Topic` | user-facing tool | No | A subscription category your recipients see and manage — the user-facing way to handle email preferences. | ## How unsubscribing changes Previously, when a contact clicked "unsubscribe," they were marked **unsubscribed only from the specific audience** used in that campaign. Now, contacts land on a **preference page** where they can either unsubscribe from specific **topics** or unsubscribe from **everything** you send (which updates the global contact status). ## What you should do If you have been using audiences for both segmentation **and** unsubscribes, switch your unsubscribe logic to **topics**: 1. **Create a topic per email type** — Add a [topic](https://www.senddart.com/docs/topics/overview) for each kind of email you send (e.g. product updates, newsletter, billing). 2. **Assign contacts to topics** — Subscribe the right contacts to each topic so recipients can manage them independently. 3. **Use segments for organization only** — Keep segments purely for internal organization of who you send to, not for opt-out state. With this setup, when you send a [campaign](https://www.senddart.com/docs/campaigns/managing), recipients choose which topics to unsubscribe from — or opt out entirely — instead of silently dropping out of one audience. ## Reference For the new API surface, see: - [Contacts](https://www.senddart.com/docs/api/contacts-create) — create and manage contacts per sending domain (pass `domain` instead of an `audience_id`). - [Topics](https://www.senddart.com/docs/topics/overview) — user-facing subscription preferences. - [Segments](https://www.senddart.com/docs/api/segments-create) — reusable internal filters over your contacts. > **Note:** Have a use case not covered here? Reach out to support and we’ll help make the transition smooth. --- # Managing domains > Add a sending domain, work through DNS verification, re-verify, and delete domains. A **domain** is the identity you send from. SendDart creates a sending identity for it (DKIM signing plus a custom MAIL FROM subdomain), then gives you the SPF and DKIM DNS records to publish. Once those records are confirmed, the domain is **verified** and you can send from any address on it. A verified domain also covers its **subdomains** — a domain identity for `example.com` signs and authorizes mail from `news.example.com`, so you do not need to add each subdomain separately. ## Your permanent primary domain on Free On the Domains page, the account owner chooses one sending-verified domain as the permanent primary domain. Confirm carefully: this is a one-time choice. Free sending requires this choice and allows only that domain and its verified subdomains. Other domains remain in your account. Paid plans allow all verified domains; the same primary choice applies again after any future downgrade. Deleting and re-adding a domain does not reset the choice. DNS verification, account restrictions, and email quotas still apply. ## Add a domain Add a domain in the dashboard under **Domains**, or via the API with [`POST /domains`](https://www.senddart.com/docs/api/domains-create). SendDart provisions the sending identity and returns the domain object with the DNS records to publish. > **Note:** You add the bare domain (e.g. `yourdomain.com`). Publish the returned records at your DNS provider — see [DNS records](https://www.senddart.com/docs/domains/dns). ## Verification lifecycle A domain moves through a small set of statuses. A freshly added domain starts at `not_started`; once you trigger verification it moves to `pending` while it waits for DNS to propagate and DKIM to be confirmed. | Status | Meaning | | --- | --- | | `not_started` | The status right after creation, before any verification has run. Per-record statuses also start here. | | `pending` | Verification has been triggered and SendDart is waiting to confirm the published DNS records. | | `verified` | The identity and DKIM signing were confirmed. The domain (and its subdomains) can send email. | | `failed` | DKIM verification failed — the records were not found within the verification window (SendDart checks for up to **72 hours**) or are incorrect. Fix the DNS and re-verify. | | `temporary_failure` | A previously `verified` domain whose DNS records can no longer be detected. SendDart rechecks for 72 hours: if the records reappear it returns to `verified`; if not it becomes `failed`. Re-publish the missing records and re-verify. | | `revoked` | A different account verified this domain (or a parent/subdomain of it) by publishing its DNS records, so this account’s verification was withdrawn. Sending from it is blocked. Re-verify to take it back if you still control the DNS. | > **Warning:** You can only send from a **verified** domain (or a subdomain of one). Sending from an unverified domain returns a `validation_error`. > **Note:** For deliverability we recommend sending from a **subdomain** (e.g. `updates.yourdomain.com` or `news.yourdomain.com`) rather than your root domain. This isolates your sending reputation and signals intent to recipients. A verified domain identity already covers its subdomains, so a single `yourdomain.com` identity authorizes `updates.yourdomain.com` without adding it separately. ## One verified owner per domain A domain — together with its parents and subdomains — can be verified by **at most one account** at a time. Adding a domain that overlaps a domain another account has already verified returns a `domain_conflict` (409); if you own the domain, prove it with the [domain claim flow](https://www.senddart.com/docs/domains/claim) instead. Because verification requires publishing DNS records, whoever completes verification provably controls the DNS — so when a domain is verified, any overlapping domain verified under a **different** account moves to `revoked` and can no longer send. The revoked account is notified by email and, if subscribed, receives a `domain.updated` webhook with the new status. ## Re-verify DNS changes can take time to propagate, so a domain may sit at `pending` for a while after you publish the records. Trigger a fresh check with [`POST /domains/:id/verify`](https://www.senddart.com/docs/api/domains-verify) (or the **Verify** button in the dashboard). SendDart re-checks your DNS and updates the domain and per-record status — `verified`, `failed`, or still `pending`. ## Custom return path The **return path** (the `MAIL FROM` / bounce address) defaults to the `send.yourdomain.com` subdomain — this is the subdomain that carries the SPF MX and TXT records. You can choose a different label by passing the optional `custom_return_path` field when creating the domain; the SPF records are then published on that subdomain (e.g. `outbound.yourdomain.com`) instead of `send.`. - Must be **63 characters or less**. - Must start with a letter, end with a letter or number, and contain only letters, numbers, and hyphens. > **Warning:** Avoid values that could undermine credibility (e.g. `testing`) — the return-path subdomain is exposed to recipients in some mail clients. ## Enforced TLS Each domain carries a `tls` preference that records how you want mail from it encrypted in transit. **Opportunistic** (the default) encrypts the connection to the receiving server when that server supports TLS, and otherwise sends unencrypted. **Enforced** records a preference that delivery should require TLS — use it when confidentiality matters more than guaranteed delivery. Set it with [`PATCH /domains/:id`](https://www.senddart.com/docs/api/domains-update) (`tls`). ## Delete a domain Delete a domain in the dashboard or with [`DELETE /domains/:id`](https://www.senddart.com/docs/api/domains-delete). This removes the sending identity and the stored records. > **Warning:** Deletion is **blocked while a scheduled email still depends on the domain** — you get a `validation_error` asking you to cancel that email first. This prevents a scheduled send from firing against a domain SendDart no longer has an identity for. --- # DNS records (SPF, DKIM) > The SPF and DKIM records SendDart generates for a domain, what each one does, and how to publish them — plus the DMARC record you publish yourself. When you add a domain, SendDart returns a set of DNS records to publish at your DNS provider. They authenticate your mail so mailbox providers trust it: **DKIM** cryptographically signs every message and **SPF** authorizes the sending servers. **DMARC** is not generated for you — it is a policy you publish yourself (see below). Each record below uses the bare domain `yourdomain.com` and a region of `us-east-1` as an example. Your actual values appear in the [`POST /domains`](https://www.senddart.com/docs/api/domains-create) response and in the dashboard. ## DKIM (1 TXT record) SendDart generates a DKIM keypair for your domain and uses the private key to sign your mail. You publish **one** DKIM TXT record holding the public key at a fixed selector hostname. That single record must resolve for the domain to verify. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | A single DKIM key record. | | `Name` | senddart._domainkey.yourdomain.com | No | The DKIM selector hostname. `senddart` is the fixed selector SendDart uses. | | `Value` | v=DKIM1; k=rsa; p= | No | The RFC 6376 DKIM key record holding your domain’s public key. | | `TTL` | Auto | No | Use your provider default; no specific TTL is required. | Why it matters: DKIM lets receivers verify the message was sent by you and was not altered in transit. Without the DKIM TXT record resolving, verification will not finish and the domain stays `pending` (or goes `failed`). ## SPF (a MAIL FROM subdomain: MX + TXT) SendDart configures a custom MAIL FROM subdomain — `send.yourdomain.com` — so the bounce/return path aligns with your domain. That subdomain needs two records: **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX | No | Receives bounce and complaint feedback for the MAIL FROM subdomain. | | `Name` | send.yourdomain.com | No | The custom MAIL FROM subdomain. | | `Value` | feedback-smtp.us-east-1.amazonses.com | No | Region-specific feedback host. The region matches your domain’s configured region. | | `Priority` | 10 | No | MX priority. | | `TTL` | Auto | No | Provider default. | **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | SPF policy for the MAIL FROM subdomain. | | `Name` | send.yourdomain.com | No | The custom MAIL FROM subdomain (same host as the MX). | | `Value` | v=spf1 include:amazonses.com ~all | No | Authorizes SendDart to send for the MAIL FROM subdomain. | | `TTL` | Auto | No | Provider default. | Why it matters: SPF lets receivers confirm the message came from a server allowed to send for your MAIL FROM domain. The MX record routes bounce and complaint notifications back to SendDart. Note the SPF host value embeds the **configured region** (`us-east-1` above) — see [Choosing a region](https://www.senddart.com/docs/domains/region). ## DMARC (recommended, published by you) DMARC is **not** part of the generated `records` array and is not required for verification — it is a domain-wide policy that applies to every sender you use, so SendDart leaves it under your control. We strongly recommend publishing one: a TXT record at `_dmarc.yourdomain.com` with the value `v=DMARC1; p=none;` starts you in monitor-only mode, so legitimate mail is never blocked while you confirm alignment. Tighten to `quarantine` or `reject` once you trust the results. Why it matters: DMARC ties SPF and DKIM together with a published policy and tells receivers how to treat mail that fails authentication. ## Publishing and propagation Add every returned record exactly as SendDart generated it — copy and paste the host and value rather than retyping, since a single wrong character (or a trailing dot your provider adds automatically) will stop verification. The records must match what the [`POST /domains`](https://www.senddart.com/docs/api/domains-create) response shows. When the records are published correctly, a domain often verifies within **15 minutes**. DNS changes can occasionally take up to **72 hours** to propagate globally, so a domain may sit at `pending` for a while. If it has not verified after 72 hours, double-check the records and [re-verify](https://www.senddart.com/docs/api/domains-verify). > **Note:** DNS changes can take time to propagate — anywhere from a few minutes to several hours depending on your provider and TTLs. If a domain stays `pending` after you publish the records, wait and then [re-verify](https://www.senddart.com/docs/api/domains-verify). --- # Open and click tracking > Per-domain open and click tracking: how the open pixel and link rewriting work, and how events surface. Each domain has two independent tracking toggles — **open tracking** and **click tracking** — stored on the domain and applied to mail sent from it. API-created domains default to **open tracking off** and **click tracking on**; the dashboard asks for both explicitly. Toggle either setting in the dashboard or with [`PATCH /domains/:id`](https://www.senddart.com/docs/api/domains-update) (`open_tracking`, `click_tracking`). ## Open tracking When open tracking is on, SendDart embeds a **1×1 transparent pixel GIF** in the HTML body, with a unique reference to the email. A request for that image records an `opened` event. This identifies the tracked message, but does not prove that a person read it: image proxies and privacy tools may request the pixel automatically. ## Click tracking When click tracking is on, SendDart rewrites eligible HTTP and HTTPS links through a redirect. A request to that redirect records a `clicked` event with the destination URL, then continues to the original destination. Non-web links such as `mailto:`, unsubscribe and preference links, and links already wrapped by the tracker are excluded. Automated link scanners can also generate requests. ## Custom tracking subdomain By default the rewritten links and open pixel point at a SendDart-hosted tracking host. You can instead serve them from a **custom subdomain on your own domain** so tracked links stay on-brand. Set `tracking_subdomain` with [`PATCH /domains/:id`](https://www.senddart.com/docs/api/domains-update) (for example `links`, which produces a CNAME for `links.yourdomain.com`); providing it implicitly turns on `custom_tracking`. - Choose an unused subdomain, such as `links`, and confirm that it does not conflict with an existing website or DNS record. - After setting it, publish the **Tracking CNAME** record SendDart returns and let it verify; until then links use SendDart's shared tracking host. - You can change the subdomain or switch off `custom_tracking` for new messages. SendDart retains previous tracking host bindings and record entries for already-sent links; keep the corresponding DNS records in your DNS provider while those links need to work. Deleting the sending domain is a separate action. ## How events surface Open and click events appear in two places: - In the **per-email log** — part of the event timeline you can view in the dashboard or fetch with [`GET /emails/:id`](https://www.senddart.com/docs/logs/overview). - In your **webhooks** — `opened` and `clicked` events are delivered to your configured webhook endpoints alongside delivery, bounce, and complaint events. > **Warning:** Engagement tracking is **approximate**. Image-proxying and privacy features can inflate opens, blocked images can undercount them, and link scanners can inflate clicks. Use these events as directional signals alongside meaningful activity in your application. --- # Choosing a region > Each domain is created in the sending region you pass, which its MAIL FROM / SPF records reference. Every domain identity is created in a **sending region**, and the DNS records generated for the domain reference it. Sending is currently available in **`us-east-1` (North Virginia)** and **`ap-south-1` (Mumbai)**. Other regions shown in the dashboard (`eu-west-1`, `sa-east-1`, `ap-northeast-1`) are **coming soon** — passing one of them to [`POST /domains`](https://www.senddart.com/docs/api/domains-create) returns a `validation_error` until they open up. Omitting `region` uses the default (`us-east-1`). ## Where the region shows up The region is baked into the **MAIL FROM / SPF MX** record. Its value is `feedback-smtp..amazonses.com` — for example `feedback-smtp.us-east-1.amazonses.com`. This routes bounce and complaint feedback to the correct region. The DKIM record is not region-specific. ## Region values A region is a standard region identifier. These are the values `POST /domains` accepts today: | Region | Identifier | Status | | --- | --- | --- | | North Virginia | `us-east-1` | Available (default) | | Mumbai | `ap-south-1` | Available | | Ireland | `eu-west-1` | Coming soon — returns `validation_error` | | São Paulo | `sa-east-1` | Coming soon — returns `validation_error` | | Tokyo | `ap-northeast-1` | Coming soon — returns `validation_error` | Pick the available region closest to the majority of your recipients to reduce latency and improve time-to-inbox. The region you pass is the region the identity is created in, and it is baked into the DNS records you publish — so an `ap-south-1` domain gets `feedback-smtp.ap-south-1.amazonses.com`, not the `us-east-1` value. > **Warning:** Any identifier outside the five above (for example `us-west-2`) is not recognised and silently falls back to the default `us-east-1` rather than erroring — always read the `region` field back off the created domain object to confirm what you got. ## Data residency The region controls only where your email is **routed and dispatched from** — it does not control where your account data is stored. Email metadata, logs, and API records are retained in SendDart’s configured storage region regardless of the sending region. ## Changing a domain’s region Because the sending identity and its DNS records are tied to a region, you cannot move an existing domain to a different region in place. To switch regions: 1. Delete the current domain ([`DELETE /domains/:id`](https://www.senddart.com/docs/api/domains-delete) or the dashboard). 2. Add the same domain again, selecting the new region. 3. Update your DNS records to match the new identity’s SPF/DKIM values, then [re-verify](https://www.senddart.com/docs/api/domains-verify). > **Note:** The `region` field is returned on every domain object so you can see which region your domain lives in. See [DNS records](https://www.senddart.com/docs/domains/dns) for the full record set. --- # Implementing DMARC > Publish a DMARC TXT record to protect your domain from spoofing, then graduate the policy from none to quarantine to reject. DMARC builds trust in your domain and protects it from spoofing — forged mail sent in your name. It is published as a TXT record at `_dmarc` on your domain and tells receiving mail servers what to do with messages from you that fail authentication. ## Prerequisites DMARC sits on top of SPF and DKIM, so your mail must already pass them: - **DKIM** cryptographically proves the message was not altered in transit. - **SPF** authorizes the IP addresses allowed to send for your domain. > **Note:** If you have a [verified domain](https://www.senddart.com/docs/domains/managing) in SendDart, you are already passing SPF and DKIM — so you are ready to add DMARC. ## What is DMARC? DMARC (Domain-based Message Authentication, Reporting, and Conformance) instructs mailbox providers how to handle a message that fails SPF and DKIM, and gives you reports on who is sending in your name. A message achieves **DMARC compliance** if it passes *either* SPF *or* DKIM (it need not pass both); it fails DMARC only when both fail. ## Step 1 — Publish a starter record Begin with a permissive `p=none` policy so you can observe without affecting delivery: **TXT record** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Name` | host | No | `_dmarc.example.com` | | `Type` | record | No | `TXT` | | `Value` | string | No | `v=DMARC1; p=none; rua=mailto:dmarcreports@example.com;` | The key tags in that value are: - `v` — the DMARC **version** (always `DMARC1`). - `p` — the **policy** applied to failing mail: `none`, `quarantine`, or `reject`. Start at `none`. - `rua` — the **aggregate report** address. Provide a real mailbox (it can live on another domain); reports arrive as an email with an attached `.xml` summarizing your sources and whether they passed SPF/DKIM. ## Step 2 — Confirm delivery and passing Send from every application and service that mails as your domain, confirm those messages land in the inbox, and inspect the headers for `dmarc=pass`. Spend a few days here so you catch sources that send on an irregular cadence. > **Note:** Tools like Google Postmaster Tools surface SPF/DKIM feedback, and DMARC monitoring services aggregate your `rua` reports — both help you discover every service sending on your behalf before you tighten the policy. ## Step 3 — Upgrade the policy Once every legitimate source is passing, raise the policy. The three options: | Policy | Effect | | --- | --- | | `p=none;` | Deliver everything; monitor failures only. | | `p=quarantine;` | Route messages that fail DMARC to the spam folder. | | `p=reject;` | Bounce messages that fail DMARC outright. | > **Warning:** Only move to `quarantine` or `reject` after you have confirmed all of your real mail passes — otherwise you risk junking or bouncing your own legitimate email. A policy of `p=quarantine;` or `p=reject;` is also the prerequisite for [BIMI](https://www.senddart.com/docs/domains/bimi), which can display your brand logo as the sender avatar. ## Tag reference | Tag | Purpose | Example | | --- | --- | --- | | `v` | Protocol version | `v=DMARC1` | | `p` | Policy for the organizational domain | `p=quarantine` | | `sp` | Policy for subdomains | `sp=reject` | | `rua` | Aggregate report address | `rua=mailto:aggrep@example.com` | | `ruf` | Forensic report address | `ruf=mailto:authfail@example.com` | | `pct` | Percentage of mail subjected to filtering | `pct=20` | | `adkim` | DKIM alignment mode | `adkim=s` | | `aspf` | SPF alignment mode | `aspf=r` | > **Note:** Mailbox providers honor `pct` and `ruf` inconsistently, so do not rely on them — treat `p`, `rua`, and the alignment tags as the parts that actually take effect. --- # Implementing BIMI > Display your brand logo as the sender avatar in supporting inboxes by publishing a BIMI record backed by a DMARC policy and a mark certificate. BIMI (Brand Indicators for Message Identification) lets you show your logo — and, with the right certificate, a verification checkmark — next to your messages in the inbox. It increases brand recognition and trust, and many major providers now support it. ## Prerequisites - Establish **verifiable use** of your logo — either a registered trademark, or documented use of the logo for over a year. - Publish a [DMARC record](https://www.senddart.com/docs/domains/dmarc) with a policy of `p=quarantine;` or `p=reject;` (BIMI will not work at `p=none;`). ## Client support Support depends on the kind of certificate you hold — a Verified Mark Certificate (VMC) or a Common Mark Certificate (CMC): | Client | With a CMC | With a VMC | No certificate | | --- | --- | --- | --- | | Apple Mail | No | Yes | No | | Gmail | Yes | Yes | No | | Outlook | No | No | No | | Yahoo | Yes | Yes | Yes | ## Step 1 — Configure DMARC BIMI requires an enforced DMARC policy so that no one else can spoof your domain and ride on your logo. The relevant tags: | Tag | Purpose | Required value | | --- | --- | --- | | `p` | Policy | `p=quarantine;` or `p=reject;` | | `pct` | Percentage | `pct=100;` | ```text v=DMARC1; p=quarantine; pct=100; rua=mailto:dmarcreports@example.com ``` > **Warning:** For BIMI on a subdomain, the root (apex) domain must also publish a `p=quarantine` or `p=reject` policy. Without it the subdomain is not BIMI-compliant and the logo will not show. If you have not set up DMARC yet, follow [Implementing DMARC](https://www.senddart.com/docs/domains/dmarc) first. ## Step 2 — Get a mark certificate To display your logo in most clients you must prove ownership of it with a mark certificate, much like obtaining an SSL certificate for a website. The two types: - **Verified Mark Certificate (VMC)** — available if you hold a **trademark** of the logo. Widest support; Gmail shows a blue checkmark alongside the logo. - **Common Mark Certificate (CMC)** — available if you can show you have **used the logo for at least a year** (no trademark needed). Currently supported mainly by Gmail. Certificates are issued by authorized mark verifying authorities such as DigiCert, GlobalSign, and SSL.com. Before you start, know that: - You cannot get a certificate without a trademark *or* a documented year of logo use. - The process can take weeks — start early and respond to the authority’s requests promptly. - You will need an **SVG Tiny P/S** formatted logo, a DNS record to prove domain ownership, identification proving you own the trademark/logo, and publicly available proof your business exists. ## Step 3 — Publish the BIMI record With the certificate in hand, add a TXT record that points to your logo and your certificate: **TXT record** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Name` | host | No | `default._bimi` | | `Type` | record | No | `TXT` | | `Value` | string | No | `v=BIMI1; l=link_to_logo; a=link_to_certificate;` | ```text v=BIMI1; l=https://vmc.example.com/00-00.svg; a=https://vmc.example.com/00-00.pem; ``` > **Warning:** Serve both the logo (`.svg`) and the certificate (`.pem`) over **HTTPS** — providers will not display a logo fetched from an HTTP URL. It often takes a few days after the record propagates for the logo to appear, and mailbox providers decide whether to show it based on your domain’s sending volume and reputation. A domain with a high spam or bounce rate may not get its avatar displayed. ## Tag reference | Tag | Purpose | Example | | --- | --- | --- | | `v` | BIMI version | `v=BIMI1` | | `l` | Logo URL | `l=https://vmc.example.com/00-00.svg` | | `a` | Certificate URL | `a=https://vmc.example.com/00-00.pem` | | `s` | Selector (for multiple logos) | `s=springlogo` | --- # Claiming a domain > Take over a domain that another account has already verified by proving DNS control through the claim flow. When you try to add a domain that **another account** has already verified, SendDart blocks the creation and tells you the domain can be **claimed**. Claiming lets you prove control of the domain over DNS and transfer it to your account — entirely over the API. ## How it works 1. **Start a claim** — Call [Claim domain](https://www.senddart.com/docs/domains/claim) with the domain name. SendDart creates a placeholder domain on your account and returns a `domain_claim` containing a TXT `record` to add to your DNS. 2. **Add the TXT record** — Publish the returned TXT record at your DNS provider. It proves you control the domain. 3. **Verify the claim** — Call [Verify domain claim](https://www.senddart.com/docs/domains/claim). SendDart checks the TXT record and, once it resolves, transfers the domain to your account. 4. **Track the status** — Poll [Get domain claim](https://www.senddart.com/docs/domains/claim) until the claim reaches `completed`. ## Claim statuses | Status | Meaning | | --- | --- | | `pending` | Waiting for DNS verification. | | `verified` | DNS proof accepted; the transfer is in progress. | | `completed` | The domain now belongs to your account. | | `failed` | The claim could not be completed. | | `expired` | The claim window passed before it completed. | ## Start a claim **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.domains.claim({ "name": "example.com" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Domains.claim({ "name": "example.com" }) ``` **PHP** ```php domains->claim([ 'name' => "example.com" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Domains.claim({ "name": "example.com" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") claim, err := client.Domains.Claim(&senddart.ClaimDomainRequest{ Name: "example.com", }) ``` **Rust** ```rust use senddart::{ClaimDomainOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let _claim = mb.domains.claim(ClaimDomainOptions::new("example.com")).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.ClaimDomainRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.domains().claim(ClaimDomainRequest.builder().name("example.com").build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.DomainClaimAsync(new DomainClaimOptions { Name = "example.com" }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/domains/claim' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "example.com" }' ``` **CLI** ```bash senddart domains claim start example.com ``` ## Canceling a claim Cancel a pending claim by deleting its placeholder domain with [Delete domain](https://www.senddart.com/docs/api/domains-delete), using the `domain_id` from the `domain_claim` object. > **Note:** The claim flow only ever transfers a domain after DNS ownership has been proven by the TXT record, so a domain can only be claimed by someone who controls its DNS. --- # Logs > Every email has a per-email event timeline — sent, delivered, bounced, complained, opened, clicked, delivery_delayed — in the dashboard, via GET /emails/:id, and forwarded to webhooks. Every email you send through the API gets a **per-email event timeline**. As the message moves through SendDart’s sending infrastructure and reaches the recipient, SendDart records each event against the email’s `id`, giving you a complete delivery and engagement history. ## Event types | Event | Meaning | | --- | --- | | `sent` | SendDart accepted the email for delivery. | | `delivered` | The receiving mail server confirmed it accepted the message. | | `bounced` | The message could not be delivered (e.g. unknown mailbox or a hard rejection). | | `complained` | The recipient marked the message as spam. | | `opened` | The recipient’s mail client loaded the tracking pixel (requires [open tracking](https://www.senddart.com/docs/domains/tracking)). | | `clicked` | The recipient clicked a tracked link (requires [click tracking](https://www.senddart.com/docs/domains/tracking)). | | `delivery_delayed` | Delivery was temporarily deferred and is being retried. | ## Where to find the timeline - In the **dashboard** — open an email to see its full event timeline. - Via the **API** — fetch the email with [`GET /emails/:id`](https://www.senddart.com/docs/api/emails-get) to read its current status and events. - Via **webhooks** — each event is also forwarded to your configured webhook endpoints in real time. See [Webhooks](https://www.senddart.com/docs/webhooks/overview). > **Note:** Open and click events only appear when the sending domain has the corresponding tracking toggle enabled. See [Open and click tracking](https://www.senddart.com/docs/domains/tracking). ## API request logs Separately from the per-email timeline, SendDart records a log of the **API requests** your keys make. This is useful for monitoring activity and troubleshooting integration issues. Each log entry shows: - **Endpoint** — the request path called (e.g. `/api/domains`, `/api/api-keys`, `/api/contacts`). - **Status** — the HTTP response status code (`200`, `201`, etc.). - **Method** — the HTTP method used (`GET`, `POST`, `DELETE`, etc.). - **Created** — when the request was made (shown as relative time). ### Searching and filtering Use the search bar to find a request by path. You can narrow the list further with: - **Time range** — Past 24 hours, Past 7 days, or Past 30 days. - **Method** — `GET`, `POST`, `PATCH`, or `DELETE`. - **Status** — `2xx` success, `4xx` client error, or `5xx` server error. Leave it on **All statuses** to view everything. ### Log details Open any log entry to see the full request body and response body, alongside the HTTP method, path, endpoint, status code, duration, API key used, timestamp, and User-Agent. The same log entries are available over the API — see [List Logs](https://www.senddart.com/docs/api/logs-list) and [Retrieve Log](https://www.senddart.com/docs/api/logs-get). --- # API keys > Create, scope, edit, and revoke API keys in the dashboard. Keys start with mb_, carry a full_access or sending_access permission, and are shown in full exactly once. Every API request authenticates with an API key sent as a Bearer token (see [Authentication](https://www.senddart.com/docs/authentication)). Keys are created, re-scoped and revoked **in the dashboard** under **API Keys** — see [Create an API key](https://www.senddart.com/docs/create-an-api-key). A key is returned **once** at creation — the full `mb_...` token is shown a single time, and only its hash and prefix are stored afterward. If you lose it, create a new one. > **Warning:** Copy the key immediately when you create it. SendDart cannot show it again; there is no way to recover the full token later. ## Permissions Each key has a permission level that controls what it can do: | Permission | Can do | | --- | --- | | `full_access` | Send email **and** manage resources — domains, audiences, contacts, campaigns, and webhooks. It can *list* API keys, but cannot create, re-scope or revoke them. | | `sending_access` | Send email only. Cannot create or delete domains, audiences or campaigns. | Prefer a `sending_access` key for any server that only needs to send email — it limits the blast radius if the key leaks. > **Warning:** No API key can create, re-scope or revoke an API key — `POST /api-keys`, `PATCH /api-keys/:id` and `DELETE /api-keys/:id` answer `403 dashboard_only` to every key, whatever its permission. Key lifecycle is dashboard-only by design, so a leaked key can never mint itself a replacement or widen its own access. You can create multiple keys to isolate different applications or environments. Scoping each integration to its own key lets you track its usage independently, spot abuse, and revoke just that key if it leaks — without disrupting your other services. ## Tracking usage Each key records when it was **last used**. List your keys with [`GET /api-keys`](https://www.senddart.com/docs/api/api-keys-list) — each entry carries a `last_used_at` timestamp (null if the key has never been used) alongside its `name` and `created_at`. The dashboard surfaces the same signal so you can scan which keys are active and which are dormant. ## Editing, rotation, and revocation A key's **name, permission, and domain restriction** can be changed in place with [`PATCH /api-keys/:id`](https://www.senddart.com/docs/api/api-keys-update) — no need to mint a new token just to narrow or widen what an existing key may do. The secret itself is immutable: keys do not expire on their own, and to rotate one you create a new key, deploy it, then delete the old one — deletion is immediate and irreversible. A revoked key returns `403 invalid_api_key` on its next use. > **Note:** If a key has not been used in the last 30 days, consider deleting it to keep your account secure. Dormant keys widen your attack surface for no benefit. - Create a key: [`POST /api-keys`](https://www.senddart.com/docs/api/api-keys-create). - List keys (metadata only — never the token): [`GET /api-keys`](https://www.senddart.com/docs/api/api-keys-list). - Update a key's name, permission, or domain restriction: [`PATCH /api-keys/:id`](https://www.senddart.com/docs/api/api-keys-update). - Revoke a key: [`DELETE /api-keys/:id`](https://www.senddart.com/docs/api/api-keys-delete). --- # Managing webhooks > Subscribe an HTTPS endpoint to delivery and engagement events. SendDart POSTs a signed JSON payload to your URL and retries with backoff on failure. Webhooks push email events to your own server in near-real time, so you do not have to poll. When an email is delivered, opened, clicked, bounces, or is complained about, SendDart sends an HTTP `POST` with a JSON body to the endpoint(s) you have configured. Each delivery is signed so you can verify it really came from SendDart — see [Verify webhook requests](https://www.senddart.com/docs/webhooks/verify). ## Configuring an endpoint 1. **Add an endpoint** — In the dashboard, add a webhook with the HTTPS URL that should receive events. The URL must be publicly reachable over HTTPS and resolve to a public IP (private/loopback addresses are rejected). 2. **Choose events** — Select which events the endpoint should receive. Events you do not subscribe to are never delivered. See [Event types](https://www.senddart.com/docs/webhooks/events) for the full list. 3. **Save the signing secret** — A `whsec_` signing secret is generated for the endpoint and shown once. Store it securely — you will use it to verify every incoming request. 4. **Verify and go live** — Use the dashboard Test button to send a sample delivery, confirm your endpoint returns a 2xx, then start handling live events. > **Warning:** Your endpoint must respond with a 2xx status. Any non-2xx response (or a timeout) counts as a failed delivery and is retried. Webhooks can also be managed programmatically via the API — see [Create webhook](https://www.senddart.com/docs/api/webhooks-create), [List webhooks](https://www.senddart.com/docs/api/webhooks-list), and the retrieve/update/delete endpoints. The create call returns the `whsec_` signing secret in the response body; retrieve and list never do. If you lose it, `POST /webhooks/:id/rotate` issues a new one and invalidates the old. ## The payload Each delivery is a JSON body in the envelope `{ "type", "created_at", "data" }`, where `data` holds the resource-specific fields for that event. See [Event types](https://www.senddart.com/docs/webhooks/events) for the envelope and a sample, and the per-event pages for each `data` shape. ## The signing secret Each endpoint has its own signing secret. SendDart uses it to compute an HMAC-SHA256 signature over `"."` and sends that in the `X-SendDart-Signature` header. Keep the secret server-side — anyone with it can forge events. The secret is stored encrypted at rest. ## Delivery, timeouts, and retries Each delivery is a single `POST` with a 10-second timeout. A delivery is considered successful only on a 2xx response. - On failure, SendDart retries — up to **5 attempts total** (the initial attempt plus 4 retries). - Retries use an increasing backoff of roughly **1, 5, 30, then 120 minutes**. - The attempt number is included in each request as the `X-SendDart-Attempt` header (starting at 1), so you can detect retries. - An endpoint that fails **50 consecutive deliveries** is automatically disabled. Re-enable it from the dashboard once your endpoint is healthy. > **Note:** Make your handler idempotent. Because failed deliveries retry and event transports can redeliver, your endpoint may occasionally receive the same event more than once. ## Duplicates, ordering, and exhausted retries - **Duplicates are possible** — a timeout can occur after your server has processed a request. Deduplicate on the `svix-id` header, which stays stable across retries of a delivery. Persist accepted events before acknowledging them. - **Retries are bounded** — a delivery can remain unsuccessful after the attempt limit, or while an endpoint is disabled. Monitor failures and reconcile important email states through the API; successful receipt of every event is not guaranteed. - **No ordering guarantee** — network conditions and retries can change arrival order. Keep event history and apply event-aware state updates so a late event does not incorrectly reverse a later state. The payload timestamp helps investigation, but sorting received timestamps alone cannot recover a missing event or resolve every state transition. --- # Event types > The full set of webhook events SendDart emits, the JSON payload shape, and a sample request body. Events span three resource families — **email**, **contact**, and **domain** — each delivered with a dotted `type` such as `email.delivered` or `contact.created`. The tables below list every event you can subscribe to; click an event for its full per-event payload. ### Email events | Event | Fires when | | --- | --- | | [`email.sent`](https://www.senddart.com/docs/webhooks/emails/sent) | The send request succeeded and the message was handed off to the sending infrastructure. | | [`email.delivered`](https://www.senddart.com/docs/webhooks/emails/delivered) | The receiving mail server accepted the message for the recipient. | | [`email.delivery_delayed`](https://www.senddart.com/docs/webhooks/emails/delivery-delayed) | Delivery was temporarily delayed (e.g. the recipient's inbox is full or the receiving server had a transient issue) and will be retried. | | [`email.bounced`](https://www.senddart.com/docs/webhooks/emails/bounced) | The recipient's mail server permanently rejected the message. The recipient is added to your suppression list. | | [`email.complained`](https://www.senddart.com/docs/webhooks/emails/complained) | The message was delivered but the recipient marked it as spam. The recipient is added to your suppression list. | | [`email.opened`](https://www.senddart.com/docs/webhooks/emails/opened) | The recipient opened the email (requires open tracking on the domain). | | [`email.clicked`](https://www.senddart.com/docs/webhooks/emails/clicked) | The recipient clicked a tracked link (requires click tracking on the domain). | | [`email.failed`](https://www.senddart.com/docs/webhooks/emails/failed) | The email failed to send due to an error — e.g. an invalid recipient, a domain-verification problem, or a reached daily sending quota. | | [`email.scheduled`](https://www.senddart.com/docs/webhooks/emails/scheduled) | A future-dated send (via `scheduled_at` or a natural-language schedule) was accepted and queued for its send time. | | [`email.suppressed`](https://www.senddart.com/docs/webhooks/emails/suppressed) | A send was skipped because the recipient is on your account suppression list (typically from a prior hard bounce or complaint). | | [`email.received`](https://www.senddart.com/docs/webhooks/emails/received) | An inbound email arrived at one of your verified domains (Inbound). Retrieve it at `GET /emails/receiving/:id`. | | [`email.replied`](https://www.senddart.com/docs/webhooks/emails/replied) | A recipient replied to an email you sent (the first reply only). Carries the sent email id and the received reply id. | | [`email.unsubscribed`](https://www.senddart.com/docs/webhooks/emails/unsubscribed) | A recipient unsubscribed — via a one-click List-Unsubscribe, the footer link, or the preference center. | ### Contact events | Event | Fires when | | --- | --- | | [`contact.created`](https://www.senddart.com/docs/webhooks/contacts/created) | A contact was successfully created in one of your audiences. Not fired for contacts added by a bulk CSV import. | | [`contact.updated`](https://www.senddart.com/docs/webhooks/contacts/updated) | A contact was successfully updated — for example its name changed, or it was subscribed or unsubscribed. | | [`contact.deleted`](https://www.senddart.com/docs/webhooks/contacts/deleted) | A contact was successfully deleted from one of your audiences. | ### Domain events | Event | Fires when | | --- | --- | | [`domain.created`](https://www.senddart.com/docs/webhooks/domains/created) | A domain was successfully created in your account (before its DNS records are verified). | | [`domain.updated`](https://www.senddart.com/docs/webhooks/domains/updated) | A domain changed — most commonly as its verification status advances toward `verified`. | | [`domain.deleted`](https://www.senddart.com/docs/webhooks/domains/deleted) | A domain was successfully deleted from your account. | ## Payload envelope Every event — regardless of family — is delivered in the same envelope. The resource-specific fields live under `data`; its shape depends on the event `type` (see each event page above). **Envelope fields** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type, e.g. `email.delivered`, `contact.created`, or `domain.updated`. | | `created_at` | string | No | ISO 8601 time the delivery was dispatched. | | `data` | object | No | The event-specific payload. For email events this includes `email_id`, `from`, `to`, `subject`, and event-specific detail (e.g. a `bounce`, `click`, or `suppressed` object); for contact/domain events it carries the contact or domain object. | ## Sample payload ```json { "type": "email.delivered", "created_at": "2026-06-23T10:15:32.118Z", "data": { "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "campaign_id": null, "from": "Acme ", "to": ["recipient@example.com"], "subject": "What's new in June", "created_at": "2026-06-23T10:15:31.880Z" } } ``` > **Note:** Each request also carries `X-SendDart-Event` (the event type) and `X-SendDart-Attempt` (the delivery attempt number, starting at 1) headers, plus the Svix signature headers used to [verify the request](https://www.senddart.com/docs/webhooks/verify). Because deliveries can be retried, dedupe on the `svix-id` header. --- # Verify webhook requests > Every webhook request is signed with HMAC-SHA256 over ".". Recompute the signature with your signing secret and compare it against the X-SendDart-Signature header. Because your webhook URL is public, you should verify that each request actually came from SendDart before trusting it. Every delivery includes an `X-SendDart-Timestamp` header (Unix seconds) and an `X-SendDart-Signature` header containing an HMAC-SHA256 signature of **that timestamp, a `.`, and the raw request body**, computed with your endpoint signing secret. To verify: recompute the HMAC over `"."` using the exact bytes you received and compare it, using a constant-time comparison, to the header. ## How the signature is computed - Algorithm: **HMAC-SHA256**. - Key: your endpoint **signing secret**. - Message: the string `"."` — the timestamp header, a literal `.`, then the **raw JSON request body** exactly as sent (verify before any re-serialization). - Encoding: lowercase **hex**. > **Warning:** Verify against the raw request bytes, not a re-stringified object. Parsing and re-serializing the JSON can change whitespace or key order and break the signature. Omitting the `.` prefix breaks it too. ## Pseudocode ```text signature = X-SendDart-Signature header timestamp = X-SendDart-Timestamp header expected = hex( HMAC_SHA256(key = signing_secret, message = timestamp + "." + raw_body) ) valid = constant_time_equals(signature, expected) ``` ## Example **Node.js** ```js import crypto from 'node:crypto'; import express from 'express'; const app = express(); const SIGNING_SECRET = process.env.SENDDART_WEBHOOK_SECRET; // Capture the RAW body so the signature matches exactly. app.post('/webhooks/senddart', express.raw({ type: 'application/json' }), (req, res) => { // Signed content is "." from this request's headers. const timestamp = req.get('X-SendDart-Timestamp') || ''; const signature = req.get('X-SendDart-Signature') || ''; const expected = crypto .createHmac('sha256', SIGNING_SECRET) .update(`${timestamp}.${req.body}`) // req.body is a Buffer of the raw bytes .digest('hex'); const a = Buffer.from(signature); const b = Buffer.from(expected); if (!timestamp || a.length !== b.length || !crypto.timingSafeEqual(a, b)) { return res.status(400).send('invalid signature'); } const payload = JSON.parse(req.body.toString('utf8')); console.log(payload.type, payload.data.email_id); res.status(200).send('ok'); }); ``` **Python** ```python import hmac import hashlib from flask import Flask, request, abort app = Flask(__name__) SIGNING_SECRET = b"whsec_your_signing_secret" @app.post("/webhooks/senddart") def senddart_webhook(): raw = request.get_data() # raw bytes timestamp = request.headers.get("X-SendDart-Timestamp", "") signature = request.headers.get("X-SendDart-Signature", "") # Signed content is ".". expected = hmac.new(SIGNING_SECRET, timestamp.encode() + b"." + raw, hashlib.sha256).hexdigest() if not timestamp or not hmac.compare_digest(signature, expected): abort(400) payload = request.get_json() print(payload["type"], payload["data"]["email_id"]) return "ok", 200 ``` > **Note:** Always use a constant-time comparison (`crypto.timingSafeEqual`, `hmac.compare_digest`) rather than `==` to avoid timing side channels. ## Svix-compatible verification Every delivery is **also** signed with the Svix scheme, so you can verify it with the off-the-shelf [`svix`](https://www.npmjs.com/package/svix) library instead of hand-rolling HMAC. Each request carries three extra headers: `svix-id` (a unique per-message id), `svix-timestamp` (Unix seconds), and `svix-signature`. The signed content is `{svix-id}.{svix-timestamp}.{raw_body}`; the signature is the base64 HMAC-SHA256 of that string, keyed by the base64-decoded suffix of your `whsec_` signing secret, tagged `v1,`. The `whsec_` secret is shown once when you create the endpoint, and is also returned by the create and rotate webhook API calls. The `svix` library handles all of this for you. ### Why verify Because your endpoint URL is public, anyone could POST forged events to it. The signature proves the request came from SendDart. It also defends against **replay attacks** — an attacker re-sending a previously valid, correctly-signed request — by binding each signature to a timestamp. ### Timestamp tolerance window The signature covers `svix-timestamp`, so a verifier should reject deliveries whose timestamp is too far from the current time. The `svix` library enforces a **±5 minute** tolerance by default; if you verify by hand, compare `svix-timestamp` against your clock and reject anything outside that window (and keep your server clock in sync via NTP). Reject mismatched or stale signatures with a non-2xx so the delivery is recorded as failed. > **Note:** Each event is delivered **at least once**. To deduplicate retries and replays, store the `svix-id` of every processed event and skip any id you have already seen. **Node.js (svix)** ```js import { Webhook } from 'svix'; import express from 'express'; const app = express(); const wh = new Webhook(process.env.SENDDART_WEBHOOK_SECRET); // whsec_... app.post('/webhooks/senddart', express.raw({ type: 'application/json' }), (req, res) => { try { const payload = wh.verify(req.body, { 'svix-id': req.get('svix-id'), 'svix-timestamp': req.get('svix-timestamp'), 'svix-signature': req.get('svix-signature'), }); console.log(payload.event, payload.email_id); res.status(200).send('ok'); } catch { res.status(400).send('invalid signature'); } }); ``` **Python (svix)** ```python from svix.webhooks import Webhook, WebhookVerificationError from flask import Flask, request, abort app = Flask(__name__) wh = Webhook("whsec_your_signing_secret") @app.post("/webhooks/senddart") def senddart_webhook(): try: payload = wh.verify(request.get_data(), dict(request.headers)) except WebhookVerificationError: abort(400) print(payload["event"], payload["email_id"]) return "ok", 200 ``` --- # email.sent > Fires when an email is accepted by SendDart and handed off for delivery to the recipient's mail server. The `email.sent` event fires whenever the **API request to send an email was successful**. SendDart has accepted the message and will attempt to deliver it to the recipient's mail server — a successful delivery is later reported by [`email.delivered`](https://www.senddart.com/docs/webhooks/emails/delivered). Every payload follows the shared envelope: a top-level `type`, `created_at`, and a `data` object with the event-specific fields. ```json { "type": "email.sent", "created_at": "2026-06-22T23:41:12.126Z", "data": { "campaign_id": "8b146471-e88e-4322-86af-016cd36fd216", "created_at": "2026-06-22T23:41:11.894719+00:00", "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "message_id": "<111-222-333@email.example.com>", "from": "Acme ", "to": ["recipient@example.com"], "subject": "Sending this example", "template_id": "43f68331-0622-4e15-8202-246a0388854b" } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.campaign_id` | string | No | Identifier for the campaign, if the email was sent as part of one. | | `data.created_at` | string | No | ISO 8601 timestamp when the email was created. | | `data.email_id` | string | No | Unique identifier for this email. | | `data.message_id` | string | No | RFC Message-ID header value for the email. | | `data.from` | string | No | Sender address as passed at send time; may include a display name (e.g. `Name `). | | `data.to` | string[] | No | Recipient email address(es). | | `data.subject` | string | No | Email subject line. | | `data.template_id` | string | No | Identifier of the template used, if applicable. | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # email.delivered > Fires when the recipient's mail server accepts the message for delivery. The `email.delivered` event fires when SendDart has **successfully delivered the email** to the recipient's mail server. This is the positive counterpart to [`email.bounced`](https://www.senddart.com/docs/webhooks/emails/bounced). Delivery to the mail server does not guarantee the message reached the inbox — it may still be filtered to spam by the receiving provider. ```json { "type": "email.delivered", "created_at": "2026-06-22T23:41:12.126Z", "data": { "campaign_id": "8b146471-e88e-4322-86af-016cd36fd216", "created_at": "2026-06-22T23:41:11.894719+00:00", "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "message_id": "<111-222-333@email.example.com>", "from": "Acme ", "to": ["recipient@example.com"], "subject": "Sending this example", "template_id": "43f68331-0622-4e15-8202-246a0388854b" } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.campaign_id` | string | No | Identifier for the campaign, if applicable. | | `data.created_at` | string | No | ISO 8601 timestamp when the email was created. | | `data.email_id` | string | No | Unique identifier for this email. | | `data.message_id` | string | No | RFC Message-ID header value for the email. | | `data.from` | string | No | Sender address; may include a display name. | | `data.to` | string[] | No | Recipient email address(es). | | `data.subject` | string | No | Email subject line. | | `data.template_id` | string | No | Identifier of the template used, if applicable. | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # email.delivery_delayed > Fires when an email could not be delivered due to a temporary issue and will be retried. The `email.delivery_delayed` event fires when an email **couldn't be delivered due to a temporary issue** — for example a full recipient inbox, greylisting, or a transient problem on the receiving server. A delay is not a failure: SendDart keeps retrying delivery. You may still receive a later [`email.delivered`](https://www.senddart.com/docs/webhooks/emails/delivered) or [`email.bounced`](https://www.senddart.com/docs/webhooks/emails/bounced) for the same `email_id`. ```json { "type": "email.delivery_delayed", "created_at": "2026-06-22T23:41:12.126Z", "data": { "campaign_id": "8b146471-e88e-4322-86af-016cd36fd216", "created_at": "2026-06-22T23:41:11.894719+00:00", "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "message_id": "<111-222-333@email.example.com>", "from": "Acme ", "to": ["recipient@example.com"], "subject": "Sending this example", "template_id": "43f68331-0622-4e15-8202-246a0388854b" } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.campaign_id` | string | No | Identifier for the campaign, if applicable. | | `data.created_at` | string | No | ISO 8601 timestamp when the email was created. | | `data.email_id` | string | No | Unique identifier for this email. | | `data.message_id` | string | No | RFC Message-ID header value for the email. | | `data.from` | string | No | Sender address; may include a display name. | | `data.to` | string[] | No | Recipient email address(es). | | `data.subject` | string | No | Email subject line. | | `data.template_id` | string | No | Identifier of the template used, if applicable. | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # email.complained > Fires when an email was delivered but the recipient marked it as spam. The `email.complained` event fires when an email was successfully **delivered, but the recipient marked it as spam**. Complaints are a strong negative signal for your sender reputation. SendDart adds the complaining address to your account suppression list so future sends to it are skipped automatically. ```json { "type": "email.complained", "created_at": "2026-06-22T23:41:12.126Z", "data": { "campaign_id": "8b146471-e88e-4322-86af-016cd36fd216", "created_at": "2026-06-22T23:41:11.894719+00:00", "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "message_id": "<111-222-333@email.example.com>", "from": "Acme ", "to": ["recipient@example.com"], "subject": "Sending this example", "template_id": "43f68331-0622-4e15-8202-246a0388854b" } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.campaign_id` | string | No | Identifier for the campaign, if applicable. | | `data.created_at` | string | No | ISO 8601 timestamp when the email was created. | | `data.email_id` | string | No | Unique identifier for this email. | | `data.message_id` | string | No | RFC Message-ID header value for the email. | | `data.from` | string | No | Sender address; may include a display name. | | `data.to` | string[] | No | Recipient email address(es). | | `data.subject` | string | No | Email subject line. | | `data.template_id` | string | No | Identifier of the template used, if applicable. | > **Warning:** A complaint adds the recipient to your suppression list. Treat it as a hard opt-out and do not attempt to send to them again. > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # email.bounced > Fires when the recipient's mail server permanently rejected the email. The address is added to your suppression list. The `email.bounced` event fires when the recipient's mail server **permanently rejected the email**. The `data.bounce` object carries the SMTP diagnostics and a classification of the bounce. A hard bounce adds the address to your account suppression list, so subsequent sends are skipped to protect your reputation. ```json { "type": "email.bounced", "created_at": "2026-06-22T23:41:12.126Z", "data": { "campaign_id": "8b146471-e88e-4322-86af-016cd36fd216", "created_at": "2026-06-22T23:41:11.894719+00:00", "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "message_id": "<111-222-333@email.example.com>", "from": "Acme ", "to": ["recipient@example.com"], "subject": "Sending this example", "template_id": "43f68331-0622-4e15-8202-246a0388854b", "bounce": { "diagnosticCode": ["smtp; 550 5.1.1 user unknown"], "message": "The recipient's email address is on the suppression list because it has a recent history of producing hard bounces.", "subType": "Suppressed", "type": "Permanent" } } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.campaign_id` | string | No | Identifier for the campaign, if applicable. | | `data.created_at` | string | No | ISO 8601 timestamp when the email was created. | | `data.email_id` | string | No | Unique identifier for this email. | | `data.message_id` | string | No | RFC Message-ID header value for the email. | | `data.from` | string | No | Sender address; may include a display name. | | `data.to` | string[] | No | Recipient email address(es). | | `data.subject` | string | No | Email subject line. | | `data.template_id` | string | No | Identifier of the template used, if applicable. | | `data.bounce` | object | No | Bounce details from the receiving server (see below). | | `data.bounce.diagnosticCode` | string[] | No | SMTP diagnostic responses from the receiving server, including status code and reason. | | `data.bounce.message` | string | No | Detailed bounce message from the receiving server. | | `data.bounce.subType` | string | No | Bounce sub-type, e.g. `Suppressed`, `MessageRejected`. | | `data.bounce.type` | string | No | Bounce type, e.g. `Permanent`, `Temporary`. | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # email.opened > Fires the first time a recipient opens the email. Requires open tracking on the sending domain. The `email.opened` event fires the **first time a recipient opens the email**. It is delivered at most once per recipient per email — later opens by the same recipient are recorded against the open count but do not fire another event. It requires open tracking to be enabled on the sending domain. Open rates are not always accurate — image-blocking, prefetching, and privacy proxies can both suppress and inflate opens. Treat opens as a directional signal, not an exact count. ```json { "type": "email.opened", "created_at": "2026-06-22T23:41:12.126Z", "data": { "campaign_id": "8b146471-e88e-4322-86af-016cd36fd216", "created_at": "2026-06-22T23:41:11.894719+00:00", "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "message_id": "<111-222-333@email.example.com>", "from": "Acme ", "to": ["recipient@example.com"], "subject": "Sending this example", "template_id": "43f68331-0622-4e15-8202-246a0388854b" } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.campaign_id` | string | No | Identifier for the campaign, if applicable. | | `data.created_at` | string | No | ISO 8601 timestamp when the email was created. | | `data.email_id` | string | No | Unique identifier for this email. | | `data.message_id` | string | No | RFC Message-ID header value for the email. | | `data.from` | string | No | Sender address; may include a display name. | | `data.to` | string[] | No | Recipient email address(es). | | `data.subject` | string | No | Email subject line. | | `data.template_id` | string | No | Identifier of the template used, if applicable. | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # email.clicked > Fires the first time a recipient clicks a tracked link in the email. Requires click tracking on the sending domain. The `email.clicked` event fires the **first time a recipient clicks a link** in the email. It is delivered at most once per recipient per email — a click on a second link, or a repeat click on the same one, is recorded against the click counts but does not fire another event. It requires click tracking to be enabled on the sending domain. The `data.click` object describes that first click: the URL, the client's IP and user agent, and the timestamp. ```json { "type": "email.clicked", "created_at": "2026-06-22T23:41:12.126Z", "data": { "campaign_id": "8b146471-e88e-4322-86af-016cd36fd216", "created_at": "2026-06-22T23:41:11.894719+00:00", "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "message_id": "<111-222-333@email.example.com>", "from": "Acme ", "to": ["recipient@example.com"], "click": { "ipAddress": "122.115.53.11", "link": "https://example.com", "timestamp": "2026-06-24T05:00:57.163Z", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15" }, "subject": "Sending this example", "template_id": "43f68331-0622-4e15-8202-246a0388854b" } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.campaign_id` | string | No | Identifier for the campaign, if applicable. | | `data.created_at` | string | No | ISO 8601 timestamp when the email was created. | | `data.email_id` | string | No | Unique identifier for this email. | | `data.message_id` | string | No | RFC Message-ID header value for the email. | | `data.from` | string | No | Sender address; may include a display name. | | `data.to` | string[] | No | Recipient email address(es). | | `data.subject` | string | No | Email subject line. | | `data.template_id` | string | No | Identifier of the template used, if applicable. | | `data.click` | object | No | Click tracking details (see below). | | `data.click.ipAddress` | string | No | IP address of the user who clicked the link. | | `data.click.link` | string | No | The URL of the first link this recipient clicked. | | `data.click.timestamp` | string | No | ISO 8601 timestamp when the click occurred. | | `data.click.userAgent` | string | No | User agent string of the browser that clicked the link. | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # email.failed > Fires when an email fails to send due to an error such as an invalid recipient, domain issue, or a reached quota. The `email.failed` event fires when an email **failed to send due to an error**. Common causes include the mail transport rejecting the message, the `from` domain no longer being verified at send time, every recipient being suppressed or unsubscribed, or a scheduled send exhausting its retries against your daily sending quota. The `data.failed` object carries a machine-readable `reason` you can branch on. > **Note:** A request that is refused up front — a malformed address, an unverified `from` domain, or a quota that is already exhausted — is answered synchronously with an error from [POST /emails](https://www.senddart.com/docs/api/emails-send) and never creates an email, so no `email.failed` event fires for it. The event covers emails SendDart accepted and then could not send. ```json { "type": "email.failed", "created_at": "2026-06-22T23:41:12.126Z", "data": { "campaign_id": "8b146471-e88e-4322-86af-016cd36fd216", "created_at": "2026-06-22T23:41:11.894719+00:00", "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "message_id": "<111-222-333@email.example.com>", "from": "Acme ", "to": ["recipient@example.com"], "subject": "Sending this example", "template_id": "43f68331-0622-4e15-8202-246a0388854b", "failed": { "reason": "reached_daily_quota" } } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.campaign_id` | string | No | Identifier for the campaign, if applicable. | | `data.created_at` | string | No | ISO 8601 timestamp when the email was created. | | `data.email_id` | string | No | Unique identifier for this email. | | `data.message_id` | string | No | RFC Message-ID header value for the email. | | `data.from` | string | No | Sender address; may include a display name. | | `data.to` | string[] | No | Recipient email address(es). | | `data.subject` | string | No | Email subject line. | | `data.template_id` | string | No | Identifier of the template used, if applicable. | | `data.failed` | object | No | Failure details (see below). | | `data.failed.reason` | string | No | Reason for the failure, e.g. `reached_daily_quota`. | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # email.scheduled > Fires when an email is accepted for sending at a future time. The `email.scheduled` event fires when an email **is scheduled to be sent** at a future time — for example when you pass a future `scheduled_at` to [`POST /emails`](https://www.senddart.com/docs/api/emails-send). When the scheduled time arrives and the message is dispatched, you will receive [`email.sent`](https://www.senddart.com/docs/webhooks/emails/sent) for the same `email_id`. ```json { "type": "email.scheduled", "created_at": "2026-06-22T23:41:12.126Z", "data": { "campaign_id": "8b146471-e88e-4322-86af-016cd36fd216", "created_at": "2026-06-22T23:41:11.894719+00:00", "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "message_id": "<111-222-333@email.example.com>", "from": "Acme ", "to": ["recipient@example.com"], "subject": "Sending this example", "template_id": "43f68331-0622-4e15-8202-246a0388854b" } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.campaign_id` | string | No | Identifier for the campaign, if applicable. | | `data.created_at` | string | No | ISO 8601 timestamp when the email was created. | | `data.email_id` | string | No | Unique identifier for this email. | | `data.message_id` | string | No | RFC Message-ID header value for the email. | | `data.from` | string | No | Sender address; may include a display name. | | `data.to` | string[] | No | Recipient email address(es). | | `data.subject` | string | No | Email subject line. | | `data.template_id` | string | No | Identifier of the template used, if applicable. | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # email.received > Fires when an inbound email arrives at one of your verified receiving domains. Carries metadata only. The `email.received` event fires whenever SendDart **receives an inbound email** at one of your verified receiving domains. For privacy and to support large attachments in serverless environments, the webhook carries **metadata only** — not the body, headers, or attachment bytes. Fetch the full message from the [received emails API](https://www.senddart.com/docs/api/emails-get) using `data.email_id`. ```json { "type": "email.received", "created_at": "2026-06-22T23:41:12.126Z", "data": { "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "created_at": "2026-06-22T23:41:11.894719+00:00", "from": "sender@example.com", "to": ["inbox@example.com"], "bcc": [], "cc": [], "received_for": ["forwarded@example.com"], "message_id": "<111-222-333@email.example.com>", "subject": "Sending this example", "attachments": [ { "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318", "filename": "avatar.png", "content_type": "image/png", "content_disposition": "inline", "content_id": "img001" } ] } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.email_id` | string | No | Unique identifier for the received email. Use it to fetch the full message. | | `data.created_at` | string | No | ISO 8601 timestamp when the email was received. | | `data.from` | string | No | Bare sender email address. The original display name is preserved on the retrieve endpoint. | | `data.to` | string[] | No | Recipient address(es). | | `data.cc` | string[] | No | Cc address(es). | | `data.bcc` | string[] | No | Bcc address(es). | | `data.received_for` | string[] | No | Addresses the email was forwarded for, taken from the `for` clause of the message's `Received` headers. | | `data.message_id` | string | No | RFC Message-ID header value for the email. | | `data.subject` | string | No | Email subject line. | | `data.attachments` | object[] | No | Attachment metadata only — `id`, `filename`, `content_type`, `content_disposition`, `content_id`. Fetch the bytes separately. | > **Note:** The webhook never includes attachment bytes. Retrieve them from the received email's attachments endpoint using the attachment `id`. > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # email.replied > Fires the first time a recipient replies to an email you sent. The `email.replied` event fires the **first time** a recipient replies to an email you sent. The reply arrives as an inbound message on one of your receiving domains and is matched back to the original send (via its threading headers, or the latest email sent to the replying address). Repeat replies to the same email do **not** re-fire the event — each reply is still stored as its own received email (with an `email.received` event) and linked to the sent email via `reply_to_email_id`. ```json { "type": "email.replied", "created_at": "2026-06-22T23:41:12.126Z", "data": { "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "received_email_id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "from": "recipient@example.com", "subject": "Re: Sending this example", "occurred_at": "2026-06-22T23:41:11.894Z" } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.email_id` | string | No | The id of the **sent** email that was replied to. | | `data.received_email_id` | string | No | The id of the received reply. Fetch its content from [GET /emails/receiving/:id](https://www.senddart.com/docs/api/emails-received-get) — including the AI-classified reply intent (`category`). | | `data.from` | string | No | The replying sender's address. | | `data.subject` | string | No | The reply's subject line. | | `data.occurred_at` | string | No | ISO 8601 timestamp when the reply was recorded. | > **Note:** Replies also flip the sent email's `status`/`last_event` to `replied` and can trigger automations via the `email.replied` engagement trigger. > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # email.unsubscribed > Fires the first time a recipient unsubscribes from your mail. The `email.unsubscribed` event fires the **first time** a recipient opts out — via an RFC 8058 one-click List-Unsubscribe, the unsubscribe footer link, or the hosted preference center. Repeat opt-outs of an already-unsubscribed address do **not** re-fire it. The recipient is marked unsubscribed in the relevant audience, so future campaign sends skip them automatically. ```json { "type": "email.unsubscribed", "created_at": "2026-06-22T23:41:12.126Z", "data": { "recipient_email": "recipient@example.com", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "occurred_at": "2026-06-22T23:41:11.894Z" } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.recipient_email` | string | No | The address that unsubscribed. | | `data.audience_id` | string | No | The audience (contact pool) the opt-out applied to. | | `data.occurred_at` | string | No | ISO 8601 timestamp when the unsubscribe was recorded. | > **Note:** This event covers **account-wide** opt-outs only. A [topic](https://www.senddart.com/docs/topics/overview) opt-out — the unsubscribe link on a `POST /emails` send that set a `topic_id`, or a single topic switched off in the preference center — is scoped to that topic, leaves the recipient subscribed to everything else, and does **not** fire `email.unsubscribed`. Topic opt-outs are listed per topic in the dashboard. > **Note:** SendDart records the opt-out and skips the recipient on future sends; it does not modify your email body. > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # email.suppressed > Fires when SendDart suppresses a send because the address is on your account suppression list. The `email.suppressed` event fires when SendDart **suppresses an email** — the send was skipped because the recipient is on your account-level suppression list (typically from a prior hard bounce or complaint). A suppression does not count toward your bounce-rate metric. The `data.suppressed` object explains why the address was suppressed. ```json { "type": "email.suppressed", "created_at": "2026-06-22T23:41:12.126Z", "data": { "campaign_id": "8b146471-e88e-4322-86af-016cd36fd216", "created_at": "2026-06-22T23:41:11.894719+00:00", "email_id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "message_id": "<111-222-333@email.example.com>", "from": "Acme ", "to": ["recipient@example.com"], "subject": "Sending this example", "template_id": "43f68331-0622-4e15-8202-246a0388854b", "suppressed": { "message": "SendDart has suppressed sending to this address because it is on the account-level suppression list. This does not count toward your bounce rate metric.", "type": "OnAccountSuppressionList" } } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.campaign_id` | string | No | Identifier for the campaign, if applicable. | | `data.created_at` | string | No | ISO 8601 timestamp when the email was created. | | `data.email_id` | string | No | Unique identifier for this email. | | `data.message_id` | string | No | RFC Message-ID header value for the email. | | `data.from` | string | No | Sender address; may include a display name. | | `data.to` | string[] | No | Recipient email address(es). | | `data.subject` | string | No | Email subject line. | | `data.template_id` | string | No | Identifier of the template used, if applicable. | | `data.suppressed` | object | No | Suppression details (see below). | | `data.suppressed.message` | string | No | Human-readable explanation of the suppression. | | `data.suppressed.type` | string | No | Suppression type, e.g. `OnAccountSuppressionList`. | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # contact.created > Fires when a contact is successfully created in one of your audiences. The `contact.created` event fires whenever a **contact is successfully created** in one of your audiences. Note: when importing many contacts at once via CSV, individual `contact.created` events are **not** triggered. ```json { "type": "contact.created", "created_at": "2026-06-17T19:32:22.980Z", "data": { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "segment_ids": ["78261eea-8f8b-4381-83c6-79fa7120f1cf"], "created_at": "2026-06-17T19:32:22.980Z", "updated_at": "2026-06-17T19:32:22.980Z", "email": "jordan.lee@example.com", "first_name": "Jordan", "last_name": "Lee", "unsubscribed": false } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.id` | string | No | Unique identifier for the contact. | | `data.audience_id` | string | No | Identifier of the audience this contact belongs to. | | `data.segment_ids` | string[] | No | Segment IDs the contact belongs to. | | `data.created_at` | string | No | ISO 8601 timestamp when the contact was created. | | `data.updated_at` | string | No | ISO 8601 timestamp when the contact was last updated. | | `data.email` | string | No | Contact's email address. | | `data.first_name` | string | No | Contact's first name. | | `data.last_name` | string | No | Contact's last name. | | `data.unsubscribed` | boolean | No | Whether the contact has unsubscribed from all your emails. | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # contact.updated > Fires when a contact is successfully updated. The `contact.updated` event fires whenever a **contact is successfully updated** — for example when its name changes or it is subscribed or unsubscribed. Compare `data.updated_at` against `data.created_at` to tell a fresh contact from an edited one. ```json { "type": "contact.updated", "created_at": "2026-06-11T23:47:56.678Z", "data": { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "segment_ids": ["78261eea-8f8b-4381-83c6-79fa7120f1cf"], "created_at": "2026-06-10T15:11:54.110Z", "updated_at": "2026-06-11T23:47:56.678Z", "email": "jordan.lee@example.com", "first_name": "Jordan", "last_name": "Lee", "unsubscribed": false } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.id` | string | No | Unique identifier for the contact. | | `data.audience_id` | string | No | Identifier of the audience this contact belongs to. | | `data.segment_ids` | string[] | No | Segment IDs the contact belongs to. | | `data.created_at` | string | No | ISO 8601 timestamp when the contact was created. | | `data.updated_at` | string | No | ISO 8601 timestamp when the contact was last updated. | | `data.email` | string | No | Contact's email address. | | `data.first_name` | string | No | Contact's first name. | | `data.last_name` | string | No | Contact's last name. | | `data.unsubscribed` | boolean | No | Whether the contact has unsubscribed from all your emails. | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # contact.deleted > Fires when a contact is successfully deleted. The `contact.deleted` event fires whenever a **contact is successfully deleted** from one of your audiences. The payload still carries the contact's last-known fields so you can reconcile your own records before removing them. ```json { "type": "contact.deleted", "created_at": "2026-06-17T19:32:22.980Z", "data": { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "segment_ids": ["78261eea-8f8b-4381-83c6-79fa7120f1cf"], "created_at": "2026-06-10T15:11:59.110Z", "updated_at": "2026-06-17T19:32:22.980Z", "email": "jordan.lee@example.com", "first_name": "Jordan", "last_name": "Lee", "unsubscribed": false } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.id` | string | No | Unique identifier for the contact. | | `data.audience_id` | string | No | Identifier of the audience this contact belonged to. | | `data.segment_ids` | string[] | No | Segment IDs the contact belonged to. | | `data.created_at` | string | No | ISO 8601 timestamp when the contact was created. | | `data.updated_at` | string | No | ISO 8601 timestamp when the contact was last updated. | | `data.email` | string | No | Contact's email address. | | `data.first_name` | string | No | Contact's first name. | | `data.last_name` | string | No | Contact's last name. | | `data.unsubscribed` | boolean | No | Whether the contact had unsubscribed from all your emails. | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # domain.created > Fires when a domain is successfully created, before its DNS records are verified. The `domain.created` event fires when a **domain is successfully created** in your account. A new domain starts as `not_started` and is not yet usable for sending or receiving — you must add the DNS records in `data.records` and verify them. The `data.status` field is an aggregated status across the domain's send and receive capabilities. ```json { "type": "domain.created", "created_at": "2026-06-17T19:32:22.980Z", "data": { "id": "d91cd9bd-1176-453e-8fc1-35364d380206", "name": "example.com", "status": "not_started", "created_at": "2026-06-26T20:21:26.347412+00:00", "region": "us-east-1", "records": [ { "record": "SPF", "name": "send", "type": "MX", "ttl": "Auto", "status": "not_started", "value": "feedback-smtp.us-east-1.amazonses.com", "priority": 10 }, { "record": "SPF", "name": "send", "value": "\"v=spf1 include:amazonses.com ~all\"", "type": "TXT", "ttl": "Auto", "status": "not_started" }, { "record": "DKIM", "name": "senddart._domainkey", "value": "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDsc4Lh8xilsngyKEgN2S84...", "type": "TXT", "status": "not_started", "ttl": "Auto" } ] } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.id` | string | No | Unique identifier for the domain. | | `data.name` | string | No | Domain name, e.g. `example.com`. | | `data.status` | string | No | Aggregated verification status: `verified`, `partially_verified`, `partially_failed`, `pending`, `not_started`, `failed`, or `revoked` (a different account verified an overlapping domain). | | `data.created_at` | string | No | ISO 8601 timestamp when the domain was created. | | `data.region` | string | No | Region where the domain is configured, e.g. `us-east-1`. | | `data.records` | object[] | No | DNS records required for verification (see below). | | `data.records[].record` | string | No | Record purpose: `SPF`, `DKIM`, `Receiving MX`, or `Tracking`. | | `data.records[].name` | string | No | DNS record name/subdomain. | | `data.records[].type` | string | No | DNS record type: `MX`, `TXT`, or `CNAME`. | | `data.records[].value` | string | No | DNS record value to be set. | | `data.records[].ttl` | string | No | Time to live for the DNS record. | | `data.records[].status` | string | No | Verification status of this specific record. | | `data.records[].priority` | number | No | Priority value for MX records (optional). | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # domain.updated > Fires when a domain changes — most commonly as its verification status advances. The `domain.updated` event fires when a **domain is updated**. The most common trigger is a change in verification status as DNS records propagate and are checked — watch `data.status` move toward `verified`. It also fires when a domain is **revoked** because a different account verified an overlapping domain (`data.status` becomes `revoked`). The `data.records` array reflects the current per-record verification state, including any `Receiving MX` records once inbound is enabled. ```json { "type": "domain.updated", "created_at": "2026-06-17T19:32:22.980Z", "data": { "id": "d91cd9bd-1176-453e-8fc1-35364d380206", "name": "example.com", "status": "partially_verified", "created_at": "2026-06-26T20:21:26.347412+00:00", "region": "us-east-1", "records": [ { "record": "SPF", "name": "send", "type": "MX", "ttl": "Auto", "status": "verified", "value": "feedback-smtp.us-east-1.amazonses.com", "priority": 10 }, { "record": "DKIM", "name": "senddart._domainkey", "value": "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDsc4Lh8xilsngyKEgN2S84...", "type": "TXT", "status": "verified", "ttl": "Auto" }, { "name": "inbound.example.com", "priority": 10, "record": "Receiving MX", "status": "pending", "ttl": "Auto", "type": "MX", "value": "inbound-smtp.us-east-1.amazonaws.com" } ] } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.id` | string | No | Unique identifier for the domain. | | `data.name` | string | No | Domain name, e.g. `example.com`. | | `data.status` | string | No | Aggregated verification status: `verified`, `partially_verified`, `partially_failed`, `pending`, `not_started`, `failed`, or `revoked` (a different account verified an overlapping domain). | | `data.created_at` | string | No | ISO 8601 timestamp when the domain was created. | | `data.region` | string | No | Region where the domain is configured, e.g. `us-east-1`. | | `data.records` | object[] | No | DNS records and their current verification state (see below). | | `data.records[].record` | string | No | Record purpose: `SPF`, `DKIM`, `Receiving MX`, or `Tracking`. | | `data.records[].name` | string | No | DNS record name/subdomain. | | `data.records[].type` | string | No | DNS record type: `MX`, `TXT`, or `CNAME`. | | `data.records[].value` | string | No | DNS record value to be set. | | `data.records[].ttl` | string | No | Time to live for the DNS record. | | `data.records[].status` | string | No | Verification status of this specific record. | | `data.records[].priority` | number | No | Priority value for MX records (optional). | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # domain.deleted > Fires when a domain is successfully deleted from your account. The `domain.deleted` event fires when a **domain is successfully deleted**. Once deleted, the domain can no longer be used to send or receive email, and you should remove its DNS records. The payload mirrors the domain's last-known state, including its `records`, so you can clean up your DNS configuration. ```json { "type": "domain.deleted", "created_at": "2026-06-17T19:32:22.980Z", "data": { "id": "d91cd9bd-1176-453e-8fc1-35364d380206", "name": "example.com", "status": "verified", "created_at": "2026-06-26T20:21:26.347412+00:00", "region": "us-east-1", "records": [ { "record": "SPF", "name": "send", "type": "MX", "ttl": "Auto", "status": "verified", "value": "feedback-smtp.us-east-1.amazonses.com", "priority": 10 }, { "record": "DKIM", "name": "senddart._domainkey", "value": "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDsc4Lh8xilsngyKEgN2S84...", "type": "TXT", "status": "verified", "ttl": "Auto" } ] } } ``` **Payload** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | The event type that triggered the webhook. | | `created_at` | string | No | ISO 8601 timestamp when the webhook event was created. | | `data` | object | No | Event-specific data. The fields below live inside this object. | | `data.id` | string | No | Unique identifier for the domain. | | `data.name` | string | No | Domain name, e.g. `example.com`. | | `data.status` | string | No | Aggregated verification status at deletion time. | | `data.created_at` | string | No | ISO 8601 timestamp when the domain was created. | | `data.region` | string | No | Region where the domain was configured, e.g. `us-east-1`. | | `data.records` | object[] | No | The domain's last-known DNS records (same shape as on create/update). | > **Note:** This is one of several events SendDart can deliver. See the full list of [webhook event types](https://www.senddart.com/docs/webhooks/events). --- # Retries > How SendDart retries failed webhook deliveries: up to 5 attempts on a fixed backoff schedule, and where to inspect the delivery history. When SendDart POSTs an event to your endpoint, it expects a `2xx` response within a few seconds. If your endpoint returns a non-`2xx` status, times out, or is unreachable, the delivery is marked **failed** and queued for retry. Delivery is never lost on a single transient error — each message is retried on a fixed schedule before it is given up on. ## Automatic retries SendDart makes up to **5 attempts** per webhook message, with a growing delay between them. Each delay is measured from the failure of the preceding attempt, not from the original event time. - Attempt 1 — immediately - Attempt 2 — 1 minute after the first failure - Attempt 3 — 5 minutes after the second failure - Attempt 4 — 30 minutes after the third failure - Attempt 5 — 2 hours after the fourth failure (the final attempt) For example, a message that fails its first three attempts before eventually succeeding is delivered roughly **36 minutes** after the first attempt (immediate + 1m + 5m + 30m). A message that fails all five attempts is given up on about **2 hours and 36 minutes** after the first attempt. > **Note:** If an endpoint is removed or disabled, all pending delivery attempts to that endpoint stop as well. After 50 consecutive failed deliveries an endpoint is disabled automatically. ## Inspecting deliveries To see how an endpoint is doing, open the **Webhooks** page in the dashboard and choose **History** on the endpoint. The 50 most recent deliveries are listed with the event name, the attempt number, the HTTP status SendDart received, when it happened, and the error if the attempt failed. Delivery history is kept for 90 days. Each delivery carries the same `svix-id` header across every attempt, so your handler can treat retries idempotently — see [How to store webhooks data](https://www.senddart.com/docs/webhooks/store-data) for the dedup pattern. --- # Webhook ingester > Build a webhook ingestion service that verifies SendDart signatures and stores events idempotently in your own database. A webhook ingester is an application you build and host to receive, verify, and store SendDart events. This is an implementation guide; there is no downloadable SendDart ingester repository or prebuilt database-connector package linked from this guide. ## Start with the working handler Follow [How to store webhooks data](https://www.senddart.com/docs/webhooks/store-data) for the complete HTTP handler, signature verification, database schema, and idempotent insert. Use your own application repository and choose a database driver for your stack. 1. **Implement the endpoint** — Preserve the raw request body and verify the webhook signature before parsing or storing the event. 2. **Persist idempotently** — Use the svix-id header as a unique key so delivery retries cannot create duplicate records. Return a successful response only after durable storage. 3. **Deploy and register** — Deploy your handler at a public HTTPS URL, register that URL in the Webhooks dashboard, and store its signing secret in your secret manager. 4. **Verify delivery** — Send a test webhook from the dashboard and confirm one stored event. Replay the delivery and confirm that it is deduplicated. ## Operations - Set a retention policy for stored events and monitor database failures. - Confirm the signing secret matches the endpoint and verify against the raw body. - Use [delivery history and retries](https://www.senddart.com/docs/webhooks/retries-and-replays) to investigate missing events. --- # How to store webhooks data > Why you should persist your SendDart webhook events, what to store, and a complete native-HTTP handler that verifies the signature and inserts each event into your own database. Every email you send through SendDart can generate real-time events — was it delivered, opened, clicked, or did it bounce? These events are delivered to your [webhook endpoint](https://www.senddart.com/docs/webhooks/overview), but by default they are **ephemeral**: SendDart does not keep them forever. To make the data durable and queryable, store each event in your own datasource as it arrives. This guide covers **why** you should, **what** to keep, and a working handler that **verifies and inserts** each event. ## Why store webhook data? ### Meet compliance requirements Many industries regulate retention and audit trails — GDPR (proving what was sent and when), SOC 2 (delivery verification), and financial rules (retaining transactional email for years). Owning the data gives you full control over retention periods and access controls. ### Enable long-term retention SendDart retains email event data for a limited window. If you need history beyond that window, storing events in your own database ensures you never lose it. ### Power automated workflows With events in your database you can build automations such as: - Automatically suppress bounced addresses from future sends. - Trigger follow-up emails based on open or click behavior. - Alert your team when delivery failures spike. - Re-engage contacts who haven't opened recent messages. ## What data should you store? At minimum, store enough to deduplicate and to link an event back to the original send: - **Event id** — the `svix-id` header, used as the unique idempotency key. - **Event type** — what happened, e.g. `email.delivered`, `email.bounced`, `email.opened`. - **Timestamp** — when the event occurred (`created_at` in the payload). - **Email id** — `data.email_id`, which links the event to the original email. For richer analytics, also keep recipient addresses, subject lines, bounce details, and clicked URLs. ## A table to store events A single events table is enough to get started. The unique constraint on `svix_id` is what makes inserts idempotent — a retried delivery hits the conflict and is skipped. **schema.sql (PostgreSQL)** ```sql CREATE TABLE webhook_events ( id BIGSERIAL PRIMARY KEY, svix_id TEXT NOT NULL UNIQUE, -- idempotency key (svix-id header) event_type TEXT NOT NULL, -- e.g. 'email.delivered' email_id TEXT, -- data.email_id, links to the send recipient TEXT, -- first 'to' address, for filtering payload JSONB NOT NULL, -- the full event body event_created_at TIMESTAMPTZ NOT NULL, -- payload created_at webhook_received_at TIMESTAMPTZ NOT NULL DEFAULT NOW() ); CREATE INDEX idx_webhook_events_email_id ON webhook_events (email_id); CREATE INDEX idx_webhook_events_type ON webhook_events (event_type); ``` ## A handler that verifies and inserts The handler below verifies the signature manually over the **raw** request body, then inserts the event, ignoring duplicates. (In Node you can also verify with the SDK — `mb.webhooks.verify(rawBody, headers, secret)` — see [Verify webhooks](https://www.senddart.com/docs/webhooks/verify).) SendDart signs each delivery with the Svix scheme: an `svix-id`, an `svix-timestamp`, and an `svix-signature` header, signed with your endpoint secret (`whsec_...`). > **Warning:** Always verify against the exact bytes you received. If you parse the JSON before verifying, the re-serialized body will differ from what was signed and verification will fail. Read the raw body first. **Node.js** ```js import { createServer } from 'node:http'; import crypto from 'node:crypto'; import { Pool } from 'pg'; const pool = new Pool({ connectionString: process.env.DATABASE_URL }); // Signing secret from the dashboard, e.g. 'whsec_...'. Derive the key the way the // server does: strip only the 'whsec_' PREFIX -- splitting on '_' truncates any // secret whose body contains one, and '_' is base64url's '/' -- then base64-decode, // falling back to the whole secret when that decodes to nothing. function secretToKey(secret) { if (!secret.startsWith('whsec_')) return Buffer.from(secret, 'utf8'); const decoded = Buffer.from(secret.slice('whsec_'.length), 'base64'); return decoded.length ? decoded : Buffer.from(secret, 'utf8'); } const secret = secretToKey(process.env.SENDDART_WEBHOOK_SECRET); function verify(headers, rawBody) { const id = headers['svix-id']; const ts = headers['svix-timestamp']; const signed = `${id}.${ts}.${rawBody}`; const expected = crypto.createHmac('sha256', secret).update(signed).digest('base64'); // svix-signature is a space-separated list of 'v1,' pairs. return headers['svix-signature'] .split(' ') .some((part) => { const sig = part.split(',')[1]; return sig && crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected)); }); } createServer((req, res) => { if (req.method !== 'POST') { res.writeHead(405).end(); return; } let raw = ''; req.on('data', (c) => { raw += c; }); // collect the RAW body req.on('end', async () => { if (!verify(req.headers, raw)) { res.writeHead(401).end('invalid signature'); return; } const event = JSON.parse(raw); await pool.query( `INSERT INTO webhook_events (svix_id, event_type, email_id, recipient, payload, event_created_at) VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT (svix_id) DO NOTHING`, // idempotent: skip retries [ req.headers['svix-id'], event.type, event.data?.email_id ?? null, event.data?.to?.[0] ?? null, event, event.created_at, ], ); res.writeHead(200).end('ok'); // always 2xx so SendDart stops retrying }); }).listen(3000); ``` **Python** ```python import os, json, hmac, hashlib, base64 from http.server import BaseHTTPRequestHandler, HTTPServer import psycopg conn = psycopg.connect(os.environ["DATABASE_URL"], autocommit=True) _B64 = set(b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/") def secret_to_key(secret: str) -> bytes: # Match the server byte for byte. It decodes with Node's Buffer.from(s, 'base64'), # which is NOT what base64.b64decode does -- b64decode RAISES on an unpadded secret # and DISCARDS '-'/'_' instead of translating them, silently yielding a different # key than the signer so every genuine delivery is rejected as forged. if not secret.startswith("whsec_"): return secret.encode() # Node reads the LOW BYTE of each UTF-16 code unit, so a non-ASCII character can # stand in for a base64 one: 'L' with stroke (U+0141) counts as 'A', and 'L' with # caron (U+013D) counts as '='. Mask first, then apply the rest. units = secret[len("whsec_"):].encode("utf-16-le", "surrogatepass")[0::2] head = units.split(b"=", 1)[0] # '=' TERMINATES; it is not padding head = head.replace(b"-", b"+").replace(b"_", b"/") # URL-safe spellings chars = bytes(c for c in head if c in _B64) # anything else is skipped if len(chars) % 4 == 1: # a lone trailing char encodes nothing chars = chars[:-1] decoded = base64.b64decode(chars + b"=" * (-len(chars) % 4)) if chars else b"" return decoded or secret.encode() # empty decode -> the whole secret secret = secret_to_key(os.environ["SENDDART_WEBHOOK_SECRET"]) def verify(headers, raw: bytes) -> bool: signed = f"{headers['svix-id']}.{headers['svix-timestamp']}.{raw.decode()}".encode() expected = base64.b64encode(hmac.new(secret, signed, hashlib.sha256).digest()).decode() # svix-signature is space-separated 'v1,' pairs. for part in headers["svix-signature"].split(" "): sig = part.split(",", 1)[-1] if hmac.compare_digest(sig, expected): return True return False class Handler(BaseHTTPRequestHandler): def do_POST(self): raw = self.rfile.read(int(self.headers["Content-Length"])) # RAW body if not verify(self.headers, raw): self.send_response(401); self.end_headers(); return event = json.loads(raw) conn.execute( """INSERT INTO webhook_events (svix_id, event_type, email_id, recipient, payload, event_created_at) VALUES (%s, %s, %s, %s, %s, %s) ON CONFLICT (svix_id) DO NOTHING""", ( self.headers["svix-id"], event["type"], event.get("data", {}).get("email_id"), (event.get("data", {}).get("to") or [None])[0], json.dumps(event), event["created_at"], ), ) self.send_response(200); self.end_headers() # 2xx stops retries HTTPServer(("", 3000), Handler).serve_forever() ``` A successful delivery looks like a `POST` from SendDart carrying the signing headers: ```bash POST /webhooks HTTP/1.1 Host: your-app.example.com svix-id: msg_2abc... svix-timestamp: 1719500000 svix-signature: v1,g0hM9SsE... Content-Type: application/json { "type": "email.delivered", "created_at": "2026-06-27T10:00:00.000Z", "data": { "email_id": "8f5c2a1e-...", "to": ["user@example.com"] } } ``` > **Note:** Return a `2xx` as soon as you have stored the event. If your endpoint is slow or errors, SendDart retries with backoff — see [Retries](https://www.senddart.com/docs/webhooks/retries-and-replays). ## Retention and privacy Webhook data can contain personal information (recipient addresses, and IP/location data from opens and clicks). Decide on a retention window up front, restrict access, and have a path for deletion requests. For operational debugging, 30–90 days is often enough; compliance may require keeping records far longer. Rather than building everything yourself, you can deploy the [Webhook ingester](https://www.senddart.com/docs/webhooks/ingester), which wraps the verify-and-insert pattern above behind ready-made database connectors. --- # Managing teams > Share a SendDart account with teammates and switch between the teams you belong to. A SendDart account can be shared so teammates send from the same verified domains and see the same emails, audiences, and campaigns. Team access is managed from the dashboard. ## Inviting teammates - Open **Team** in the dashboard sidebar. - Click **Invite**, enter an email address, and select a role (**Admin** or **Member**). - The teammate receives an email invitation and accepts it to join. - Members share the account's domains, API keys scope, audiences, and sending history. ## Roles and permissions | Role | Permissions | | --- | --- | | **Member** | Read-only access to the workspace — view emails, domains, audiences and campaigns. | | **Admin** | Full read/write on the workspace — send mail and manage emails, domains, audiences, campaigns and webhooks. | > **Note:** Inviting, removing and re-roling teammates, and buying a plan, always apply to **your own** account — not to a team whose data you are currently viewing. ## Changing a member's role Open **Settings → Team**, find the member, and pick the new role from the role dropdown in their row. The change takes effect immediately. ## Switching teams If you belong to more than one team (your own plus accounts you've been invited to), the dashboard lets you **switch the active team context** — open **Settings → Team** and pick an account under **Viewing data for**. Your view — emails, domains, audiences — reflects the team you currently have selected. > **Note:** API keys belong to the account that created them. To send on behalf of a team, create the key while that team is active. --- # Custom unsubscribe page > Customize the unsubscribe footer and behavior applied to your mail. SendDart can append an unsubscribe footer to your emails and emit a one-click `List-Unsubscribe` header. You control the wording and behavior under **Settings → Unsubscribe** in the dashboard. ## What you can configure - **Custom footer text** — the unsubscribe sentence and link appended to mail (a sensible default is used if you leave it blank). - **Apply my global unsubscribe list** — suppress everyone on your account-wide unsubscribe list across every send. - **Add List-Unsubscribe header** — emit the RFC 8058 one-click header (recommended for bulk mail). ## Customizing the unsubscribe page When a recipient clicks the unsubscribe link, SendDart hosts the confirmation page that handles the unsubscribe flow for you. A single unsubscribe page is used for **every domain on your team**. Open **Settings → Unsubscribe** and click **Edit** to match it to your brand. - **Title** — the heading shown on the unsubscribe page. - **Description** — the supporting text shown beneath the title. - **Logo** — your brand logo displayed on the page. - **Background Color** — the page background color. - **Text Color** — the color of the page text. - **Accent Color** — the color used for buttons and links. > **Note:** For [campaigns](https://www.senddart.com/docs/campaigns/managing) — and for a `POST /emails` send that sets a [`topic_id`](https://www.senddart.com/docs/topics/overview) — the footer + one-click header are added automatically per recipient. For transactional [emails](https://www.senddart.com/docs/emails/unsubscribe) with no `topic_id`, unsubscribe is sender-driven. See also [Should I add an unsubscribe link?](https://www.senddart.com/docs/kb/unsubscribe-link). --- # Billing & plans > How plans and usage work, and where to manage billing. SendDart offers a free tier to get started, with paid plans for higher sending volume and additional features. Compare plans on the [pricing page](https://www.senddart.com/pricing). ## Your plan Your current plan and limits are shown under **Billing** in the dashboard. Sending volume counts against your plan's [daily quota and usage limits](https://www.senddart.com/docs/api/limits). ## What you can manage The **Billing** page shows your plan, your email-credit balance, your billing details, and every payment on your account. From here you can: - **Change plan** — buy any paid plan self-serve from **Billing → Change plan**; checkout is handled by our payment provider. - **Buy email credits** — add sending volume without changing plans. Credits apply immediately and never expire. - **Set a billing email** — receipts go to this address instead of your login email. - **Add a billing address and tax ID** — carried onto the invoice our payment provider issues for each payment. - **Review payments** — every payment and checkout attempt is listed; only rows marked **paid** were charged. ## Terms, renewals, and cancelling - Every paid plan is a prepaid **30-day term**. There is no recurring subscription, and no card is stored — you pay once per term. - Your first paid plan starts immediately. Buying a **different** plan while a term is still running schedules it to start the moment that term ends, so nothing you paid for is lost. - Buying the **same** plan again before it ends adds another 30 days to the existing term. - To cancel, simply do not buy another term: the plan runs to the end of the one you paid for, then the account falls back to Free. > **Note:** Card details are entered at our payment provider's checkout each time — SendDart never sees or stores them, and a receipt is emailed for every completed payment. For any other billing inquiries, contact support. --- # AI Onboarding > Everything you need to onboard your AI agent to SendDart — the MCP server, docs for agents, the Chat SDK, and production best practices. If you are building with AI, SendDart offers several resources to improve your experience — an MCP server, agent-readable docs, an email Chat SDK, and battle-tested best practices for production sends. This page is the jumping-off point. ## Connect your AI builder Follow the setup guide for your builder to connect SendDart, keep API keys on the server, and test your first email: [v0](https://www.senddart.com/docs/ai/v0), [Lovable](https://www.senddart.com/docs/ai/lovable), [Bolt](https://www.senddart.com/docs/ai/bolt), [Base44](https://www.senddart.com/docs/ai/base44), [Replit](https://www.senddart.com/docs/ai/replit), [Leap](https://www.senddart.com/docs/ai/leap), [Anything](https://www.senddart.com/docs/ai/anything), [Devin](https://www.senddart.com/docs/ai/devin), [Paper](https://www.senddart.com/docs/ai/paper), or [OpenClaw](https://www.senddart.com/docs/ai/openclaw). ## Prerequisite: create an API key We require a human to create a SendDart account, and to create the key itself: key creation, permission changes, and revocation happen in the dashboard, never over the API. Once you have an account, [create an API key](https://www.senddart.com/docs/create-an-api-key) — it looks like `mb_xxxxxxxxx`. With a key, your agent can send email and manage the rest of your account over the API, but it can never mint itself a second key or widen the one you gave it. > **Note:** To send from SendDart you also need a [verified domain](https://www.senddart.com/docs/domains/managing). An agent can [create a domain](https://www.senddart.com/docs/api/domains-create) via the API, but the response returns DNS records you must add at your DNS provider before [verifying](https://www.senddart.com/docs/api/domains-verify). Verifying in the dashboard is usually easier. ## SendDart MCP server MCP is an open protocol that standardizes how applications provide context to LLMs. Among other benefits, it gives LLMs tools to act on your behalf. The [SendDart MCP server](https://www.senddart.com/docs/ai/mcp-server) is published on NPM as `senddart-mcp` and covers the full API surface. Add it to any supported MCP client: ```json { "mcpServers": { "senddart": { "command": "npx", "args": ["-y", "senddart-mcp"], "env": { "SENDDART_API_KEY": "mb_xxxxxxxxx" } } } } ``` See [MCP Server](https://www.senddart.com/docs/ai/mcp-server) for install instructions for Cursor, Codex, Claude Desktop, Windsurf, and more. ## SendDart docs for agents You can give your agent current, context-aware docs in two ways: 1. **Markdown docs** — every doc page has a Markdown version. Append `.md` to any page URL, e.g. `https://senddart.com/docs/ai/onboarding.md`. 2. **MCP docs server** — for a structured approach using MCP tools, point your client at the docs MCP endpoint so your agent can search the docs as tools rather than fetching a single large file. ## Email skills for agents Skills give AI agents specialized knowledge for specific tasks. These are reference *patterns* you capture as a `SKILL.md` (or equivalent context file) in your repo — they build on the [`senddart` SDK](https://www.senddart.com/docs/resources/sdks), the [`senddart-mcp` MCP server](https://www.senddart.com/docs/ai/mcp-server), webhooks, and native HTTP, so there is nothing extra to install: | Skill | What it does | | --- | --- | | [SendDart](https://www.senddart.com/docs/ai/skill-senddart) | Send and receive emails, handle errors, prevent duplicate sends, and get code examples. | | [React Email](https://www.senddart.com/docs/ai/skill-react-email) | Build emails in React, Tailwind, and TypeScript; audit existing React emails for style and cross-client rendering. | | [Email Best Practices](https://www.senddart.com/docs/ai/skill-email-best-practices) | Audit SPF/DKIM/DMARC setup, compliance (CAN-SPAM, GDPR), and webhook handling. | | [Agent Email Inbox](https://www.senddart.com/docs/ai/skill-agent-inbox) | Give an agent a secure inbox to receive and act on inbound email. | ## Conversational email (Chat SDK pattern) You can turn email into a two-way communication channel for an agent: send replies with the [`senddart` SDK](https://www.senddart.com/docs/resources/sdks) or [POST /emails](https://www.senddart.com/docs/api/emails-send), receive inbound mail through [webhooks](https://www.senddart.com/docs/webhooks/overview) (`email.received`), and thread conversations with standard `In-Reply-To`/`References` headers. The [Chat SDK guide](https://www.senddart.com/docs/ai/chat-sdk) shows how to wire this up as a Vercel Chat SDK adapter, including card emails, attachments, and proactive outreach. ## Quick start: sending email from an agent SendDart provides two endpoints for sending. Pick the right one for the job: | Approach | Endpoint | Use case | | --- | --- | --- | | **Single** | `POST /emails` | Individual transactional emails, emails with attachments, scheduled sends. | | **Batch** | `POST /emails/batch` | Multiple distinct emails in one request (max 100), bulk notifications. | **Choose batch when** you are sending 2+ distinct emails at once and want to reduce API calls. **Choose single when** you are sending one email, the email needs attachments, the email needs to be scheduled, or different recipients need different timing. ### Best practices (critical for production) Always implement these for production email sending. **Idempotency keys** — prevent duplicate emails when retrying failed requests. Pass a unique `Idempotency-Key` header per logical send; a retry with the same key replays the original response instead of sending again. See [Idempotency keys](https://www.senddart.com/docs/emails/idempotency). | Key facts | | | --- | --- | | **Format (single)** | `/` (e.g. `welcome-email/user-123`) | | **Format (batch)** | `batch-/` (e.g. `batch-orders/batch-456`) | | **Expiration** | 24 hours | | **Max length** | 255 characters | | **Duplicate payload** | Returns the original response without resending | | **Different payload** | Returns a `409` error | **Error handling** — map status codes to actions: | Code | Action | | --- | --- | | `400` / `422` | Fix request parameters — do not retry. | | `401` / `403` | Check your API key / verify your domain — do not retry. | | `409` | Idempotency conflict — an identical key is still in flight. Wait and retry, or use a fresh key. | | `429` | Rate limited — retry with exponential backoff. | | `500` | Server error — retry with exponential backoff. | **Retry strategy** — use exponential backoff (1s, 2s, 4s…), cap at 3–5 retries, only retry `429` and `500`, and always send the same idempotency key on a retry. ### Single send parameters **Required** | Name | Type | Required | Description | | --- | --- | --- | --- | | `from` | string | Yes | Sender address. Format: `"Name "` (must be on a verified domain). | | `to` | string[] | Yes | Recipient addresses (max 50). | | `subject` | string | Yes | Email subject line. | | `html / text` | string | Yes | Email body content (provide at least one). | **Optional** | Name | Type | Required | Description | | --- | --- | --- | --- | | `cc` | string[] | No | CC recipients. | | `bcc` | string[] | No | BCC recipients. | | `reply_to` | string[] | No | Reply-to addresses. | | `scheduled_at` | string | No | Schedule send time (ISO 8601 or natural language). | | `attachments` | array | No | File attachments (max 40MB total). | | `headers` | object | No | Custom headers. | ### Minimal single send ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: welcome-email/user-123' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello World", "html": "

Email body here

" }' ``` ### Minimal batch send Because a batch is validated atomically — one invalid item rejects the whole request — pre-validate every email (required fields, address format, and a size of 1–100) before sending. - **No attachments** — use single sends for emails with attachments. - **No scheduling** — use single sends for scheduled emails. - **Atomic** — if one email fails validation, the entire batch fails. - **Max 100 emails** per request. - **Max 50 recipients** per individual email in the batch. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.batch.send([ { "from": "Acme ", "to": ["a@example.com"], "subject": "Order Shipped", "html": "

Your order has shipped!

" }, { "from": "Acme ", "to": ["b@example.com"], "subject": "Order Confirmed", "html": "

Your order is confirmed!

" } ]); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Batch.send([ { "from": "Acme ", "to": [ "a@example.com" ], "subject": "Order Shipped", "html": "

Your order has shipped!

" }, { "from": "Acme ", "to": [ "b@example.com" ], "subject": "Order Confirmed", "html": "

Your order is confirmed!

" } ]) ``` **PHP** ```php batch->send([ [ 'from' => "Acme ", 'to' => [ "a@example.com" ], 'subject' => "Order Shipped", 'html' => "

Your order has shipped!

" ], [ 'from' => "Acme ", 'to' => [ "b@example.com" ], 'subject' => "Order Confirmed", 'html' => "

Your order is confirmed!

" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Batch.send([ { "from": "Acme ", "to": [ "a@example.com" ], "subject": "Order Shipped", "html": "

Your order has shipped!

" }, { "from": "Acme ", "to": [ "b@example.com" ], "subject": "Order Confirmed", "html": "

Your order is confirmed!

" } ]) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") batch, err := client.Batch.SendEmails([]*senddart.BatchEmailRequest{ { From: "Acme ", To: []string{"a@example.com"}, Subject: "Order Shipped", Html: "

Your order has shipped!

", }, { From: "Acme ", To: []string{"b@example.com"}, Subject: "Order Confirmed", Html: "

Your order is confirmed!

", }, }) ``` **Rust** ```rust use senddart::{BatchEmailOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let items = vec![ BatchEmailOptions::new( "Acme ", ["a@example.com"], "Order Shipped", ) .with_html("

Your order has shipped!

"), BatchEmailOptions::new( "Acme ", ["b@example.com"], "Order Confirmed", ) .with_html("

Your order is confirmed!

"), ]; let _batch = mb.batch.send_emails(items).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.BatchEmailRequest; import java.util.List; SendDart senddart = new SendDart("mb_xxxxxxxxx"); List requests = List.of( BatchEmailRequest.builder() .from("Acme ") .to("a@example.com") .subject("Order Shipped") .html("

Your order has shipped!

") .build(), BatchEmailRequest.builder() .from("Acme ") .to("b@example.com") .subject("Order Confirmed") .html("

Your order is confirmed!

") .build()); SendDartResponse response = senddart.batch().sendEmails(requests); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailBatchSendAsync(new List { new() { From = "Acme ", To = "a@example.com", Subject = "Order Shipped", HtmlBody = "

Your order has shipped!

", }, new() { From = "Acme ", To = "b@example.com", Subject = "Order Confirmed", HtmlBody = "

Your order is confirmed!

", }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails/batch' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '[ { "from": "Acme ", "to": ["a@example.com"], "subject": "Order Shipped", "html": "

Your order has shipped!

" }, { "from": "Acme ", "to": ["b@example.com"], "subject": "Order Confirmed", "html": "

Your order is confirmed!

" } ]' ``` **CLI** ```bash senddart emails batch \ --data '[{"from":"Acme ","to":["a@example.com"],"subject":"Order Shipped","html":"

Your order has shipped!

"},{"from":"Acme ","to":["b@example.com"],"subject":"Order Confirmed","html":"

Your order is confirmed!

"}]' ``` > **Note:** See [Send an email](https://www.senddart.com/docs/api/emails-send) and [Send a batch](https://www.senddart.com/docs/api/emails-batch) for the full parameter reference. --- # MCP Server > Use the SendDart MCP server to give your AI agent native access to the full SendDart platform over natural language. ## What is an MCP server? MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Among other benefits, it gives LLMs tools to act on your behalf. ## What can the SendDart MCP server do? The SendDart MCP server gives your AI agent native access to the full SendDart platform through a single integration. You can manage your email infrastructure using natural language: - **Emails** — send, list, get, cancel, update, and batch-send emails. Supports HTML, plain text, attachments (local file, URL, or base64), CC/BCC, reply-to, scheduling, and topic-based sending. - **Received emails** — list and read inbound emails; list and download received attachments. - **Contacts** — create, list, get, update, and remove contacts. Manage segment memberships, topic subscriptions, and CSV imports, with custom contact properties. - **Campaigns** — create, send, list, get, update, and remove campaigns, with scheduling, personalization placeholders, and preview text. - **Domains** — create, list, get, update, remove, and verify sender domains. Configure tracking, TLS, and sending/receiving capabilities. - **Segments** — create, list, get, and remove audience segments. - **Topics** — create, list, get, update, and remove subscription topics. - **Contact properties** — create, list, get, update, and remove custom contact attributes. - **API keys** — list your API keys and see when each was last used. Creating, re-scoping, and revoking keys are **dashboard-only** and cannot be done by any agent holding a key: those calls return `403 dashboard_only`. Do them yourself at the **API Keys** page. - **Webhooks** — create, list, get, update, and remove webhooks for event notifications. > **Note:** The server also includes `create-contact-import`, `get-contact-import`, and `list-contact-imports` tools to upload CSV files, check import status, and review previous imports. ## Prerequisites The SendDart MCP server is published on NPM as `senddart-mcp` and runs with `npx` in any supported MCP client. Before you start: - [Create an API key](https://www.senddart.com/docs/api-keys/overview). - [Verify your domain](https://www.senddart.com/docs/domains/managing). ## Stdio transport (default) The server supports two transport modes: **stdio** (default) and **HTTP**. Replace `mb_xxxxxxxxx` with your actual key in every example below. **Claude Code** ```bash claude mcp add senddart -e SENDDART_API_KEY=mb_xxxxxxxxx -- npx -y senddart-mcp ``` **Codex** ```bash codex mcp add senddart \ --env SENDDART_API_KEY=mb_xxxxxxxxx \ -- npx -y senddart-mcp ``` **Cursor** ```json { "mcpServers": { "senddart": { "command": "npx", "args": ["-y", "senddart-mcp"], "env": { "SENDDART_API_KEY": "mb_xxxxxxxxx" } } } } ``` **Claude Desktop** ```json { "mcpServers": { "senddart": { "command": "npx", "args": ["-y", "senddart-mcp"], "env": { "SENDDART_API_KEY": "mb_xxxxxxxxx" } } } } ``` **Windsurf** ```json { "mcpServers": { "senddart": { "command": "npx", "args": ["-y", "senddart-mcp"], "env": { "SENDDART_API_KEY": "mb_xxxxxxxxx" } } } } ``` **Copilot** ```json // Add to your VS Code settings.json: { "mcp": { "servers": { "senddart": { "command": "npx", "args": ["-y", "senddart-mcp"], "env": { "SENDDART_API_KEY": "mb_xxxxxxxxx" } } } } } ``` **Gemini CLI** ```json { "mcpServers": { "senddart": { "command": "npx", "args": ["-y", "senddart-mcp"], "env": { "SENDDART_API_KEY": "mb_xxxxxxxxx" } } } } ``` **OpenCode** ```json // Add to your opencode.json config: { "$schema": "https://opencode.ai/config.json", "mcp": { "senddart": { "type": "local", "command": ["npx", "-y", "senddart-mcp"], "enabled": true, "environment": { "SENDDART_API_KEY": "mb_xxxxxxxxx" } } } } ``` ## HTTP transport Run the server over HTTP for remote or web-based integrations. In HTTP mode, each client authenticates by passing its SendDart API key as a Bearer token in the `Authorization` header. **Start the server** ```bash npx -y senddart-mcp --http --port 3000 ``` The server listens on `http://127.0.0.1:3000` and exposes the MCP endpoint at `/mcp` using Streamable HTTP. **Claude Code** ```bash claude mcp add senddart --transport http http://127.0.0.1:3000/mcp --header "Authorization: Bearer mb_xxxxxxxxx" ``` **Cursor** ```json { "mcpServers": { "senddart": { "url": "http://127.0.0.1:3000/mcp", "headers": { "Authorization": "Bearer mb_xxxxxxxxx" } } } } ``` You can also set the port via the `MCP_PORT` environment variable: `MCP_PORT=3000 npx -y senddart-mcp --http`. ## Options Pass additional arguments to configure the server: | Name | Type | Required | Description | | --- | --- | --- | --- | | `--key` | string | No | Your SendDart API key (stdio mode only — HTTP mode uses the client Bearer token). | | `--sender` | string | No | Default sender email address from a verified domain. | | `--reply-to` | string | No | Default reply-to address (can be specified multiple times). | | `--http` | flag | No | Use HTTP transport instead of stdio (default: stdio). | | `--port` | number | No | HTTP port when using `--http` (default: 3000, or `MCP_PORT`). | ### Environment variables | Name | Type | Required | Description | | --- | --- | --- | --- | | `SENDDART_API_KEY` | string | No | Your API key. Required for stdio; optional for HTTP since clients pass it via Bearer token. | | `SENDER_EMAIL_ADDRESS` | string | No | Default sender address from a verified domain (optional). | | `REPLY_TO_EMAIL_ADDRESSES` | string | No | Comma-separated reply-to addresses (optional). | | `MCP_PORT` | number | No | HTTP port when using `--http` (optional). | > **Note:** If you do not provide a sender email address, the MCP server asks you to provide one each time you call a send tool. ## Local installation Install the published package locally to run a fixed version without cloning a repository. The npm package already includes the executable build. **Install locally** ```bash mkdir senddart-mcp-local cd senddart-mcp-local npm init -y npm install senddart-mcp@1.0.0 ``` Then replace the `npx` command with the absolute path to the installed executable: **Claude Code (stdio)** ```bash claude mcp add senddart -e SENDDART_API_KEY=mb_xxxxxxxxx -- node ABSOLUTE_PATH_TO_PROJECT/node_modules/senddart-mcp/dist/cli.js ``` **Cursor (stdio)** ```json { "mcpServers": { "senddart": { "command": "node", "args": ["ABSOLUTE_PATH_TO_PROJECT/node_modules/senddart-mcp/dist/cli.js"], "env": { "SENDDART_API_KEY": "mb_xxxxxxxxx" } } } } ``` **HTTP** ```bash node ABSOLUTE_PATH_TO_PROJECT/node_modules/senddart-mcp/dist/cli.js --http --port 3000 ``` ### Testing with MCP Inspector From the installation directory, start the inspector to verify the server and list its tools: ```bash export SENDDART_API_KEY=mb_your_key_here npx @modelcontextprotocol/inspector node node_modules/senddart-mcp/dist/cli.js ``` - **Stdio** — choose *stdio (launch a process)*, set **Command** to `node`, **Args** to `node_modules/senddart-mcp/dist/cli.js`, and **Env** to `SENDDART_API_KEY=mb_your_key_here`. Click **Connect**, then **List tools**. - **HTTP** — start the server with `node node_modules/senddart-mcp/dist/cli.js --http --port 3000`, then in the inspector choose *Streamable HTTP*, set **URL** to `http://127.0.0.1:3000/mcp`, add header `Authorization: Bearer mb_your_key_here`, and click **Connect**. --- # DMARC Analyzer > Analyze DMARC XML reports with a free, open-source tool — view it in your browser or self-host it for automated email digests. The DMARC Analyzer is an open-source tool that parses DMARC XML reports and turns them into human-readable dashboards. Use it directly in your browser, or deploy your own instance to receive automated email digests powered by SendDart. ## What is DMARC? DMARC (Domain-based Message Authentication, Reporting, and Conformance) is an email authentication protocol that builds on [SPF and DKIM](https://www.senddart.com/docs/domains/managing). It lets domain owners specify how unauthenticated email should be handled and receive reports about authentication results. When you set up a DMARC policy, mailbox providers send XML reports to the address you specify. These reports contain valuable data about who is sending email on behalf of your domain and whether those messages pass authentication — but the raw XML is hard to read. The DMARC Analyzer visualizes it. ## Features - Parse and visualize DMARC XML reports instantly. - View SPF and DKIM alignment results per source. - Identify unauthorized senders using your domain. - Self-host with automated report ingestion via [SendDart Receiving](https://www.senddart.com/docs/receiving/introduction). - Receive email digests summarizing your DMARC reports. ## Web interface The quickest way to get started, with no setup required: 1. **Open the analyzer** — Go to the hosted DMARC Analyzer web app. 2. **Paste your report** — Paste your DMARC XML report, or upload the XML file directly. 3. **Read the results** — View the parsed, human-readable results instantly — alignment, sources, and pass/fail per sender. ## Self-hosted with automated reports For ongoing monitoring, deploy your own instance. It connects to [SendDart Receiving](https://www.senddart.com/docs/receiving/introduction) webhooks so DMARC reports sent to your domain are automatically ingested and analyzed, with email digests delivered through SendDart. 1. **Clone the repository** — Clone the DMARC Analyzer repo and change into the project directory. 2. **Install dependencies** — Install with your package manager of choice (`npm install`, `pnpm install`, `yarn install`, or `bun install`). 3. **Configure environment variables** — Copy `.env.example` to `.env.local` and fill in `SENDDART_API_KEY`, `SENDDART_WEBHOOK_SECRET`, `EMAIL_FROM` (from a verified domain), and `EMAIL_TO`. 4. **Test the application** — Start the dev server, register a publicly accessible HTTPS URL in the SendDart dashboard, enable the `email.received` event, and copy the signing secret into `SENDDART_WEBHOOK_SECRET`. 5. **Deploy** — Deploy to your preferred host and update the webhook endpoints in the dashboard — `/api/webhooks/dmarc/rua` for aggregate reports and `/api/webhooks/dmarc/ruf` for failure reports. ### Environment variables | Name | Type | Required | Description | | --- | --- | --- | --- | | `SENDDART_API_KEY` | string | Yes | Your [SendDart API key](https://www.senddart.com/docs/api-keys/overview). | | `SENDDART_WEBHOOK_SECRET` | string | Yes | Signing secret from the SendDart webhook endpoint you set up. | | `EMAIL_FROM` | string | Yes | Sender address for digest emails (must be from a [verified domain](https://www.senddart.com/docs/domains/managing)). | | `EMAIL_TO` | string | Yes | Recipient address for digest emails. | > **Note:** For local development, expose your localhost server at a public HTTPS URL with a tunneling tool (e.g. ngrok or VS Code Port Forwarding) so SendDart can reach your webhook endpoint. The project is built with Next.js, so it deploys to any platform that supports it. --- # SendDart Skill > Teach an AI agent to send single and batch emails through the SendDart API with built-in retries and idempotency. The **SendDart skill** packages SendDart's official recommendations for sending email so an AI coding agent can wire up reliable sends without guessing at the API. It gives the agent a streamlined recipe for single and batch sends, complete with error handling and retry logic. A "skill" here is a set of instructions and patterns you drop into your agent's context (for example, a `SKILL.md` file in your repo, or a tool definition your agent reads). When a task involves sending email, the agent follows the skill's recipe instead of inventing its own. ## How to give an agent this skill This is a skill *pattern*, not a package to install — capture the recipe below as a `SKILL.md` (or equivalent context file) in your repo and load it into your agent's context. It builds on primitives that already exist: the [`senddart` Node SDK](https://www.senddart.com/docs/resources/sdks), the [`senddart-mcp` MCP server](https://www.senddart.com/docs/ai/mcp-server), and the plain JSON [Emails API](https://www.senddart.com/docs/api/emails-send) over native HTTP. > **Note:** If you want your agent to send through a managed tool rather than hand-rolled HTTP, point it at the SendDart MCP server — `npx -y senddart-mcp` — which exposes the send endpoints as tools. See [MCP Server](https://www.senddart.com/docs/ai/mcp-server). ## What it gives your agent - **Single and batch sending** — send one email via [POST /emails](https://www.senddart.com/docs/api/emails-send), or up to 100 in a single [POST /emails/batch](https://www.senddart.com/docs/api/emails-batch) request. - **Built-in error handling and retry logic** — retry transient failures (network errors, `5xx`, rate limits) with exponential backoff, and surface validation errors without retrying. - **Idempotency-key support** — attach an `Idempotency-Key` header so a retried send is processed only once. See [Idempotency keys](https://www.senddart.com/docs/emails/idempotency). - **Works in any language** — the recipe is built on plain HTTP against `https://www.senddart.com/api`, so it applies whether the agent uses the official [`senddart` Node SDK](https://www.senddart.com/docs/resources/sdks) or raw `fetch`/`curl`/`requests`. - **Automatic activation** — when a task needs email, the agent reaches for the skill instead of hand-rolling a request. ## The core recipe At its heart the skill instructs the agent to authenticate with a Bearer API key (the `mb_` key from the [dashboard](https://www.senddart.com/docs/api-keys/overview)) and POST a JSON body to the Emails API. In Node, the official [`senddart` SDK](https://www.senddart.com/docs/resources/sdks) wraps this; in any other language the agent makes the same request over native HTTP. A minimal send the agent would produce looks like this: **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: 8f3a9c1e-2b4d-4e6f-9a1b-c2d3e4f5a6b7' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from your agent", "html": "

Sent through the SendDart skill.

" }' ``` **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY); async function sendEmail(body, { retries = 3 } = {}) { const idempotencyKey = crypto.randomUUID(); for (let attempt = 0; ; attempt++) { const { data, error } = await mb.emails.send(body, { idempotencyKey }); if (!error) return data; // Retry transient failures only; surface 4xx validation errors immediately. const status = error.statusCode ?? 0; if (attempt >= retries || (status < 500 && status !== 429)) { throw new Error(`send failed: ${status}`); } await new Promise(r => setTimeout(r, 2 ** attempt * 250)); } } ``` **Python** ```python import os, time, uuid, requests def send_email(body, retries=3): for attempt in range(retries + 1): res = requests.post( "https://www.senddart.com/api/emails", headers={ "Authorization": f"Bearer {os.environ['SENDDART_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, json=body, ) if res.ok: return res.json() # Retry transient failures only. if attempt >= retries or (res.status_code < 500 and res.status_code != 429): res.raise_for_status() time.sleep(2 ** attempt * 0.25) ``` > **Note:** Give the agent the same idempotency key across retries of one logical send so a network blip can never produce a duplicate email. A fresh key per *new* send. > **Warning:** Never expose your `mb_` API key in client-side code. The skill should read it from an environment variable or secret store and send only from server-side code. ## Batching When the agent has many distinct messages to send, the skill prefers `POST /emails/batch` (a JSON array of up to 100 email objects) over a loop of single sends. Every item is validated before any is sent — see [Batch sending](https://www.senddart.com/docs/emails/batch). --- # React Email Skill > Teach an AI agent to build responsive, cross-client HTML emails using React components, then send the rendered HTML via SendDart. The **React Email skill** lets an AI agent build production-ready HTML emails from React components. Instead of hand-writing fragile table-based HTML, the agent composes reusable components and renders them to the HTML and plain-text that SendDart sends. React Email is an open-source component library for email. The skill teaches the agent its component vocabulary and how to render a component to a string you pass to the SendDart [Emails API](https://www.senddart.com/docs/api/emails-send). ## How to give an agent this skill This is a skill *pattern* rather than a package to install. Capture the guidance below as a `SKILL.md` (or equivalent context file) in your repo so your agent reaches for [React Email](https://react.email) when it needs to build a message, then sends the rendered HTML with the official [`senddart` SDK](https://www.senddart.com/docs/resources/sdks) or plain HTTP. Add `@react-email/components` and `@react-email/render` to the project the agent works in. ```bash npm install @react-email/components @react-email/render ``` ## What it gives your agent - **Component-based templates** — build emails from reusable components for consistent, maintainable templates. - **Brand-consistent styling** — style with Tailwind so emails match your design system. - **Multi-format rendering** — generate both an HTML and a plain-text version of each email. - **Cross-client compatibility** — the components emit markup that renders correctly across major email clients. - **Live preview** — a preview server renders emails in real time with hot reloading during development. ## Build, render, send The agent writes a component, renders it to an HTML string, then hands that string to SendDart. The React Email part only produces the `html` and `text` bodies; the send itself can use the official [`senddart` SDK](https://www.senddart.com/docs/resources/sdks) or a plain HTTP `POST` (shown below). **emails/welcome.tsx** ```jsx import { Html, Button, Text } from '@react-email/components'; export default function Welcome({ name }: { name: string }) { return ( Hi {name}, welcome aboard! ); } ``` **send.ts** ```js import { render } from '@react-email/render'; import { SendDart } from 'senddart'; import Welcome from './emails/welcome'; const mb = new SendDart(process.env.SENDDART_API_KEY); const html = await render(); const text = await render(, { plainText: true }); const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Welcome aboard', html, text, }); ``` > **Note:** Provide both `html` and `text`. The plain-text alternative improves deliverability and renders for clients that block HTML. If you only send `html`, SendDart delivers it as-is; if you only send `text`, SendDart generates an HTML alternative. > **Warning:** Email clients support only a subset of CSS. Lean on React Email's components (which emit table-based, inline-styled markup) rather than modern layout CSS, and preview in the skill's preview server before sending. --- # Email Best Practices Skill > Give an AI agent the operational knowledge to build production-ready email: authentication, compliance, deliverability, webhooks, and suppression. The **Email Best Practices skill** gives an AI agent the operational knowledge to build a production-ready email integration — not just how to send one message, but how to keep a sending program healthy over time. It covers authentication, compliance, deliverability, and day-to-day operations. Use this skill alongside the [SendDart skill](https://www.senddart.com/docs/ai/skill-senddart): that one teaches the agent *how to call the API*, this one teaches it *what a responsible sender does*. ## How to give an agent this skill This is a reference *pattern*, not a package to install — capture the checklist below as a `SKILL.md` (or equivalent context file) in your repo and load it into your agent's context alongside the [SendDart skill](https://www.senddart.com/docs/ai/skill-senddart). The operational primitives it relies on already exist: [verified domains](https://www.senddart.com/docs/add-a-domain), [webhooks](https://www.senddart.com/docs/webhooks/overview), and [suppression lists](https://www.senddart.com/docs/emails/suppressions). ## What it covers - **DNS authentication** — step-by-step setup of SPF, DKIM, and DMARC so receivers trust your mail. See [Add a domain](https://www.senddart.com/docs/add-a-domain). - **Transactional vs. marketing design** — best practices for designing effective transactional emails (receipts, resets) and marketing emails (campaigns). - **Regional compliance** — guidelines for CAN-SPAM, GDPR, CASL, and other regional regulations, including required unsubscribe handling. - **Webhook event processing** — patterns for handling delivery notifications, bounces, and complaints. See [Webhooks](https://www.senddart.com/docs/webhooks/overview). - **Suppression list management** — strategies for maintaining a healthy [suppression list](https://www.senddart.com/docs/emails/suppressions) to protect deliverability. ## The deliverability checklist The skill encodes a checklist the agent applies before and during a sending program: 1. **Authenticate the domain** — Verify the sending domain and publish SPF, DKIM, and DMARC records. Send only from a verified domain — SendDart rejects sends from unverified `from` addresses. 2. **Separate streams** — Keep transactional and marketing mail on distinct subdomains so a marketing reputation problem never blocks password resets. 3. **Honor opt-outs** — For campaigns — and for a `POST /emails` send that sets `topic_id` — SendDart injects a per-recipient unsubscribe link and RFC 8058 `List-Unsubscribe` header automatically; a topic opt-out is scoped to that topic. For transactional mail (no `topic_id`), nothing is injected and sending is sender-driven — add your own opt-out where appropriate. See [Unsubscribe links](https://www.senddart.com/docs/emails/unsubscribe). 4. **Process events** — Subscribe to webhooks and react to `email.bounced` and `email.complained` events. Hard bounces and complaints auto-suppress the recipient; never re-mail a suppressed address. 5. **Watch your list hygiene** — Mailing addresses that bounce or complain damages your reputation. Let the suppression list do its job rather than stripping and re-adding suppressed recipients. > **Warning:** Compliance is not optional. Sending marketing email without a working unsubscribe mechanism, or mailing recipients who opted out, can violate anti-spam law and will harm your deliverability. > **Note:** Bounces and complaints are recorded on each email's [event log](https://www.senddart.com/docs/emails/managing) and forwarded to your webhooks. The skill teaches the agent to treat these as the source of truth for list health. --- # Agent Email Inbox Skill > Give an AI agent a secure inbox to receive and act on inbound email, with five security levels that defend against prompt injection and spoofing. The **Agent Email Inbox skill** lets an AI agent securely receive and act on inbound email through SendDart's webhook-based inbound architecture. Crucially, it bakes in security from the start: an inbox is **untrusted input**, and without guardrails anyone who knows your agent's address could send instructions the agent would execute. Unlike polling, SendDart delivers inbound email via **webhooks** — your server is notified the moment a message arrives, with no cron jobs and no wasted API calls checking an empty inbox. ## How to give an agent this skill This is a security *pattern*, not a package to install. Capture the architecture and security levels below as a `SKILL.md` (or equivalent context file) in your repo and load it into your agent's context alongside the [SendDart skill](https://www.senddart.com/docs/ai/skill-senddart). It builds entirely on primitives that already exist: inbound [webhooks](https://www.senddart.com/docs/webhooks/overview) (`email.received`), the [Receiving API](https://www.senddart.com/docs/receiving/introduction), and the [`senddart` SDK](https://www.senddart.com/docs/resources/sdks) or native HTTP for replies. Document each security level with full implementation code in your skill file so the agent can apply the right one. Because the underlying calls work over native HTTP, the patterns work in any language. ## Architecture ```text Email -> SendDart -> Webhook -> Your Server -> Validate | Process or Reject ``` Your agent processes only emails that pass your chosen security level. Rejected emails are logged and silently acknowledged with a `200` so SendDart does not retry the webhook. ## Security levels Pick a security level before you set up your webhook endpoint. Start with **Level 1** and relax only if you must. | Level | Name | Best for | | --- | --- | --- | | **1** | Strict Allowlist | Most use cases — only process email from known senders. | | **2** | Domain Allowlist | Organization-wide access from trusted domains. | | **3** | Content Filtering | Accept from anyone, but filter unsafe patterns. | | **4** | Sandboxed Processing | Process all email with restricted agent capabilities. | | **5** | Human-in-the-Loop | Require human approval for actions from untrusted senders. | ## Minimal handler A minimal webhook handler verifies the signature, checks the sender against an allowlist (Level 1), and fetches the full message before handing it to the agent. With SendDart you verify the signature against your webhook signing secret, then react to the `email.received` event. ```js import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY); const ALLOWED_SENDERS = ['your@email.com']; async function handler(req) { const payload = await req.text(); // Verify the webhook signature against your signing secret before trusting it. if (!verifySendDartSignature(payload, req.headers, process.env.SENDDART_WEBHOOK_SECRET)) { return new Response('invalid signature', { status: 400 }); } const event = JSON.parse(payload); if (event.type === 'email.received') { // Level 1: silently drop anything not on the allowlist. if (!ALLOWED_SENDERS.includes(event.data.from.toLowerCase())) { return new Response('OK', { status: 200 }); } // Fetch the full inbound message, then hand it to the agent. const { data: email } = await mb.emails.receiving.get(event.data.email_id); await processEmailForAgent(email); } return new Response('OK', { status: 200 }); } ``` > **Warning:** Always verify the webhook signature before parsing or trusting the payload — otherwise an attacker can forge `email.received` events. See [Webhooks](https://www.senddart.com/docs/webhooks/overview) for signature verification. > **Note:** The skill includes patterns for the common threats an inbox faces: prompt injection in the email body, sender spoofing, and email flooding. Treat the message body as data to be summarized, never as instructions to obey. --- # Chat SDK > A pattern for building conversational, two-way email on SendDart — send with the SDK, receive via webhooks, thread with email headers. You can turn email into a two-way communication channel for an agent or app: **send** with the official [`senddart` SDK](https://www.senddart.com/docs/resources/sdks) (or [POST /emails](https://www.senddart.com/docs/api/emails-send)), **receive** inbound mail through [webhooks](https://www.senddart.com/docs/webhooks/overview), and **thread** conversations using standard email headers. This page describes that pattern and shows how to package it as a [Vercel Chat SDK](https://chat-sdk.dev) adapter so reply chains map cleanly onto Chat SDK threads. > **Note:** SendDart does not publish a prebuilt Chat SDK adapter package. The adapter below is a thin wrapper *you* write over the real primitives (the SDK + inbound webhooks). It is roughly 100 lines; the sections that follow give you the building blocks. ## Prerequisites - [Create an API key](https://www.senddart.com/docs/api-keys/overview). - [Verify your domain](https://www.senddart.com/docs/domains/managing). - [Set up webhooks](https://www.senddart.com/docs/webhooks/overview) for `email.received` events. - [Enable receiving](https://www.senddart.com/docs/receiving/introduction) on your domain. ## 1. Send with the SDK Install the official Node SDK. Every reply you post is just an `emails.send` call from a verified address. ```bash npm install senddart ``` ```ts import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY!); async function reply(to: string, subject: string, text: string, headers?: Record) { const { data, error } = await mb.emails.send({ from: 'My Bot ', to: [to], subject, text, headers, // set In-Reply-To / References here to keep the thread intact }); if (error) throw new Error(`${error.name}: ${error.message}`); return data; } ``` ## 2. Receive via webhooks Point a SendDart webhook at your server and subscribe to the `email.received` event. Verify the signature against your signing secret, then fetch the full message — including headers and body — from the [Receiving API](https://www.senddart.com/docs/receiving/introduction). ```ts // POST /webhook async function handler(req: Request) { const payload = await req.text(); // Verify the signature against SENDDART_WEBHOOK_SECRET before trusting input. if (!verifySendDartSignature(payload, req.headers, process.env.SENDDART_WEBHOOK_SECRET!)) { return new Response('invalid signature', { status: 400 }); } const event = JSON.parse(payload); if (event.type === 'email.received') { // Fetch the full inbound message (headers, text, html, attachments). const { data: email } = await mb.emails.receiving.get(event.data.email_id); await onInbound(email); } return new Response('ok', { status: 200 }); } ``` See [Webhook signatures](https://www.senddart.com/docs/webhooks/overview) for the verification details and [Receiving](https://www.senddart.com/docs/receiving/introduction) for the inbound message shape. ## 3. Thread with email headers Email threading is carried entirely by standard headers — there is no special API. When you reply, set `In-Reply-To` to the inbound message's `Message-ID` and append it to `References`. Group inbound messages into a conversation by following the same chain. ```ts async function onInbound(email) { const messageId = email.headers['message-id']; const references = [email.headers['references'], messageId].filter(Boolean).join(' '); await reply(email.from, `Re: ${email.subject}`, `Got your email: ${email.text}`, { 'In-Reply-To': messageId, 'References': references, }); } ``` > **Warning:** Email is immutable: there is no edit, delete, reaction, or typing indicator. A "conversation" is just a chain of sent and received messages linked by `In-Reply-To`/`References`. ## Packaging it as a Chat SDK adapter If you use the Vercel Chat SDK, you can wrap the three steps above in a custom adapter so reply chains surface as Chat SDK threads. The adapter's `post` maps to `mb.emails.send`, its webhook handler maps to step 2, and thread resolution uses the `In-Reply-To`/`References` headers from step 3. A minimal shape: ```ts import { SendDart } from 'senddart'; // A custom adapter you author — not a published package. function createSendDartAdapter(opts: { fromAddress: string; fromName?: string }) { const mb = new SendDart(process.env.SENDDART_API_KEY!); return { name: 'senddart', async post(thread, text) { await mb.emails.send({ from: opts.fromName ? `${opts.fromName} <${opts.fromAddress}>` : opts.fromAddress, to: [thread.recipient], subject: thread.subject, text, headers: thread.threadHeaders, // In-Reply-To / References }); }, // verify signature -> fetch via mb.emails.receiving.get -> resolve thread by headers async handleWebhook(request) { /* step 2 + step 3 */ }, }; } ``` > **Note:** Keep the adapter name `"senddart"` consistent across your Chat config and your thread routing so inbound emails resolve to the right thread. ## Going further - [Card emails](https://www.senddart.com/docs/ai/chat-sdk-cards) — send rich HTML emails with structured card elements. - [Attachments](https://www.senddart.com/docs/ai/chat-sdk-attachments) — handle inbound email attachments. - [Proactive outreach](https://www.senddart.com/docs/ai/chat-sdk-outreach) — start new email threads without waiting for inbound. --- # Chat SDK Attachments > Handle inbound email attachments in a conversational-email integration built on SendDart webhooks and the SDK. When someone sends an email with file attachments, the inbound message you fetch via [Receiving](https://www.senddart.com/docs/receiving/attachments) exposes them as a list. Each attachment includes the filename, MIME type, and a way to download the content. In a Chat SDK adapter (see [Chat SDK](https://www.senddart.com/docs/ai/chat-sdk)) you surface these on the message you hand to your handler. ## Attachment shape The shape below is what a custom adapter typically exposes; it mirrors the attachment metadata returned by the [Receiving attachments API](https://www.senddart.com/docs/receiving/attachments). ```ts interface InboundAttachment { filename: string; contentType: string; url?: string; } ``` | Name | Type | Required | Description | | --- | --- | --- | --- | | `filename` | string | No | Original filename, e.g. `invoice.pdf`. | | `contentType` | string | No | MIME type, e.g. `application/pdf`. | | `url` | string | No | Optional download URL for the attachment content. | ## Detecting and processing attachments Read the attachment list off the inbound message (fetched with `mb.emails.receiving.get` in your webhook handler) and reply with the SDK. ```ts async function onInbound(email) { const attachments = email.attachments ?? []; if (attachments.length === 0) { await reply(email.from, `Re: ${email.subject}`, 'Got your email — no attachments found.'); return; } const summary = attachments .map((a) => `${a.filename} (${a.contentType})`) .join(', '); await reply(email.from, `Re: ${email.subject}`, `Received ${attachments.length} attachment(s): ${summary}`); } ``` > **Note:** For the full inbound-attachment API — fetching content, size limits, and MIME handling — see [Receiving attachments](https://www.senddart.com/docs/receiving/attachments). --- # Chat SDK Card Emails > Send rich, structured HTML card emails by rendering a card object to HTML with React Email and sending it via SendDart. A "card" is a small data structure you render into styled HTML with `@react-email/components`, then send via the [`senddart` SDK](https://www.senddart.com/docs/resources/sdks) (or [POST /emails](https://www.senddart.com/docs/api/emails-send)). This lets you send structured, branded messages without hand-writing raw email HTML. In a Chat SDK adapter (see [Chat SDK](https://www.senddart.com/docs/ai/chat-sdk)) your `post` method accepts a card and does the render-and-send. ## Card structure Define a card type in your own code: a `type`, a `title`, an optional `subtitle`, and a `children` array. Children can be text blocks, dividers, link buttons, or action groups. ```ts interface CardElement { /* defined in your project */ } const card: CardElement = { type: 'card', title: 'Order Confirmed', subtitle: 'Order #1234', children: [ { type: 'text', content: 'Your order has been shipped.' }, { type: 'divider' }, { type: 'actions', children: [ { type: 'link-button', label: 'Track Order', url: 'https://example.com/track/1234', }, ], }, ], }; ``` ### Child element types | Name | Type | Required | Description | | --- | --- | --- | --- | | `text` | content | No | A plain-text paragraph. | | `divider` | — | No | A horizontal rule. | | `link-button` | label, url | No | A clickable button that opens a URL. | | `actions` | children | No | A container for one or more link buttons. | ## Rendering and sending a card Render the card to an HTML string with `@react-email/render`, then send it with the SDK. Always provide a plain-text `text` fallback for clients that strip HTML. ```ts import { render } from '@react-email/render'; import { SendDart } from 'senddart'; import { CardEmail } from './emails/card'; // a React Email component you write const mb = new SendDart(process.env.SENDDART_API_KEY!); async function sendCard(to: string, card: CardElement, fallbackText: string) { const html = await render(); const { error } = await mb.emails.send({ from: 'My Bot ', to: [to], subject: card.title, html, text: fallbackText, }); if (error) throw new Error(`${error.name}: ${error.message}`); } ``` > **Warning:** Always include a `text` fallback. Some email clients strip HTML entirely, and the plain-text body is what recipients see in that case. --- # Chat SDK Proactive Outreach > Start new email conversations proactively by sending a fresh email with the SendDart SDK — replies flow back through your inbound webhook. Conversational email does not have to start with an inbound message. To reach out first, just send a new email with the [`senddart` SDK](https://www.senddart.com/docs/resources/sdks) — no `In-Reply-To` header, since this message begins a new thread. When the recipient replies, the response arrives through your normal [inbound webhook](https://www.senddart.com/docs/ai/chat-sdk) and you thread it with `In-Reply-To`/`References`. ## Sending a proactive email A proactive message is a plain send. Capture the returned `Message-ID` so you can match the recipient's reply back to this conversation. ```ts import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY!); async function openConversation(to: string, subject: string, text: string) { const { data, error } = await mb.emails.send({ from: 'My Bot ', to: [to], subject, text, }); if (error) throw new Error(`${error.name}: ${error.message}`); return data; // store data.id to correlate the eventual reply } ``` You can also send card emails in proactive threads — render a card to HTML and pass it as `html`, exactly as in [Card emails](https://www.senddart.com/docs/ai/chat-sdk-cards). ## Triggering via HTTP A common pattern is exposing an HTTP endpoint that triggers outbound emails. This lets external systems — cron jobs, webhooks from other services, admin dashboards — send email through your bot. ```ts async function handleNotify(req, res) { const { to, subject, message } = JSON.parse(await readBody(req)); const email = await openConversation(to, subject ?? 'A message for you', message); res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ ok: true, id: email.id })); } ``` Then call it: ```bash curl -X POST http://localhost:3000/notify \ -H "Content-Type: application/json" \ -d '{"to": "user@example.com", "subject": "Shipping update", "message": "Your order has shipped!"}' ``` ## When to use this - Welcome emails when a user signs up. - Order confirmations and shipping updates. - Alert notifications (monitoring, billing, security). - Scheduled digests or reminders. > **Note:** When the recipient replies, the response arrives through your inbound `email.received` webhook (see [Chat SDK](https://www.senddart.com/docs/ai/chat-sdk)). Match it back to this conversation by the `In-Reply-To`/`References` headers, which point at the `Message-ID` of the email you sent. --- # v0 > Add email sending with SendDart to a v0 project by asking the chat to wire it up with your API key. [v0](https://v0.dev) by Vercel is a platform for building sites, tools, apps, and projects via chat. You can add SendDart to a v0 project by asking the chat to add email sending and pointing it at your SendDart API key. ## 1. Add your SendDart API key Create a SendDart API key in the [dashboard](https://www.senddart.com/docs/api-keys/overview), then ask v0 to add email sending and store the key as an environment variable (e.g. `SENDDART_API_KEY`). In Node.js/TypeScript projects v0 can install the official `senddart` SDK (`npm install senddart`) and call `mb.emails.send(...)`. In other languages or runtimes, sends are plain HTTP `POST`s to `https://www.senddart.com/api/emails`. > **Warning:** Do not share your API key or expose it in the browser or other client-side code. Keep the send on the server side and read the key from an environment variable. ## Example prompt ```text Add email sending with SendDart. When the contact form is submitted, send an email by POSTing to https://www.senddart.com/api/emails with an Authorization: Bearer header using SENDDART_API_KEY. Read the key from an environment variable. ``` ## 2. Add a custom domain By default you can only send email to your own address. To send to other recipients, [add and verify a custom domain](https://www.senddart.com/docs/add-a-domain), then update the `from` field in the send code to use an address on that domain (or ask the chat to update it). --- # Lovable > Add email sending with SendDart to a Lovable project, storing your API key securely via Supabase. [Lovable](https://lovable.dev) is a platform for building sites, tools, apps, and projects via chat. You can add SendDart to a Lovable project by asking the chat to add email sending with SendDart. ## 1. Add your SendDart API key Create a SendDart API key in the [dashboard](https://www.senddart.com/docs/api-keys/overview). Lovable may wire up email in a few ways: - Store the API key as a secret via the **Supabase integration** *(highly recommended)*. - Prompt you to provide your own API key. - Add the API key directly in the code (least secure — avoid). Prompt Lovable to store the key for SendDart using Supabase. The send itself runs in a Supabase Edge Function; in Deno/Edge environments it can `POST` to `https://www.senddart.com/api/emails` directly, or use the `senddart` Node SDK (`npm install senddart`) when the function targets a Node-compatible runtime. > **Note:** At the time of writing, Lovable relies on the Supabase integration to store secrets rather than handling API keys independently. Keep the key out of client-side code. ## 2. Add a custom domain By default you can only send email to your own address. To send to other recipients, [add and verify a custom domain](https://www.senddart.com/docs/add-a-domain), then update the `from` address used by the edge function. > **Warning:** Once your custom domain is verified, the edge function does not redeploy automatically. Ask Lovable to update the `from` address to your verified domain and redeploy the function so the change takes effect. --- # Bolt.new > Add email sending with SendDart to a Bolt.new project using a .env-stored API key. [Bolt.new](https://bolt.new) is a platform for building full-stack web and mobile apps via chat. You can add SendDart to a Bolt.new project by asking the chat to add email sending with SendDart. ## 1. Add your SendDart API key Create a SendDart API key in the [dashboard](https://www.senddart.com/docs/api-keys/overview). To store it safely, use a `.env` file — you may need to include that instruction in your prompt to Bolt.new. In Node.js projects, tell Bolt to install the official `senddart` SDK (`npm install senddart`) and call `mb.emails.send(...)` server-side. In other runtimes, Bolt can send via a plain `POST` to `https://www.senddart.com/api/emails` with `Authorization: Bearer $SENDDART_API_KEY`. > **Warning:** Do not share your API key or expose it in the browser or other client-side code. Read it from `process.env` on the server. ## Example prompt ```text Add email sending with SendDart. Store the API key in a .env file as SENDDART_API_KEY. When the form is submitted, send an email server-side by POSTing to https://www.senddart.com/api/emails with an Authorization: Bearer header. ``` ## 2. Add a custom domain By default you can only send email to your own address. To send to other recipients, [add and verify a custom domain](https://www.senddart.com/docs/add-a-domain), then update the `from` field in the send code to use an address on that domain (or ask the chat to update it). --- # Base44 > Add email sending with SendDart to a Base44 app using backend functions and a stored API key. [Base44](https://base44.com) is a platform for building apps with AI. You can add SendDart to a Base44 project by asking the chat to add email sending with SendDart. > **Note:** This integration requires **backend functions**, available on the Builder tier and above, because the API key must be used server-side. ## 1. Wire up email in Base44 **If adding to an existing app**, enable backend functions, then ask the chat: ```text Add SendDart email sending to my app. Prompt me to provide the API key, store it server-side as SENDDART_API_KEY, and send a welcome email to new users by POSTing to https://www.senddart.com/api/emails with an Authorization: Bearer header. ``` In Node.js backend functions you can install the official `senddart` SDK (`npm install senddart`) and call `mb.emails.send(...)`. In other runtimes the backend function calls the SendDart Emails API over plain HTTP. ## 2. Add your SendDart API key However you add email to your project, create a SendDart API key in the [dashboard](https://www.senddart.com/docs/api-keys/overview) and store it as a backend secret named `SENDDART_API_KEY`. > **Warning:** Do not share your API key or expose it in client-side code. Keep it in a backend function secret. ## 3. Add a custom domain By default you can only send email to your own address. To send to other recipients, [add and verify a custom domain](https://www.senddart.com/docs/add-a-domain), then update the `from` field in the backend function to use an address on that domain (or ask the chat to update it). --- # Replit > Add email sending with SendDart to a Replit project with an API key and verified from address. [Replit](https://replit.com) is a platform for building sites and apps with AI. You can add SendDart to a Replit project by asking the chat to add email sending with SendDart. ### Example prompt ```text When someone fills out the contact form, send an email using SendDart. ``` ## 1. Add a custom domain By default you can only send email to your own address. To send to other recipients, [add and verify a custom domain](https://www.senddart.com/docs/add-a-domain), then use an address on that domain as the `from` address in the next step. ## 2. Add your SendDart API key and from address Create a SendDart API key in the [dashboard](https://www.senddart.com/docs/api-keys/overview) and store it as a secret (e.g. `SENDDART_API_KEY`). The `from` address is the verified address your email is sent from — use the custom domain you added in step 1 (e.g. `hello@example.com`). In Node.js Repls, Replit can install the official `senddart` SDK (`npm install senddart`) and call `mb.emails.send(...)`. In other languages, the generated code calls the SendDart API over plain HTTP. > **Warning:** Do not share your API key or expose it in the browser or other client-side code. Store it as a Replit secret and read it server-side. --- # Leap.new > Add email sending with SendDart to a Leap.new project using an Infrastructure secret. [Leap](https://leap.new) is a platform for building full-stack web and mobile apps via chat. ## 1. Ask Leap to add SendDart Add SendDart to a Leap project by asking the chat to add email sending with SendDart. ### Example prompt ```text When someone fills out the contact form, send an email using SendDart. ``` ## 2. Add your SendDart API key Create a SendDart API key in the [dashboard](https://www.senddart.com/docs/api-keys/overview). Leap prompts you to set a secret value on the **Infrastructure** page — paste your key (e.g. as `SENDDART_API_KEY`) and click **Update secret**. In Node.js projects, Leap can use the official `senddart` SDK (`npm install senddart`) and call `mb.emails.send(...)`. In other runtimes, the generated backend calls the SendDart Emails API over plain HTTP. > **Warning:** Do not share your API key or expose it in client-side code. Store it as a Leap Infrastructure secret. ## 3. Add a custom domain By default you can only send email to your own address. To send to other recipients, [add and verify a custom domain](https://www.senddart.com/docs/add-a-domain), then update the `from` field in the send code to use an address on that domain (or ask the chat to update it). --- # Anything > Add email sending with SendDart to an Anything project by adding the API key as a project secret. [Anything](https://createanything.com) is a platform for building sites, tools, apps, and projects via chat. You can send email from your Anything project by asking the chat to add email functionality with SendDart. ## 1. Ask Anything to add email In the chat, ask Anything to add email functionality to your project and have it call the SendDart API. In Node.js projects, the generated function can use the official `senddart` SDK (`npm install senddart`) and call `mb.emails.send(...)`. In other runtimes it sends with a plain HTTP `POST` to `https://www.senddart.com/api/emails`. ## 2. Add your SendDart API key Anything usually prompts you for an API key. If it doesn't, open the project's **More options** menu and select **Secrets**, then add a new secret: | Name | Type | Required | Description | | --- | --- | --- | --- | | `Name` | string | Yes | Use `SENDDART_API_KEY`. | | `Value` | string | Yes | Your SendDart API key (e.g. `mb_xxxxxxxxx`), created in the [dashboard](https://www.senddart.com/docs/api-keys/overview). | > **Warning:** Do not share your API key or expose it in client-side code. Store it as a project secret. ## 3. Add a custom domain By default you can only send email to your own address. To send to other recipients, [add and verify a custom domain](https://www.senddart.com/docs/add-a-domain), then update the `from` field in the function to use an address on that domain. --- # Devin > Connect Devin to SendDart over MCP so the agent can send emails, manage contacts, and run campaigns. [Devin](https://devin.ai) is an autonomous AI software engineer that can connect to external services through MCP (Model Context Protocol) servers. Adding SendDart's MCP server gives Devin native access to send emails, manage contacts and campaigns, verify domains, and more. For the full list of capabilities, see the [MCP server overview](https://www.senddart.com/docs/ai/mcp-server). ## Prerequisites - A Devin account with access to the **Settings** menu. - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview). - A [verified domain](https://www.senddart.com/docs/add-a-domain). ## 1. Open Connections > MCP Servers In Devin, open **Settings** from your account dropdown. In the sidebar click **Connections**, select the **MCP Servers** tab, then click **Add a custom MCP**. ## 2. Add the SendDart MCP configuration Click **Import JSON** and paste the following configuration into the modal: ```json { "mcpServers": { "senddart": { "command": "npx", "args": ["-y", "senddart-mcp"], "env": { "SENDDART_API_KEY": "mb_xxxxxxxxx", "SENDER_EMAIL_ADDRESS": "hello@yourdomain.com" } } } } ``` ## 3. Update the environment variables - `SENDDART_API_KEY` — delete the inline value and add it as a **secret** instead (next step). - `SENDER_EMAIL_ADDRESS` — set this to a sender address on a domain you've [verified](https://www.senddart.com/docs/add-a-domain). ## 4. Add the API key as a secret Add `SENDDART_API_KEY` as a Devin secret and click **Save secret** to confirm. You can create a new API key any time in the [dashboard](https://www.senddart.com/docs/api-keys/overview). > **Warning:** Store the API key as a secret rather than inline in the MCP config so it isn't exposed in plaintext. ## 5. Enable and test Add a description, click **Install and Enable**, and confirm in the dialog. Devin installs the server and marks it connected. Then ask Devin to send a test email: ```text Send a test email to delivered@test.senddart.com using the SendDart MCP server. Subject: "Hello from Devin". ``` Devin calls the SendDart MCP server and confirms the send. --- # Paper > Combine the Paper and SendDart MCP servers so your agent can turn a Paper design into a SendDart template or campaign. [Paper](https://paper.design) is a design tool built for AI agents. Its MCP server lets an agent read your canvas — layout, styles, copy, and screenshots. Combined with the [SendDart MCP server](https://www.senddart.com/docs/ai/mcp-server), your agent can take a design straight from Paper and turn it into a ready-to-send [template](https://www.senddart.com/docs/templates/overview) or [campaign](https://www.senddart.com/docs/campaigns/managing) in your SendDart account. The flow: 1. **Design** — You design an email in Paper. 2. **Read** — Your agent reads the design through the Paper MCP server. 3. **Convert** — Your agent converts the design into email-safe HTML using the SendDart MCP server and [agent skills](https://www.senddart.com/docs/ai/skill-senddart). 4. **Create** — Your agent creates a template or campaign in SendDart. ## Prerequisites - The [Paper Desktop app](https://paper.design/downloads) installed with a file open (opening a file starts the Paper MCP server automatically). - A SendDart [API key](https://www.senddart.com/docs/api-keys/overview) and a [verified domain](https://www.senddart.com/docs/add-a-domain). - An MCP client like Claude Code, Cursor, or Claude Desktop. ## 1. Connect the Paper MCP server Paper Desktop runs a local MCP server at `http://127.0.0.1:29979/mcp` whenever a file is open. Connect it in your client: **Claude Code** ```bash # Install the official Paper plugin (recommended): /plugin marketplace add paper-design/agent-plugins /plugin install paper-desktop@paper # Or add the MCP server directly: claude mcp add paper --transport http http://127.0.0.1:29979/mcp --scope user ``` **Codex** ```bash # Install the official Paper plugin (recommended): codex plugin marketplace add paper-design/agent-plugins /plugins # Then select the paper-design/agent-plugins marketplace and install paper-desktop. ``` **Cursor** ```bash # Run in the agent panel, or search "Paper" in the Cursor Marketplace: /add-plugin paper-desktop ``` **Claude Desktop** ```json { "mcpServers": { "paper": { "command": "npx", "args": ["mcp-remote", "http://127.0.0.1:29979/mcp"] } } } ``` See the [Paper MCP docs](https://paper.design/docs/mcp) for other clients. ## 2. Connect the SendDart MCP server Add the SendDart MCP server with your API key: **Claude Code** ```bash claude mcp add senddart -e SENDDART_API_KEY=mb_xxxxxxxxx -- npx -y senddart-mcp ``` **Codex** ```bash codex mcp add senddart \ --env SENDDART_API_KEY=mb_xxxxxxxxx \ -- npx -y senddart-mcp ``` **Cursor** ```json { "mcpServers": { "senddart": { "command": "npx", "args": ["-y", "senddart-mcp"], "env": { "SENDDART_API_KEY": "mb_xxxxxxxxx" } } } } ``` **Claude Desktop** ```json { "mcpServers": { "senddart": { "command": "npx", "args": ["-y", "senddart-mcp"], "env": { "SENDDART_API_KEY": "mb_xxxxxxxxx" } } } } ``` For more clients and options, see the [MCP server overview](https://www.senddart.com/docs/ai/mcp-server). ## 3. Design your email in Paper Design your email as an artboard. A few tips for designs that translate well to email: - Use a single-column layout around 600px wide. - Use real copy instead of placeholder text. - Use web-safe fonts like System Sans-Serif or System Serif. - Use PNG or JPG images instead of SVGs (not supported in email). > **Note:** For personalization, write the variable directly into the design copy, like `Hi {{{NAME|there}}}`. Your agent preserves it when creating the template or campaign. ## 4. Ask your agent to create an email You can create either a template or a campaign. To create a **template**, select an artboard in Paper and, with both servers connected, prompt: ```text Look at the selected artboard in Paper and recreate it as an email template in SendDart. Convert the design to email-safe HTML (inline styles, table-based layout) using the SendDart agent skills. Provide a name, subject, and preview text that fits the content. Publish the template. ``` Behind the scenes the agent: 1. Calls Paper's `get_selection` and `get_screenshot` to see the design. 2. Calls Paper's `get_jsx` or `get_computed_styles` to read the exact layout, colors, and copy. 3. Converts the output into email-safe HTML. 4. Calls SendDart's `create-template` with the HTML, name, and subject. 5. Calls SendDart's `publish-template` to make it available for sending. Templates support variables using triple-brace syntax like `{{{USERNAME}}}`. Once published, send the template via the [Emails API](https://www.senddart.com/docs/api/emails-send) or the dashboard. To go from design straight to a send, ask for a **campaign** instead — the agent reads the design the same way, then calls `create-campaign` with the HTML, sender, subject, and segment. Create it as a draft and review it in the dashboard before sending. > **Note:** Before sending a campaign you must define which [segment](https://www.senddart.com/docs/segments/overview) should receive it. If you don't have one yet, your agent can create one. ## Refine in the visual editor Templates and campaigns created by your agent are editable in the SendDart dashboard. If you want the agent's content to be fully editable in the visual editor, ask it to use `compose-template` or `compose-campaign` instead of raw HTML — the agent appears as a named avatar in the editor while it works, and you can hand-tune the result afterwards. Alternatively, edit the template or campaign directly in the dashboard: select the **Editor icon** in the top left and **Hold to confirm** to convert the HTML into a visual template or campaign. ## Example: end-to-end prompt ```text 1. Read the "Launch Announcement" artboard from Paper. 2. Convert it to an email-safe HTML email. Preserve the colors, spacing, and copy as closely as email clients allow. Use the SendDart agent skills. 3. Create it as a campaign in SendDart from announcements@yourdomain.com to the "Customers" segment, subject "We just launched". 4. Show me a summary and the dashboard link, but do not send it. ``` ## Troubleshooting - **Agent can't reach Paper** — make sure Paper Desktop is running with a file open, then restart your agent session. - **Design looks different in the email** — email clients don't support modern CSS. Ensure the SendDart [agent skills](https://www.senddart.com/docs/ai/skill-senddart) are installed, then ask the agent to use table-based layout and inline styles and to flag anything (custom fonts, complex gradients) that won't survive the conversion. - **`create-campaign` fails** — check that the `from` address uses a [verified domain](https://www.senddart.com/docs/add-a-domain) and that the segment exists. --- # OpenClaw > Give your OpenClaw AI agent an inbox with SendDart — send reports, parse newsletters and receipts, and receive replies via signed webhooks, with a leveled security model. This guide shows how to give an [OpenClaw](https://openclaw.ai) AI agent its own email inbox backed by SendDart — so it can send and receive mail with a dedicated address instead of borrowing your credentials. ## Why give your agent an inbox? An inbox lets your agent: - **Sign up for its own accounts** on GitHub, hosting platforms, and more, so you never share your personal credentials. - **Process attachments** such as receipts and invoices, and act on them. - **Receive newsletters**, parse them, and forward the important parts to you. - **Send daily reports and digests**. - **Send and receive email** as a first-class capability. ## Step 1: Get an API key Create a [SendDart API key](https://www.senddart.com/docs/create-an-api-key) for the agent from the dashboard — key creation is a human, signed-in step, so the agent cannot mint its own key (or widen the one you give it). Scope it to a dedicated domain if you want to sandbox the agent away from your production sending. > **Warning:** Do not paste the key into the chat. SSH into the agent’s machine and store it in an `.env` file, or put it in a password manager (e.g. a 1Password service account) the agent can read from its own vault. ## Step 2: Verify a domain Your agent needs an address to send from and receive at. We strongly recommend a **subdomain** (`agent.example.com`) rather than the root domain, especially if you want to receive mail, so the agent’s sending reputation stays isolated from your primary domain. 1. **Add the domain** — Create the subdomain via [POST /domains](https://www.senddart.com/docs/api/domains-create) or the dashboard, choosing the region closest to your agent. 2. **Add the DNS records** — SendDart returns SPF, DKIM, and (for receiving) MX records. Add them at your DNS provider. See [Managing domains](https://www.senddart.com/docs/domains/managing). 3. **Enable receiving** — If the agent should receive mail, enable inbound on the domain and add the MX record SendDart provides — not just sending records. 4. **Wait for verification** — Verification usually completes within minutes (up to 72 hours for DNS to propagate). Poll [GET /domains/:id](https://www.senddart.com/docs/api/domains-get) until `status` is `verified`. Once verified, store the address in the agent’s memory and have it send you a test email to confirm sending works. ## Step 3: Receive email via webhooks At this point the agent can send but not receive. To receive, register a [webhook](https://www.senddart.com/docs/webhooks/overview) for the `email.received` event pointing at a public URL. During development, expose a local server with a tunnel such as Tailscale Funnel: ```bash tailscale funnel 3000 # gives a stable public URL like https://hostname.tailnet-name.ts.net ``` ```bash curl -X POST 'https://www.senddart.com/api/webhooks' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "endpoint": "https://hostname.tailnet-name.ts.net/api/webhook", "events": ["email.received"] }' ``` > **Warning:** When SendDart returns the webhook signing secret, store it securely (the same way you stored the API key) — never paste it into the chat. A minimal handler verifies the signature, applies a sender allowlist, fetches the full inbound email, then notifies you: ```js import { SendDart, verifyWebhookSignature } from 'senddart'; const API_KEY = process.env.SENDDART_API_KEY; const WEBHOOK_SECRET = process.env.SENDDART_WEBHOOK_SECRET; // 'whsec_...' const mb = new SendDart(API_KEY); // Security: strict allowlist const ALLOWED_SENDERS = ['your@email.com']; async function handler(req) { // The raw body string — never a re-serialized JSON object, or the signature // will not match. const payload = await req.text(); // verifyWebhookSignature accepts a Fetch Headers instance directly (5.1+ // iterates it); the plain-object unpack below is just explicit about which // headers matter. const headers = { 'svix-id': req.headers.get('svix-id'), 'svix-timestamp': req.headers.get('svix-timestamp'), 'svix-signature': req.headers.get('svix-signature'), }; // Checks the HMAC and (by default) rejects a timestamp more than 5 minutes // out. `reason` names the failure, e.g. 'no_match' or 'missing_headers'. const { valid, reason } = verifyWebhookSignature(payload, headers, WEBHOOK_SECRET); if (!valid) { return new Response(`Invalid signature: ${reason}`, { status: 400 }); } const event = JSON.parse(payload); if (event.type === 'email.received') { if (!ALLOWED_SENDERS.includes(event.data.from.toLowerCase())) { return new Response('OK', { status: 200 }); // ignore, but ack } // Fetch the full inbound email with the SDK. const { data: email } = await mb.emails.receiving.get(event.data.email_id); await notifyUser(email); } return new Response('OK', { status: 200 }); } ``` > **Note:** For production, deploy the handler behind a stable URL and register it via [POST /webhooks](https://www.senddart.com/docs/webhooks/overview). See [Receiving email](https://www.senddart.com/docs/webhooks/overview) for full inbound payloads, bodies, and attachments. ## Step 4: Instant notifications via OpenClaw Rather than polling its inbox on a cron, your agent can use OpenClaw’s Gateway API to be notified the instant SendDart delivers an `email.received` webhook — turning each inbound message into a real-time prompt. Wire your webhook handler to call the Gateway API, then send a test email to confirm the agent reacts immediately. ## Security considerations An agent inbox is powerful, and inbound email is an untrusted input — **prompt injection via email is a real risk**. SendDart signs every webhook so you can reject forged payloads, but you also need a policy for what the agent does with verified mail. Choose a security level and start strict: 1. **Strict allowlist** — Only act on email from specific known senders. Recommended for most use cases. 2. **Domain allowlist** — Act on email from any sender at a trusted domain (e.g. anyone at example.com). 3. **Content filtering with sanitization** — Accept email from anyone, but sanitize the body to strip likely injection attempts before the agent reads it. 4. **Sandboxed processing** — Process all email, but in a restricted context where the agent has limited capabilities and tools. 5. **Human-in-the-loop** — Process all email but require human approval before the agent takes any action. > **Warning:** Begin with the strict allowlist and only loosen it if a use case demands it. Always verify the webhook signature before trusting a payload — see [Verify webhooks](https://www.senddart.com/docs/webhooks/verify). --- # Examples > Copy-paste recipes for the most common SendDart tasks — sending, batching, scheduling, attachments, contacts, and webhooks — using nothing but an HTTP client. SendDart is a plain JSON REST API with official SDKs for Node.js, Ruby, PHP, Python, Go, Rust, Java, and .NET (plus a CLI) — see the [install table](https://www.senddart.com/docs/api/introduction). Every endpoint page in these docs carries a copyable tab for each of them alongside raw **cURL**. The snippets below string those endpoints together into the recipes people ask for most. Swap `mb_xxxxxxxxx` for your API key and `yourdomain.com` for a [verified domain](https://www.senddart.com/docs/domains/managing). ## Send your first email The smallest useful request — a single transactional email from a verified domain. See [Send an email](https://www.senddart.com/docs/api/emails-send). **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from SendDart", "html": "

Your first email 🎉

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Hello from SendDart", "html": "

Your first email 🎉

" }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Hello from SendDart", 'html' => "

Your first email 🎉

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Hello from SendDart", "html": "

Your first email 🎉

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Hello from SendDart", Html: "

Your first email 🎉

", }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Hello from SendDart", ) .with_html("

Your first email 🎉

"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Hello from SendDart") .html("

Your first email 🎉

") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Hello from SendDart", HtmlBody = "

Your first email 🎉

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from SendDart", "html": "

Your first email 🎉

" }' ``` **CLI** ```bash senddart emails send \ --from 'Acme ' \ --to 'delivered@test.senddart.com' \ --subject 'Hello from SendDart' \ --html '

Your first email 🎉

' ``` ## Send with an attachment Inline a file as base64 `content`, or hand SendDart a hosted `path` URL to fetch at send time. See [Attachments](https://www.senddart.com/docs/emails/attachments). **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Your invoice", "html": "

Invoice attached.

", "attachments": [ { "filename": "invoice.pdf", "path": "https://files.example.com/invoice.pdf" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Your invoice", "html": "

Invoice attached.

", "attachments": [ { "filename": "invoice.pdf", "path": "https://files.example.com/invoice.pdf" } ] }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Your invoice", 'html' => "

Invoice attached.

", 'attachments' => [ [ 'filename' => "invoice.pdf", 'path' => "https://files.example.com/invoice.pdf" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Your invoice", "html": "

Invoice attached.

", "attachments": [ { "filename": "invoice.pdf", "path": "https://files.example.com/invoice.pdf" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Your invoice", Html: "

Invoice attached.

", Attachments: []senddart.Attachment{ { Filename: "invoice.pdf", Path: "https://files.example.com/invoice.pdf", }, }, }) ``` **Rust** ```rust use senddart::{Attachment, SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Your invoice", ) .with_html("

Invoice attached.

") .with_attachment(Attachment::from_path( "invoice.pdf", "https://files.example.com/invoice.pdf", )); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.Attachment; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Your invoice") .html("

Invoice attached.

") .attachment(Attachment.builder() .filename("invoice.pdf") .path("https://files.example.com/invoice.pdf") .build()) .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Your invoice", HtmlBody = "

Invoice attached.

", Attachments = new List { new() { Filename = "invoice.pdf", Path = "https://files.example.com/invoice.pdf", }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Your invoice", "html": "

Invoice attached.

", "attachments": [ { "filename": "invoice.pdf", "path": "https://files.example.com/invoice.pdf" } ] }' ``` ## Schedule for later Pass an ISO 8601 `scheduled_at` to hold an email until a future time. It can be rescheduled or canceled while still pending. See [Schedule email](https://www.senddart.com/docs/emails/schedule). **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["you@yourdomain.com"], "subject": "Your weekly digest", "html": "

Here is what you missed.

", "scheduled_at": "2026-06-30T09:00:00Z" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "you@yourdomain.com" ], "subject": "Your weekly digest", "html": "

Here is what you missed.

", "scheduled_at": "2026-06-30T09:00:00Z" }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "you@yourdomain.com" ], 'subject' => "Your weekly digest", 'html' => "

Here is what you missed.

", 'scheduled_at' => "2026-06-30T09:00:00Z" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "you@yourdomain.com" ], "subject": "Your weekly digest", "html": "

Here is what you missed.

", "scheduled_at": "2026-06-30T09:00:00Z" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"you@yourdomain.com"}, Subject: "Your weekly digest", Html: "

Here is what you missed.

", ScheduledAt: "2026-06-30T09:00:00Z", }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["you@yourdomain.com"], "Your weekly digest", ) .with_html("

Here is what you missed.

") .with_scheduled_at("2026-06-30T09:00:00Z"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("you@yourdomain.com") .subject("Your weekly digest") .html("

Here is what you missed.

") .scheduledAt("2026-06-30T09:00:00Z") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "you@yourdomain.com", Subject = "Your weekly digest", HtmlBody = "

Here is what you missed.

", ScheduledAt = "2026-06-30T09:00:00Z", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["you@yourdomain.com"], "subject": "Your weekly digest", "html": "

Here is what you missed.

", "scheduled_at": "2026-06-30T09:00:00Z" }' ``` **CLI** ```bash senddart emails send \ --from 'Acme ' \ --to 'you@yourdomain.com' \ --subject 'Your weekly digest' \ --html '

Here is what you missed.

' \ --scheduled-at '2026-06-30T09:00:00Z' ``` ## Send a batch Deliver up to 100 distinct emails in one request by POSTing a JSON array to [POST /emails/batch](https://www.senddart.com/docs/api/emails-batch). Every item is validated before any email is sent. See [Batch sending](https://www.senddart.com/docs/emails/batch). **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.batch.send([ { "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hi A", "html": "

Hello A

" }, { "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hi B", "html": "

Hello B

" } ]); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Batch.send([ { "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Hi A", "html": "

Hello A

" }, { "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Hi B", "html": "

Hello B

" } ]) ``` **PHP** ```php batch->send([ [ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Hi A", 'html' => "

Hello A

" ], [ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Hi B", 'html' => "

Hello B

" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Batch.send([ { "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Hi A", "html": "

Hello A

" }, { "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Hi B", "html": "

Hello B

" } ]) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") batch, err := client.Batch.SendEmails([]*senddart.BatchEmailRequest{ { From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Hi A", Html: "

Hello A

", }, { From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Hi B", Html: "

Hello B

", }, }) ``` **Rust** ```rust use senddart::{BatchEmailOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let items = vec![ BatchEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Hi A", ) .with_html("

Hello A

"), BatchEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Hi B", ) .with_html("

Hello B

"), ]; let _batch = mb.batch.send_emails(items).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.BatchEmailRequest; import java.util.List; SendDart senddart = new SendDart("mb_xxxxxxxxx"); List requests = List.of( BatchEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Hi A") .html("

Hello A

") .build(), BatchEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Hi B") .html("

Hello B

") .build()); SendDartResponse response = senddart.batch().sendEmails(requests); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailBatchSendAsync(new List { new() { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Hi A", HtmlBody = "

Hello A

", }, new() { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Hi B", HtmlBody = "

Hello B

", }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails/batch' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '[ { "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hi A", "html": "

Hello A

" }, { "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hi B", "html": "

Hello B

" } ]' ``` **CLI** ```bash senddart emails batch \ --data '[{"from":"Acme ","to":["delivered@test.senddart.com"],"subject":"Hi A","html":"

Hello A

"},{"from":"Acme ","to":["delivered@test.senddart.com"],"subject":"Hi B","html":"

Hello B

"}]' ``` ## Retry safely with an idempotency key When a network blip leaves you unsure whether a send went through, retry with the same `Idempotency-Key` — SendDart processes it once and replays the original response. See [Idempotency keys](https://www.senddart.com/docs/emails/idempotency). ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: order-12345' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Receipt", "html": "

Thanks!

" }' ``` ## Add a contact to an audience Grow a marketing list by creating a [contact](https://www.senddart.com/docs/audiences/contacts) inside an [audience](https://www.senddart.com/docs/audiences/overview). Contacts are the recipients of [campaigns](https://www.senddart.com/docs/campaigns/managing). **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.create({ audienceId: '78261eea-8f8b-4381-83c6-79fa7120f1cf', "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" }); console.log({ data, error }); ``` **Ruby** ```ruby require 'net/http' require 'uri' uri = URI('https://www.senddart.com/api/audiences/78261eea-8f8b-4381-83c6-79fa7120f1cf/contacts') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Post.new(uri) req['Authorization'] = 'Bearer mb_xxxxxxxxx' req['Content-Type'] = 'application/json' req.body = <<~JSON { "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" } JSON res = http.request(req) puts res.body ``` **PHP** ```php contacts->create([ 'audienceId' => "78261eea-8f8b-4381-83c6-79fa7120f1cf", 'email' => "ada@example.com", 'first_name' => "Ada", 'last_name' => "Lovelace" ]); ``` **Python** ```python import requests res = requests.post( "https://www.senddart.com/api/audiences/78261eea-8f8b-4381-83c6-79fa7120f1cf/contacts", headers={"Authorization": "Bearer mb_xxxxxxxxx", "Content-Type": "application/json"}, json={ "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" }, ) print(res.json()) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") contact, err := client.Contacts.Create(&senddart.CreateContactRequest{ AudienceId: "78261eea-8f8b-4381-83c6-79fa7120f1cf", Email: "ada@example.com", FirstName: "Ada", LastName: "Lovelace", }) ``` **Rust** ```rust use senddart::{CreateContactOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateContactOptions::new("ada@example.com") .with_audience_id("78261eea-8f8b-4381-83c6-79fa7120f1cf") .with_first_name("Ada") .with_last_name("Lovelace"); let _contact = mb.contacts.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateContactRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateContactRequest request = CreateContactRequest.builder() .audienceId("78261eea-8f8b-4381-83c6-79fa7120f1cf") .email("ada@example.com") .firstName("Ada") .lastName("Lovelace") .build(); SendDartResponse response = senddart.contacts().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactCreateAsync(new ContactCreateOptions { AudienceId = "78261eea-8f8b-4381-83c6-79fa7120f1cf", Email = "ada@example.com", FirstName = "Ada", LastName = "Lovelace", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/audiences/78261eea-8f8b-4381-83c6-79fa7120f1cf/contacts' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" }' ``` ## Verify and handle a webhook Subscribe to delivery events so your app reacts to bounces, complaints, opens, and clicks as they happen. Every payload is signed — verify the signature before trusting it. See [Webhooks](https://www.senddart.com/docs/webhooks/overview). **Node.js** ```js import { createHmac, timingSafeEqual } from 'node:crypto'; // Express handler — req.body is the raw request buffer app.post('/webhooks/senddart', (req, res) => { // Signed content is "." — both from this request. const timestamp = req.header('X-SendDart-Timestamp'); const signature = req.header('X-SendDart-Signature'); const expected = createHmac('sha256', process.env.SENDDART_WEBHOOK_SECRET) .update(`${timestamp}.${req.body}`) // raw bytes, not parsed JSON .digest('hex'); const ok = timestamp && signature && timingSafeEqual( Buffer.from(signature), Buffer.from(expected), ); if (!ok) return res.status(401).end(); const event = JSON.parse(req.body.toString()); if (event.type === 'email.bounced') { // the recipient was auto-suppressed — update your own records } res.status(200).end(); }); ``` **Python** ```python import hmac, hashlib, json from flask import Flask, request, abort app = Flask(__name__) SECRET = "whsec_xxxxxxxxx".encode() @app.post("/webhooks/senddart") def handle(): timestamp = request.headers.get("X-SendDart-Timestamp", "") signature = request.headers.get("X-SendDart-Signature", "") signed = timestamp.encode() + b"." + request.get_data() expected = hmac.new(SECRET, signed, hashlib.sha256).hexdigest() if not timestamp or not hmac.compare_digest(signature, expected): abort(401) event = json.loads(request.get_data()) if event["type"] == "email.bounced": pass # recipient auto-suppressed; sync your records return "", 200 ``` > **Note:** Always compute the signature over the **raw** request body. Re-serializing parsed JSON can reorder keys or change whitespace and break verification. ## More recipes The same endpoints cover the full set of common email use-cases. Each is a plain HTTP request you can build in any language — no framework-specific package required. | Use case | How | | --- | --- | | Basic send | POST a single email to [`/emails`](https://www.senddart.com/docs/api/emails-send) with `from`, `to`, `subject`, and `html` or `text`. | | Batch send | POST a JSON array (up to 100) to [`/emails/batch`](https://www.senddart.com/docs/api/emails-batch). | | Attachments | Add an `attachments` array with base64 `content` or a hosted `path` URL — see [Attachments](https://www.senddart.com/docs/emails/attachments). | | Inline images (CID) | Reference an attachment from your HTML via `cid:` and set the attachment's `content_id` — see [Attachments](https://www.senddart.com/docs/emails/attachments). | | Templates | Send a stored template by `template_id` (or nested `template: { id | alias }`) with `variables` instead of inline `html` — see [Templates](https://www.senddart.com/docs/templates/overview). | | Scheduling | Pass an ISO 8601 or natural-language `scheduled_at` to hold the email for later delivery — see [Schedule email](https://www.senddart.com/docs/emails/schedule). | | Idempotency | Send an `Idempotency-Key` header to deduplicate retries — see [Idempotency keys](https://www.senddart.com/docs/emails/idempotency). | | Contact form | Take form input on your backend and POST one (or a batch of) email(s) to SendDart. | | Audiences & contacts | Create and manage list members under [`/audiences`](https://www.senddart.com/docs/audiences/overview) and their [contacts](https://www.senddart.com/docs/audiences/contacts). | | Domains | Create and verify sending domains via [`/domains`](https://www.senddart.com/docs/domains/managing). | | Double opt-in | On signup, send a confirmation email with a tokenized link; only add the [contact](https://www.senddart.com/docs/audiences/contacts) once they click it. | | Webhooks | Subscribe to delivery events and verify each signed payload — see [Webhooks](https://www.senddart.com/docs/webhooks/overview). | | Prevent threading (Gmail) | Vary the `subject` or set custom `headers` (e.g. a unique `X-Entity-Ref-ID`) so Gmail doesn't collapse messages into one thread. | ## Where to go next - Browse the full [Send an email](https://www.senddart.com/docs/api/emails-send) reference for every body field (`cc`, `bcc`, `reply_to`, `headers`). - Set up a sending domain and DNS in [Domains](https://www.senddart.com/docs/domains/managing). - Send marketing email to a list with [Campaigns](https://www.senddart.com/docs/campaigns/managing). - See what is and isn't available yet in the [roadmap](https://www.senddart.com/docs/resources/sdks). --- # SDKs > Official SDKs for Node.js, Python, Go, Ruby, PHP, Rust, Java, and .NET — plus a CLI, and a clean REST API for everything else. SendDart ships **official SDKs for eight languages** — Node.js ([`senddart`](https://www.npmjs.com/package/senddart) on npm), Python, Go, Ruby, PHP, Rust, Java, and .NET — plus a [CLI](https://www.senddart.com/docs/resources/cli). Each wraps the same REST API with the idioms of its ecosystem. Underneath them all is a **clean REST API**: predictable request and response shapes, `mb_`-prefixed API keys, the `Bearer` auth scheme, a consistent error envelope, and standard pagination conventions. So every language has two good options: install the official SDK, or hit the JSON API directly with any HTTP client. ## Official Node.js SDK Install the `senddart` package and instantiate the client with your `mb_` API key. Every method returns `{ data, error }` — `error` is `null` on success, or `{ statusCode, name, message }` on failure, so there are no exceptions to catch for API errors. ```bash npm install senddart ``` **Send an email** ```ts import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello from SendDart', html: '

Your first email 🎉

', }); if (error) console.error(error.name, error.message); else console.log('sent', data.id); ``` The client exposes one property per resource — `emails` (with nested `emails.receiving`), `batch`, `domains`, `audiences`, `contacts`, `contactProperties`, `campaigns`, `segments`, `topics`, `templates`, `automations`, `webhooks`, `logs`, `events`, `apiKeys`, and `polls` — each modeled on the same `create` / `get` / `list` / `update` shape used throughout these docs. **Override the API host** ```ts const mb = new SendDart('mb_xxxxxxxxx', { baseUrl: 'https://www.senddart.com/api', // optional — defaults to the SendDart host }); ``` > **Note:** The same client ships for Python (`pip install senddart`), Ruby (`gem install senddart`), PHP (`composer require senddart/senddart`), Rust (`cargo add senddart`), .NET (`dotnet add package SendDart`), Go, and Java — see [SDKs & CLI](https://www.senddart.com/sdks) for every package manager command. ## Call the REST API directly Every endpoint in these docs is plain JSON over HTTPS at `https://www.senddart.com/api`. Authenticate with an `Authorization: Bearer mb_xxxxxxxxx` header. Each API page shows ready-to-run snippets for every official SDK plus raw **cURL**. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from SendDart", "html": "

It works!

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Hello from SendDart", "html": "

It works!

" }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Hello from SendDart", 'html' => "

It works!

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Hello from SendDart", "html": "

It works!

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Hello from SendDart", Html: "

It works!

", }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Hello from SendDart", ) .with_html("

It works!

"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Hello from SendDart") .html("

It works!

") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Hello from SendDart", HtmlBody = "

It works!

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from SendDart", "html": "

It works!

" }' ``` **CLI** ```bash senddart emails send \ --from 'Acme ' \ --to 'delivered@test.senddart.com' \ --subject 'Hello from SendDart' \ --html '

It works!

' ``` > **Note:** Official SDKs ship for Go, Ruby, PHP, Python, Rust, Java, and .NET. The Java artifact is a zero-dependency JVM jar, so Kotlin and Scala projects add the same `com.senddart:senddart` coordinate. Android is the exception: the default transport uses `java.net.http` (Java 11+), which Android does not ship, so an Android app must supply its own `HttpTransport` implementation. Any other language with an HTTP client (Elixir, …) can call the API directly. ## Any HTTP client works Prefer no dependency? The API is plain JSON over HTTPS, so the standard HTTP client in any language can call it directly. Point your client at `https://www.senddart.com/api` with your `mb_` key and send a request: - **Node.js** — the official `senddart` SDK, or the built-in `fetch`. - **PHP** — the official `senddart/senddart` package, or Guzzle / the cURL extension. - **Python** — the official `senddart` package, or `requests` / `httpx`. - **Ruby** — the official `senddart` gem, or `Net::HTTP` / `Faraday`. - **Go** — the official Go module, or `net/http`. - **Java** — the official `com.senddart:senddart` artifact, or `java.net.http.HttpClient`. - **Rust** — the official `senddart` crate, or `reqwest`. - **.NET** — the official `SendDart` NuGet package, or `HttpClient`. Each API reference page includes ready-to-run snippets for every official SDK — Node.js, Ruby, PHP, Python, Go, Rust, Java, .NET, the CLI — plus raw cURL, so your stack's tab is one click away. ## Which should I use? | You have… | Use | | --- | --- | | A Node.js / TypeScript project | Install the official `senddart` SDK. | | A Python, Go, Ruby, PHP, Rust, Java, or .NET project | Install the official SDK for that language — see [SDKs & CLI](https://www.senddart.com/sdks). | | Anything else with an HTTP client | Call the REST API directly. | | A framework that only speaks SMTP | Use an HTTPS-capable adapter. Raw SMTP is not currently deployed. | --- # CLI Quickstart > Install the official senddart CLI and send your first email from the terminal in three commands. SendDart ships an official command-line tool. `senddart-cli` (**1.0.0** on npm) installs a **`senddart`** command that covers the whole API — sends, domains, contacts, segments, topics, campaigns, templates, automations, webhooks, events, logs and polls. It wraps the official [`senddart` Node.js SDK](https://www.senddart.com/docs/resources/sdks), so a CLI call and an SDK call hit exactly the same endpoints. Every command prints the API response as JSON on stdout, which makes the CLI both the quickest way to try an endpoint by hand and a safe building block in scripts and CI. ## Prerequisites - **Node.js 18 or newer** — `senddart-cli` declares `engines.node: ">=18"`. - A SendDart [API key](https://www.senddart.com/docs/create-an-api-key) — the `mb_`-prefixed secret you create in the dashboard. - A [verified domain](https://www.senddart.com/docs/domains/managing) to send from. ## 1. Install the CLI **Install globally** ```bash npm install -g senddart-cli # the package is senddart-cli; the command it installs is senddart senddart --version # 1.0.0 ``` Rather not install anything? Run it straight from npm — name both the package and the binary, because they differ: ```bash npx --package senddart-cli@1.0.0 senddart --version ``` `--help` works at every level: `senddart --help` lists the resource groups, `senddart emails --help` lists that group's subcommands, and `senddart emails send --help` lists every flag. ## 2. Authenticate There is no `login` step. Every invocation that talks to the API resolves your key from the `SENDDART_API_KEY` environment variable, or from `--api-key` on that command; with neither, the CLI exits `1` with a `cli_error`. The one exception is `senddart webhooks verify`, which checks a signature locally, makes no request, and therefore takes no key — passing `--api-key` to it fails with an unknown-option error. Export your key once so it stays out of your shell history, then prove it works: ```bash export SENDDART_API_KEY=mb_xxxxxxxxx # any command exercises the key — this one lists your sending domains senddart domains list ``` Pass `--base-url` (or set `SENDDART_BASE_URL`) to point the CLI at a different API host. > **Warning:** Never paste a live key into a command you will commit or share — keep it in an environment variable or your CI secret store. Key lifecycle is dashboard-only (`senddart api-keys list` is the CLI's entire key surface), so a leaked key cannot mint, widen, or revoke another. See [API keys](https://www.senddart.com/docs/api-keys/overview). ## 3. Send your first email Send from your verified domain to `delivered@test.senddart.com`, the [mailbox simulator](https://www.senddart.com/docs/kb/test-addresses): it is intercepted before the provider is contacted and synthesizes a delivery, so nothing reaches a real inbox. `--to`, `--cc`, `--bcc` and `--reply-to` are repeatable and also accept comma-separated values. **senddart emails send** ```bash senddart emails send \ --from 'Acme ' \ --to delivered@test.senddart.com \ --subject 'Hello from the CLI' \ --html '

Your first email 🎉

' ``` A successful send prints the new email id — the same body [POST /emails](https://www.senddart.com/docs/api/emails-send) returns: ```json { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` > **Warning:** Use the simulator, not a documentation domain: `example.com`, `example.net`, `example.org` and anything under `.test`, `.invalid`, `.localhost` or `.example` are blocked outright and answer `422`. Simulator sends still debit your quota per recipient, exactly like a real send. ## 4. See what happened Read the email back by id for its current status and ordered event log, or list your recent sends: ```bash senddart emails get 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 senddart emails list --limit 5 senddart emails list --status delivered --search invoice senddart emails list --folder sent --limit 5 ``` **emails get (trimmed)** ```json { "object": "email", "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from the CLI", "status": "delivered", "last_event": "delivered", "events": [ { "type": "sent", "created_at": "2026-06-23T10:00:00.000Z" }, { "type": "delivered", "created_at": "2026-06-23T10:00:04.512Z" } ] } ``` ## Output and exit codes Responses are pretty-printed JSON by default; `--json` switches to compact JSON for piping into `jq`. stdout stays JSON-only either way — a failure prints its error object to **stderr** and exits `1`, so `senddart … | jq` never has to strip a diagnostic. ```bash id=$(senddart emails send --json \ --from 'Acme ' \ --to delivered@test.senddart.com \ --subject 'Hello from the CLI' \ --text 'It works!' | jq -r '.id') || exit 1 ``` The error object is always `{ statusCode, name, message }`. Branch on `name`, never on `message`: | Where it came from | `statusCode` | `name` | | --- | --- | --- | | The API rejected the request | the HTTP status | the API's reason, e.g. `validation_error`, `daily_quota_exceeded` | | The request never reached the API | `0` | `network_error` | | The CLI rejected your flags before sending | `null` | `cli_error` | > **Note:** See the [error reference](https://www.senddart.com/docs/api/errors) for every name the API can return. ## Beyond the first send A few flags on `emails send` worth knowing early: - `--text` alongside (or instead of) `--html`, plus `--preview-text` for the inbox preheader. - `--template-id` or `--template-alias` with `--variables '{"first_name":"Ada"}'` to send a stored [template](https://www.senddart.com/docs/templates/overview). - `--attachment ./invoice.pdf` (read and base64-encoded locally) or `--attachment-url` (fetched server-side) — both repeatable, capped at 25 MB per file and 40 MB per message. See [Attachments](https://www.senddart.com/docs/emails/attachments). - `--idempotency-key order-12345` on `emails send` and `emails batch` so a retry cannot send twice. See [Idempotency keys](https://www.senddart.com/docs/emails/idempotency). - `senddart emails batch --file ./batch.json` to send up to 100 emails in one request. See [Batch sending](https://www.senddart.com/docs/emails/batch). Scheduling uses `--scheduled-at` — an ISO 8601 timestamp or a phrase like `in 1 min`, up to 30 days ahead. A scheduled message skips the mailbox simulator, so schedule to a real address you control instead: ```bash senddart emails send \ --from 'Acme ' \ --to you@yourdomain.com \ --subject 'Your weekly digest' \ --html '

Here is what you missed.

' \ --scheduled-at 2026-09-01T09:00:00Z # reschedule or cancel while it is still pending senddart emails update 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 --scheduled-at 'in 2 hours' senddart emails cancel 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 ``` > **Warning:** Do not pair `delivered@test.senddart.com` with `--scheduled-at`: the simulator only fires on an immediate send, so a scheduled message to it is treated as suppressed and rejected with `422`. See [Schedule emails](https://www.senddart.com/docs/emails/schedule). ## Next steps - The full command surface, plus the equivalent `curl` cookbook: [CLI](https://www.senddart.com/docs/resources/cli). - Non-interactive patterns for agents and CI — stdin piping, batches, safe retries, webhook feedback loops: [CLI for AI agents](https://www.senddart.com/docs/resources/cli-agents). - A typed client instead of a shell: the official [SDKs](https://www.senddart.com/docs/resources/sdks) for Node.js, Python, Go, Ruby, PHP, Rust, Java and .NET. - Every endpoint and field: the [API reference](https://www.senddart.com/docs/api/emails-send). --- # CLI for AI agents > Use SendDart from AI agent workflows and CI/CD pipelines — non-interactive sends, stdin piping, batch, idempotent retries, scheduling, and webhook feedback loops, all over plain HTTP. SendDart is well suited to AI agent workflows and CI/CD pipelines: it is a plain JSON REST API with no interactive login, so an agent can drive it with `curl` (and `jq`) the moment it has an `mb_` key in its environment. This page covers the agent-specific patterns. See the [CLI](https://www.senddart.com/docs/resources/cli) reference for the full command surface and the [CLI Quickstart](https://www.senddart.com/docs/resources/cli-quickstart) to send your first email. If your agent prefers a typed client, the official `senddart` Node SDK wraps the same endpoints — see [SDKs](https://www.senddart.com/docs/resources/sdks). ## Non-interactive by default There is nothing to switch on. Every SendDart request is a single HTTP call that returns machine-readable JSON to stdout, with no progress indicators and no prompts. Capture the HTTP status to drive exit codes so a failed call fails the agent’s step: ```bash status=$(curl -s -o /tmp/out.json -w '%{http_code}' -X POST 'https://www.senddart.com/api/emails' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Welcome", "text": "Welcome aboard." }') if [ "$status" -ge 400 ]; then jq -r '.message' /tmp/out.json >&2 # structured error: { "name", "message" } exit 1 fi jq -r '.id' /tmp/out.json ``` Errors always come back as the same structured envelope — `statusCode`, `name`, and `message` — alongside a non-2xx status. Branch on `name`, never on `message`. See the [error reference](https://www.senddart.com/docs/api/errors). An example auth failure: ```json { "statusCode": 401, "name": "missing_api_key", "message": "Missing API key. Pass it as `Authorization: Bearer mb_...`." } ``` ## Piping content from stdin Agents generate content on the fly. Build the request body with `jq` and pipe it straight into `curl` with `-d @-` instead of writing temp files — `--rawfile`/`--arg` keep the generated text safely JSON-escaped: ```bash echo "Your order has shipped." | jq -Rs '{ from: "Acme ", to: ["delivered@test.senddart.com"], subject: "Order update", text: . }' | curl -s -X POST 'https://www.senddart.com/api/emails' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d @- ``` The same `jq -n --rawfile html ./body.html` pattern injects an HTML body from a file — see the [CLI](https://www.senddart.com/docs/resources/cli) reference. ## Batch sending Send up to 100 emails in a single request by POSTing a JSON array to [POST /emails/batch](https://www.senddart.com/docs/api/emails-batch). Read the array straight from a file the agent wrote with `-d @-`: ```bash cat emails.json | curl -s -X POST 'https://www.senddart.com/api/emails/batch' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d @- \ | jq '.data' ``` ## Safe retries Add an `Idempotency-Key` header to prevent duplicates when an agent retries a failed request. Reusing the same key returns the original result instead of sending twice. The header works on both `/emails` and `/emails/batch`. ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: welcome-user-123' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Welcome", "text": "Hello!" }' ``` ## Scheduling The `scheduled_at` field accepts an ISO 8601 timestamp or natural language like `"tomorrow at 9am"` or `"in 2 hours"` (relative to UTC) — see [Schedule emails](https://www.senddart.com/docs/emails/schedule). ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["you@yourdomain.com"], "subject": "Your trial ends soon", "text": "Your free trial expires in 3 days.", "scheduled_at": "tomorrow at 9am" }' ``` Cancel or reschedule a queued email with [POST /emails/:id/cancel](https://www.senddart.com/docs/api/emails-cancel) and [PATCH /emails/:id](https://www.senddart.com/docs/api/emails-update): ```bash # Reschedule curl -X PATCH 'https://www.senddart.com/api/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "scheduled_at": "in 2 hours" }' # Cancel curl -X POST 'https://www.senddart.com/api/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794/cancel' \ -H "Authorization: Bearer $SENDDART_API_KEY" ``` ## Closing the loop with webhooks When an agent sends an email, it usually needs to know what happened next — delivered, bounced, opened, or replied to. Register a [webhook](https://www.senddart.com/docs/webhooks/overview) pointing at a public URL (use a tunnel such as Tailscale Funnel, ngrok, or localtunnel during development) so SendDart streams [signed events](https://www.senddart.com/docs/webhooks/verify) to your handler as they occur. ```bash curl -X POST 'https://www.senddart.com/api/webhooks' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "endpoint": "https://hostname.tailnet-name.ts.net/api/webhook", "events": ["email.delivered", "email.bounced", "email.received"] }' ``` > **Note:** Always verify the webhook signature before trusting a payload — the signing secret is returned when you create the webhook. See [Verify webhooks](https://www.senddart.com/docs/webhooks/verify). --- # CLI > Drive SendDart from the terminal — the official `senddart-cli`, or plain curl. SendDart ships an official command-line tool: `npm install -g senddart-cli` (Node.js 18+) gives you a `senddart` command covering sends, domains, contacts, campaigns, and more — every API reference page includes its CLI invocation in the snippet tabs. To install it and send your first email, start with the [CLI Quickstart](https://www.senddart.com/docs/resources/cli-quickstart); the **Command surface** table below lists every group and subcommand. Prefer zero install? Because the API is a plain JSON REST API, the terminal you already have — `curl` plus `jq` — covers the full surface too, and it works the same in scripts, CI/CD pipelines, and one-off debugging sessions. The rest of this page is the curl cookbook. ## Authentication Keep your API key out of your shell history by exporting it once, then reference it in every request. The key is the same `mb_`-prefixed key you use everywhere else. ```bash export SENDDART_API_KEY=mb_xxxxxxxxx # Reuse it in any request curl 'https://www.senddart.com/api/domains' \ -H "Authorization: Bearer $SENDDART_API_KEY" ``` > **Warning:** Never paste a live key directly into a command you'll commit or share. Use an environment variable (or your CI secret store) so the key never lands in shell history or version control. ## Send an email The terminal equivalent of [POST /emails](https://www.senddart.com/docs/api/emails-send) — provide the body inline, or read it from a file. ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello World", "text": "It works!" }' ``` Send an HTML body straight from a file with `@`-syntax — handy for templates you maintain on disk: ```bash # Build the JSON with the file's HTML inlined, then send it jq -n --rawfile html ./welcome.html '{ from: "Acme ", to: ["delivered@test.senddart.com"], subject: "Hello World", html: $html }' | curl -X POST 'https://www.senddart.com/api/emails' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d @- ``` ## Pipe JSON through jq Every endpoint returns JSON, so `jq` lets you extract exactly the field you need — the email `id`, a list of domains, an event log. ```bash # Capture just the new email id curl -s -X POST 'https://www.senddart.com/api/emails' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hi", "text": "Hello" }' \ | jq -r '.id' # List sendable domains by name — a domain can send while its status is any # of verified, partially_verified or partially_failed curl -s 'https://www.senddart.com/api/domains' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ | jq -r '.data[] | select(.status | test("^(verified|partially_verified|partially_failed)$")) | .name' ``` ## Send a batch from a file Keep an array of email objects in a JSON file and POST it to [POST /emails/batch](https://www.senddart.com/docs/api/emails-batch). Use `@filename` to send the file as the request body. ```bash curl -X POST 'https://www.senddart.com/api/emails/batch' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d @emails.json \ | jq '.data' ``` ## Use in CI/CD Store your key as a CI secret and read it from the environment — no interactive login step is needed. For example, sending a deploy notification from GitHub Actions: ```yaml # GitHub Actions env: SENDDART_API_KEY: ${{ secrets.SENDDART_API_KEY }} steps: - run: | curl -X POST 'https://www.senddart.com/api/emails' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Deploy complete", "text": "Version ${{ github.sha }} deployed." }' ``` ## Handle errors in scripts SendDart returns a structured error envelope with a `name` and `message`, and a non-2xx HTTP status. Capture the status code so a failed send fails your script: ```bash status=$(curl -s -o /tmp/out.json -w '%{http_code}' -X POST 'https://www.senddart.com/api/emails' \ -H "Authorization: Bearer $SENDDART_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hi" }') if [ "$status" -ge 400 ]; then echo "Send failed:" >&2 jq -r '.message' /tmp/out.json >&2 exit 1 fi ``` > **Note:** See the [error reference](https://www.senddart.com/docs/api/errors) for the full envelope and every error name SendDart can return. ## Command surface The official CLI mirrors the API one command group per resource — `senddart `. The table below lists every group, its subcommands, and the docs for what it drives. Run `senddart --help` for the flags of any one of them, and see the [CLI Quickstart](https://www.senddart.com/docs/resources/cli-quickstart) to install it and send your first email. | Command group | Subcommands | Docs | | --- | --- | --- | | `senddart emails` | `send`, `batch`, `get`, `list`, `update`, `cancel`, `sources`, `attachments`, `attachment` | [`/emails`](https://www.senddart.com/docs/api/emails-send), [`/emails/batch`](https://www.senddart.com/docs/api/emails-batch) | | `senddart emails receiving` | `list`, `addresses`, `get`, `attachments`, `attachment`, `raw`, `forward`, `reply`, `delete` | [Receiving](https://www.senddart.com/docs/receiving/introduction) | | `senddart domains` | `add`, `get`, `list`, `verify`, `update`, `mx-check`, `records-csv`, `delete`, plus `dns` (`detect`, `cloudflare`, `godaddy`, `namecheap`) and `claim` (`start`, `get`, `verify`) | [Domains](https://www.senddart.com/docs/domains/managing) | | `senddart contacts` | `create`, `list`, `get`, `update`, `delete`, `add-to-segment`, `remove-from-segment`, `segments`, `topics`, `set-topics`, `batch`, `import`, `import-upload` | [Contacts](https://www.senddart.com/docs/audiences/contacts) | | `senddart contact-properties` | `create`, `list`, `get`, `update`, `delete` | [Contact properties](https://www.senddart.com/docs/audiences/properties) | | `senddart audiences` | `create`, `list`, `get`, `update`, `delete`, `import-sheet` | [Audiences](https://www.senddart.com/docs/audiences/overview) | | `senddart segments` | `create`, `list`, `get`, `contacts`, `update`, `delete` | [Segments](https://www.senddart.com/docs/segments/overview) | | `senddart topics` | `create`, `list`, `get`, `update`, `delete` | [Topics](https://www.senddart.com/docs/topics/overview) | | `senddart campaigns` | `create`, `send`, `get`, `list`, `update`, `cancel`, `stats`, `engagement`, `ab`, `delete` | [Campaigns](https://www.senddart.com/docs/campaigns/managing) | | `senddart templates` | `create`, `get`, `list`, `update`, `duplicate`, `publish`, `delete` | [Templates](https://www.senddart.com/docs/templates/overview) | | `senddart automations` | `create`, `get`, `list`, `update`, `add-step`, `update-step`, `delete-step`, `runs`, `run`, `stop`, `ai`, `delete` | [Automations](https://www.senddart.com/docs/automations/overview) | | `senddart webhooks` | `create`, `get`, `list`, `update`, `rotate`, `test`, `delete`, `verify` | [Webhooks](https://www.senddart.com/docs/webhooks/overview) | | `senddart events` | `send`, `create`, `list`, `update`, `delete` | [Custom events](https://www.senddart.com/docs/automations/custom-events) | | `senddart logs` | `list`, `get` | [Logs](https://www.senddart.com/docs/logs/overview) | | `senddart polls` | `list`, `get` | [`/polls`](https://www.senddart.com/docs/api/polls-list) | | `senddart api-keys` | `list` only — creating, re-scoping and revoking keys are **dashboard-only** and answer `403 dashboard_only` to any API-key caller | [API keys](https://www.senddart.com/docs/api-keys/overview) | > **Note:** Authentication is the same for every command that reaches the API: a `mb_`-prefixed key, supplied via `SENDDART_API_KEY`, `--api-key`, or a CI secret. `webhooks verify` is the exception — it verifies a signature locally, sends nothing, needs no key, and does not accept `--api-key`. Output is JSON, so `jq` works the same across every command and every endpoint. For the full HTTP surface, see the [API reference](https://www.senddart.com/docs/api/emails-send). --- # Security > An overview of how SendDart protects your data and your account — encryption, access controls, key management, and responsible disclosure. Email is sensitive: recipient lists, message bodies, and API keys all flow through SendDart. This page summarizes the controls in place to keep that data safe, and the principles they're built on. ## Foundational principles SendDart's security controls follow a small set of guiding principles, applied consistently across the platform: - **Least privilege** — access is limited to those with a legitimate need. This applies to staff access and to your own API keys, which can be scoped to sending-only. - **Defense in depth** — controls are layered, so a single failure never exposes data on its own. - **Consistency** — the same controls apply across every part of the system rather than only the obvious entry points. - **Continuous improvement** — controls are revisited and tightened over time, reducing friction without weakening protection. ## Data protection | Area | Control | | --- | --- | | Data at rest | All datastores are encrypted at rest. Sensitive fields — including API key material — receive additional row-level encryption. | | Data in transit | TLS 1.2 or higher is required for every connection to the API. Outbound mail is delivered over TLS to receiving servers wherever they support it; you can require it per-domain via [opportunistic vs. enforced TLS](https://www.senddart.com/docs/domains/managing). | | Data backup | Production data is backed up with a point-in-time approach and retained so the platform can recover from operational failures. | > **Note:** Your API requests must use HTTPS. A request over plain HTTP is refused before any credentials are read. ## Product security ### Penetration testing SendDart engages third-party firms to conduct penetration testing on a recurring basis. The product and its cloud infrastructure are in scope for these assessments, and testers are given the access they need to maximize coverage. ### Vulnerability scanning Multiple techniques — code-level scanning, dependency scanning, and security reviews — are used to find and remediate vulnerabilities. Findings are prioritized by severity and risk, and remediated against a defined timeline: | Severity | Remediation target | | --- | --- | | Critical | 15 days | | High | 30 days | | Medium | 90 days | | Low | 180 days | | Informational | As needed | ## Operational & enterprise security - **Endpoint protection** — company devices run anti-malware protection with monitored security alerts, and a managed-device configuration enforces disk encryption, screen locks, and timely software updates. - **Identity & access management** — staff access is granted by role and deprovisioned when it is no longer needed; multi-factor authentication is required to reach internal applications. - **Security education** — personnel receive security training on onboarding and on an ongoing basis, including briefings on issues that need attention. ## API keys API keys are the primary credential for the platform. SendDart is built to keep them safe and to limit the blast radius if one leaks: - Keys are shown **once** at creation. SendDart stores only a hash, so a key can never be retrieved again — rotate by creating a new one and deleting the old. - Keys can be scoped to **full access** or **sending-only**, so a key embedded in an app that only sends mail cannot read your domains, contacts, or logs. See [API keys](https://www.senddart.com/docs/api-keys/overview). - Key lifecycle is **dashboard-only**: creating a key, changing its permission or domain restriction, and revoking it all require a signed-in session. No API key can mint, re-scope, or revoke a key — the attempt returns `403 dashboard_only` — so a compromised key cannot escalate its own privileges or lock you out by revoking the others. - A leaked or unused key should be revoked immediately on the **API Keys** page — revocation takes effect right away. - Treat keys like passwords: keep them in a secret manager or environment variable, never in source control, client-side code, or shell history. ## Sending authentication Strong sender authentication protects both your recipients and your domain reputation. SendDart requires you to verify a domain before sending from it, which means publishing DNS records for: - **SPF** — authorizes SendDart's infrastructure to send on your domain's behalf. - **DKIM** — cryptographically signs each message so receivers can confirm it wasn't altered in transit and genuinely came from you. - **DMARC** (recommended) — tells receivers how to treat mail that fails SPF/DKIM, and gives you reporting. See [Domains](https://www.senddart.com/docs/domains/managing) for the exact records and the verification flow. ## Webhook security Every webhook delivery is signed so your endpoint can prove a payload genuinely came from SendDart and wasn't tampered with. Verify the signature over the **raw** request body before acting on any event, and reject anything that doesn't match. See [Webhooks](https://www.senddart.com/docs/webhooks/overview) and the verification recipe under [Examples](https://www.senddart.com/docs/resources/examples). ## Recipient protection Several controls exist specifically to protect recipients and your sender reputation, and they are enforced on every send path: - An account-wide [suppression list](https://www.senddart.com/docs/emails/suppressions) skips addresses that bounced, complained, or unsubscribed. - Permanent (hard) bounces and spam complaints **auto-suppress** the recipient — see [Email bounces](https://www.senddart.com/docs/emails/bounces). - Campaigns inject an RFC 8058 one-click unsubscribe automatically — see [Unsubscribe links](https://www.senddart.com/docs/emails/unsubscribe). - Attachment `path` URLs are fetched through an **SSRF-guarded** client, and custom header values are sanitized to prevent header injection. ## Reporting a vulnerability If you discover a security issue, please report it responsibly rather than disclosing it publicly. Email the details — steps to reproduce, affected endpoints, and any proof of concept — to **security@senddart.com**, and allow time for a fix before going public. We do not pursue legal action against good-faith research that respects user privacy and avoids data destruction. > **Warning:** Never include real recipient data, live API keys, or other people's personal information in a vulnerability report. Redact or use test data. --- # Integrations > Connect SendDart to the tools you already use — AI builders, no-code automation, notification platforms, CMSs, and developer tools — over its clean REST API. SendDart speaks a **clean REST API**, so any tool that lets you configure an email provider over HTTP can talk to it. Anywhere a tool lets you set the API base URL, point it at `https://www.senddart.com/api` and supply your SendDart `mb_` key; where a tool only asks for an API key, use a SendDart key and (if available) its custom-host setting. The categories below mirror the kinds of integrations developers reach for most. Each works through the same endpoints documented in these docs — there is no SendDart-specific protocol to learn. ## AI app builders AI and agent platforms can send email through SendDart the moment you give them an API key — useful for letting an assistant or a generated app fire off transactional mail. - **AI app builders** (Lovable, Base44, Leap.new, Rocket, Anything) — add email to apps they generate by configuring SendDart as the email provider. - **Agent toolkits** (Wildcard, mcp.run, Pica, camelAI) — let an agent send natural-language emails or wire SendDart into a tool-use / MCP workflow. - **Intent & enrichment** (Parsley) — push buyer-intent signals into your audiences and segments to drive targeted campaigns. ## No-code & automation Workflow and automation platforms can call the SendDart API as a step, so non-developers can trigger emails from forms, spreadsheets, CRMs, and events. - **Workflow builders** (n8n, Zapier, Make.com, Pipedream, Activepieces, Lindy, BuildShip, viaSocket, Monkedo, Email Element) — add a "send email" step backed by SendDart via an HTTP / API-key connection. - **Data sync & routing** (Stacksync, ApiX-Drive) — keep contacts and audiences in sync, or use SendDart as a destination, between your other systems. - **Billing & quoting** (Bunny) — quote and bill customers and send the resulting email through SendDart. - **WordPress** — call the SendDart API from an HTTPS-capable mail plugin or integration. ## Notification platforms Multi-channel notification engines can use SendDart as their email delivery provider, so SendDart handles the email channel while they orchestrate routing, templating, and preferences. - Courier, Novu, Knock, Engagespot, Dittofeed, and Suprsend — configure the SendDart API as the email provider for their email channel. ## Content management systems CMS platforms that send transactional mail (account, comment, and form notifications) can be configured to deliver through SendDart. - Payload CMS and Strapi CMS — set SendDart as the email adapter / provider in their email configuration. ## Developer tools A wide range of developer infrastructure can lean on SendDart for email — background-job runners, observability and billing tools, e-commerce backends, auth providers, and status pages. - **Background jobs & events** (Inngest, Trigger.dev, Upstash, Convex, Fastgen) — send drip campaigns and event-driven email from durable workflows. - **Backends & platforms** (Encore, Medusa, Coolify, Courrier) — send transactional and e-commerce email from your app or self-hosted stack. - **Auth & identity** (Auth0, Kinde, Infisical) — deliver auth, billing, and verification emails through the SendDart API. - **Billing, analytics & ops** (OpenMeter, Invopop, Tinybird, Pulsetic, brin) — send usage/invoice email, analyze email data, or scan inbound mail. - **Desktop & tooling** (Raycast) — manage emails, domains, and more from a launcher extension pointed at SendDart. > **Note:** Integrations that exercise capabilities SendDart has not yet shipped will surface an error from the API. See the [roadmap](https://www.senddart.com/docs/resources/sdks) for what is currently supported. ## Build your own integration Adding SendDart to your own product is just calling the API: 1. **Read the send reference** — Start with [Send an email](https://www.senddart.com/docs/api/emails-send) and the [Examples](https://www.senddart.com/docs/resources/examples) recipes to learn the request shape. 2. **Authenticate** — Use a scoped SendDart API key — sending-only is enough if you only send mail. See [API keys](https://www.senddart.com/docs/api-keys/overview). 3. **Wire it into your product** — Call the endpoints over HTTPS from your backend, and subscribe to [webhooks](https://www.senddart.com/docs/webhooks/overview) to react to delivery events. You can build with the official `senddart` Node SDK or drive the API straight from the terminal — see [SDKs](https://www.senddart.com/docs/resources/sdks) and the [CLI](https://www.senddart.com/docs/resources/cli) guide. --- # API Reference > The SendDart REST API: base URL, authentication, content type, idempotency, rate limits, and error format. The SendDart API is organized around REST. It has predictable, resource-oriented URLs, accepts JSON request bodies, returns JSON responses, and uses standard HTTP response codes and verbs. ## Base URL ```bash https://www.senddart.com/api ``` All requests are made over HTTPS. The resources are mounted at the root: `/emails`, `/domains`, `/audiences`, `/campaigns`, `/api-keys`. ## Authentication Authenticate with your API key as a Bearer token on every request. See [Authentication](https://www.senddart.com/docs/authentication). ```bash Authorization: Bearer mb_xxxxxxxxx ``` ## Official SDKs Most endpoints in this reference show examples for the Node.js, Python, Ruby and PHP packages alongside raw cURL, plus a CLI tab wherever the CLI ships that command. The Go, Rust, Java and .NET tabs show the SDK for the core operations. Where an endpoint has no SDK mapping for a language, that tab falls back to an equivalent plain-HTTP request in the same language, so every sample is runnable as printed. Pick your language from the tabs on any request sample. | Language | Package | Install | | --- | --- | --- | | Node.js | `senddart` | `npm install senddart` | | Ruby | `senddart` | `gem install senddart` | | PHP | `senddart/senddart` | `composer require senddart/senddart` | | Python | `senddart` | `pip install senddart` | | Go | `github.com/shekhu10/senddart-sdks/senddart-go` (package `senddart`) | `go get github.com/shekhu10/senddart-sdks/senddart-go` | | Rust | `senddart` | `cargo add senddart` | | Java | `com.senddart:senddart` | `implementation 'com.senddart:senddart:1.0.0'` | | .NET | `SendDart` | `dotnet add package SendDart` | | CLI | `senddart-cli` | `npm install -g senddart-cli` | ## Content type Send request bodies as JSON with `Content-Type: application/json`. Responses are always JSON. ## User-Agent All API requests must include a `User-Agent` header. Requests without it are rejected with a `403` status code. If you are making direct HTTP requests, set it explicitly: ```bash User-Agent: my-app/1.0 ``` > **Note:** If you get a `403` despite a valid API key, a missing `User-Agent` header is the likely cause. ## Response codes SendDart uses standard HTTP codes: `2xx` for success, `4xx` for user-related failures, and `5xx` for infrastructure issues. | Status | Description | | --- | --- | | `200` | Successful request. | | `400` | Check that the parameters were correct. | | `401` | The API key used was missing. | | `402` | A plan limit was reached (for example the domain cap). Upgrade to continue. | | `403` | The API key used was invalid. | | `404` | The resource was not found. | | `429` | The rate limit or an account quota was exceeded. | | `5xx` | Indicates an error with SendDart servers. | ## Versioning There is currently no versioning system in place. Versioning via calendar-based headers is planned for the future. ## Pagination Some list endpoints support cursor-based pagination to browse large datasets efficiently. ## Idempotency `POST /emails` and `POST /emails/batch` accept an optional `Idempotency-Key` header so a retried send is not processed twice. Other mutating endpoints ignore the header — a retry there creates a second resource. See [Idempotency keys](https://www.senddart.com/docs/emails/idempotency). ```bash Idempotency-Key: ``` ## Rate limits The **send endpoints** (`POST /emails` and the transactional send API) are rate-limited per client IP to blunt bursts. When you exceed the send rate the response is a `429 rate_limit_exceeded` — read the `ratelimit-*` and `retry-after` headers and back off accordingly. Other endpoints are not subject to this per-request cap; sustained volume is governed by your account **quotas** instead (see [Usage limits](https://www.senddart.com/docs/api/limits)). ## Errors Errors use standard HTTP status codes and a consistent JSON body. See the full [error reference](https://www.senddart.com/docs/api/errors). ```json { "statusCode": 422, "name": "validation_error", "message": "`to` must contain between 1 and 50 recipients." } ``` --- # Errors > Every error returns a JSON body with statusCode, name, and message. SendDart uses conventional HTTP status codes: `2xx` for success, `4xx` for problems with the request (a missing field, an invalid key, an unverified domain), and `5xx` for server errors. Every error response has the same shape: ```json { "statusCode": 403, "name": "invalid_api_key", "message": "API key is invalid or has been revoked." } ``` ## Error names | name | Status | Meaning | | --- | --- | --- | | `invalid_idempotency_key` | 400 | The `Idempotency-Key` is malformed. It must be between 1 and 255 characters. | | `missing_api_key` | 401 | No API key in the authorization header. Include `Authorization: Bearer YOUR_API_KEY`. | | `restricted_api_key` | 401 | This API key is restricted to only send emails. Use a key with full access for other actions. | | `plan_limit_reached` | 402 | A plan cap blocks the request — most often more verified domains than the plan allows. Remove the excess or upgrade. | | `invalid_api_key` | 403 | The API key is invalid, expired, or revoked. Generate a new key in the dashboard. | | `dashboard_only` | 403 | The endpoint refuses API-key callers outright, whatever their permission — unlike `restricted_api_key`, no key can satisfy it. Creating, editing and revoking API keys is dashboard-only: do it under **API Keys** in the dashboard. | | `view_only_member` | 403 | You are signed in as a view-only member of someone else’s team. Reads succeed; creating, changing, deleting and sending are refused until the owner gives you the admin role. (API-key callers get `restricted_api_key` instead.) | | `not_found` | 404 | The requested endpoint or resource does not exist (or is not yours). | | `invalid_idempotent_request` | 409 | The same idempotency key was used with a different request payload. Change the key or the payload. | | `concurrent_idempotent_requests` | 409 | The same idempotency key was used while the original request is still in progress. Try again later. | | `domain_conflict` | 409 | The domain — or a parent/subdomain of it — is already verified by another account. Use `POST /domains/claim` to prove ownership. | | `invalid_attachment` | 422 | An attachment must have either `content` or `path`. | | `validation_error` | 422 | One or more fields failed validation, or the request is rejected for a domain-related reason (e.g. the `from` domain is not verified). The message details which. | | `invalid_from_address` | 422 | The `from` field is invalid. Use `email@example.com` or `Name `. | | `invalid_to_address` | 422 | A recipient address is not a valid email address. | | `missing_required_field` | 422 | The request body is missing one or more required fields (e.g. `from`, `to`, `subject`). | | `reserved_recipient` | 422 | A recipient is on a domain reserved for documentation or local testing — `example.com`, `example.net`, `example.org`, or any address under `.test`, `.invalid`, `.localhost` or `.example`. The email was rejected before the provider handoff and nothing was sent or charged; send to a real mailbox. This is a fail-closed backstop: on [POST /emails](https://www.senddart.com/docs/api/emails-send) and [POST /emails/batch](https://www.senddart.com/docs/api/emails-batch) such recipients are dropped earlier as suppressed, so what you actually see is `validation_error` (422) with the message *All `to` recipients are suppressed*. The [mailbox simulator](https://www.senddart.com/docs/emails/send-test) addresses at `test.senddart.com` are the exception — they are simulated, not rejected. | | `daily_quota_exceeded` | 429 | You have reached your daily email quota. Wait 24 hours or upgrade your plan. Sent and received emails both count. | | `monthly_quota_exceeded` | 429 | You have reached your monthly email quota. Upgrade your plan to increase it. Sent and received emails both count. | | `contact_limit_reached` | 429 | Legacy compatibility code; current plans provide unlimited stored contacts. Request-size and rate limits still apply. | | `ai_credits_exceeded` | 429 | You have used every AI credit in the rolling 30-day window. Upgrade your plan for more. | | `automation_quota_exceeded` | 429 | You have used every automation run in the rolling 30-day window. Upgrade your plan to run more. | | `rate_limit_exceeded` | 429 | Too many requests. Read the rate-limit response headers and reduce your request rate. | | `contacts_busy` | 503 | Another contact write for the same account — usually a bulk import — was still holding the account’s contact-limit lock, so this request was refused before it changed anything. Honor `retry-after` and retry; the same request then succeeds. Prefer one [POST /contacts/batch](https://www.senddart.com/docs/api/contacts-batch) over many concurrent single creates, which is what makes this contention in the first place. | | `contacts_timeout` | 503 | A contact write took longer than its time bound and was rolled back, so nothing changed. Honor `retry-after` and retry; if it recurs, import in smaller batches. | | `batch_incomplete` | 503 | A synchronous [batch send](https://www.senddart.com/docs/api/emails-batch-delivery) ran out of request time before finishing. The body lists exactly which emails were sent (`sent`, `sent_count`) — the remainder were not. `503` with `retry-after` applies when the request carried an `Idempotency-Key`, because retrying that key replays this same answer rather than re-sending. **Without a key the same error is returned as `422` instead**, deliberately: `422` is not automatically retried, and a retry would re-send the emails that were already delivered. | | `reputation_limit_exceeded` | 429 | The account or domain reached its current reputation warm-up/recovery capacity. Honor `Retry-After`; no email was sent. | | `reputation_paused` | 403 | Sending is paused for the account or domain. Do not retry automatically; contact support to request a reputation review. | | `sending_service_unavailable` | 503 | A platform-wide reputation safety check temporarily paused sending. Honor `Retry-After`; no email was sent. | | `sending_configuration_unavailable` | 503 | A SendDart-side sending configuration was momentarily out of step, so the provider refused the send before delivery. Nothing was sent and nothing was charged, and no change to your request can fix it: retry the request (honoring `retry-after` when present), and contact support@senddart.com if it persists. | | `application_error` | 500 | An unexpected error occurred. Safe to retry idempotent requests later. | | `internal_server_error` | 500 | An unexpected error occurred. Try the request again later. | > **Note:** The `validation_error` name normally carries a `422` status and covers both field-level and domain-related rejections, so read `message` to tell them apart. The one exception is the missing-`User-Agent` rejection, which returns `validation_error` with a `403`. A domain that is already verified by a **different** account is its own name — `domain_conflict` (409). --- # Usage limits > Recipient counts, batch size, attachment size, and the daily sending quota. | Limit | Value | | --- | --- | | Recipients per email (`to`) | 1–50 | | `cc` / `bcc` recipients | up to 50 each | | Emails per batch (`POST /emails/batch`) | up to 100 | | Attachment size (per file) | up to 25 MB | | Total attachments per email | up to 40 MB | | Daily sending quota (Free plan) | 100 emails per rolling 24 hours (sent + received; paid plans have no daily cap) | | Monthly sending quota | per plan — Free: 3,000 emails per rolling 30 days (sent + received combined) | When a send would exceed a quota, the request is **rejected** with a `429` (`daily_quota_exceeded` or `monthly_quota_exceeded`) — it is not queued or partially sent. Wait until the rolling window frees up and retry, or raise the limit by upgrading your plan or buying email credits (credits extend the monthly quota only). See [Account quotas and limits](https://www.senddart.com/docs/kb/quotas). ## Rate limits The **send endpoints** (`POST /emails` and the transactional send API) are rate-limited **per client IP** to absorb bursts — on the order of a few dozen send requests per minute. Exceeding that rate returns a `429 rate_limit_exceeded` response. Other endpoints are not subject to this per-request cap; your sustained sending volume is governed by your account quotas (below) rather than a strict per-second limit. To stay within the limit, reduce the rate at which you call the send endpoints — for example by introducing a queue or lowering the number of concurrent requests — and honor the `retry-after` header when you receive a `429`. ### Rate-limit response headers Responses from the rate-limited send endpoints include headers describing your current rate-limit window (the draft-6 lowercase form of the [IETF RateLimit Headers draft](https://datatracker.ietf.org/doc/html/draft-ietf-httpapi-ratelimit-headers-06)): | Header | Description | | --- | --- | | `ratelimit-limit` | Maximum number of requests allowed within a window. | | `ratelimit-remaining` | How many requests you have left within the current window. | | `ratelimit-reset` | How many seconds until the limits are reset. | | `retry-after` | How many seconds you should wait before making a follow-up request. | ## Email quotas When you exceed a quota you receive a `429` with either `daily_quota_exceeded` (reached your daily email quota — wait until 24 hours have passed or upgrade) or `monthly_quota_exceeded` (reached your monthly email quota — upgrade or buy email credits to increase it). Both sent and received emails count towards these quotas. --- # Create Contact Property > POST /contact-properties — define a custom property for your contacts. `POST /contact-properties` Creates a custom property for your contacts. A property defines a typed, named field (with an optional fallback) that you can then set per-contact and reference in templates and segments. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `key` | string | Yes | The property key. Max length is `50` characters. Only alphanumeric characters and underscores are allowed. Also accepted as `name` (alias). | | `type` | string | No | The property type. Possible values: `string` or `number`. Defaults to `string` when omitted. | | `fallback_value` | string | number | No | The default value to use when the property is not set for a contact. Must match the type specified in the `type` field. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contactProperties.create({ "key": "company_name", "type": "string", "fallback_value": "Acme Corp" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::ContactProperties.create({ "key": "company_name", "type": "string", "fallback_value": "Acme Corp" }) ``` **PHP** ```php contactProperties->create([ 'key' => "company_name", 'type' => "string", 'fallback_value' => "Acme Corp" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.ContactProperties.create({ "key": "company_name", "type": "string", "fallback_value": "Acme Corp" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") property, err := client.ContactProperties.Create(&senddart.CreateContactPropertyRequest{ Key: "company_name", Type: "string", FallbackValue: "Acme Corp", }) ``` **Rust** ```rust use senddart::{ContactPropertyType, CreateContactPropertyOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateContactPropertyOptions::new( "company_name", ContactPropertyType::String, ) .with_fallback_value(serde_json::json!("Acme Corp")); let _property = mb.contact_properties.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateContactPropertyRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateContactPropertyRequest request = CreateContactPropertyRequest.builder() .key("company_name") .type("string") .fallbackValue("Acme Corp") .build(); SendDartResponse response = senddart.contactProperties().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactPropertyCreateAsync(new ContactPropertyCreateOptions { Key = "company_name", Type = "string", FallbackValue = "Acme Corp", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/contact-properties' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "key": "company_name", "type": "string", "fallback_value": "Acme Corp" }' ``` **CLI** ```bash senddart contact-properties create \ --key 'company_name' \ --type 'string' \ --fallback-value 'Acme Corp' ``` ### Response ```json { "object": "contact_property", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" } ``` --- # Retrieve Contact Property > GET /contact-properties/:id — retrieve a contact property by its ID. `GET /contact-properties/:id` Retrieve a single contact property by its ID. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `contact_property_id` | string | Yes | The Contact Property ID. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contactProperties.get('b6d24b8e-af0b-4c3c-be0c-359bbd97381e'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::ContactProperties.get("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` **PHP** ```php contactProperties->get('b6d24b8e-af0b-4c3c-be0c-359bbd97381e'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.ContactProperties.get("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") property, err := client.ContactProperties.Get("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _property = mb.contact_properties.get("b6d24b8e-af0b-4c3c-be0c-359bbd97381e").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contactProperties().get("b6d24b8e-af0b-4c3c-be0c-359bbd97381e"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactPropertyRetrieveAsync("b6d24b8e-af0b-4c3c-be0c-359bbd97381e"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/contact-properties/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart contact-properties get b6d24b8e-af0b-4c3c-be0c-359bbd97381e ``` ### Response ```json { "object": "contact_property", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "key": "company_name", "type": "string", "fallback_value": "Acme Corp", "created_at": "2026-04-08T00:11:13.000Z" } ``` --- # List Contact Properties > GET /contact-properties — retrieve a list of contact properties. `GET /contact-properties` Retrieve a list of your contact properties. **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of contact properties to retrieve. Maximum value: `100`. Minimum value: `1`. | | `after` | string | No | The ID *after* which we'll retrieve more contact properties (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. | | `before` | string | No | The ID *before* which we'll retrieve more contact properties (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contactProperties.list(); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::ContactProperties.list ``` **PHP** ```php contactProperties->list(); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.ContactProperties.list() ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") properties, err := client.ContactProperties.List(nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _properties = mb.contact_properties.list(None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contactProperties().list(); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactPropertyListAsync(); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/contact-properties' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart contact-properties list ``` ### Response ```json { "object": "list", "has_more": false, "data": [ { "object": "contact_property", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "key": "company_name", "type": "string", "fallback_value": "Acme Corp", "created_at": "2026-04-08T00:11:13.000Z" } ] } ``` --- # Update Contact Property > PATCH /contact-properties/:id — update an existing contact property. `PATCH /contact-properties/:id` Update an existing contact property. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `contact_property_id` | string | Yes | The Contact Property ID. | > **Note:** The `key` and `type` fields cannot be changed after creation. This preserves data integrity for existing contact values. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `fallback_value` | string | number | No | The default value to use when the property is not set for a contact. Must match the type of the property. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contactProperties.update('b6d24b8e-af0b-4c3c-be0c-359bbd97381e', { "fallback_value": "Example Company" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::ContactProperties.update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", { "fallback_value": "Example Company" }) ``` **PHP** ```php contactProperties->update('b6d24b8e-af0b-4c3c-be0c-359bbd97381e', [ 'fallback_value' => "Example Company" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.ContactProperties.update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", { "fallback_value": "Example Company" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") property, err := client.ContactProperties.Update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", &senddart.UpdateContactPropertyRequest{ FallbackValue: "Example Company", }) ``` **Rust** ```rust use senddart::{SendDart, UpdateContactPropertyOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateContactPropertyOptions::new() .with_fallback_value(serde_json::json!("Example Company")); let _property = mb.contact_properties.update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contactProperties().update( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "Example Company"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactPropertyUpdateAsync( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "Example Company"); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/contact-properties/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "fallback_value": "Example Company" }' ``` **CLI** ```bash senddart contact-properties update b6d24b8e-af0b-4c3c-be0c-359bbd97381e \ --fallback-value 'Example Company' ``` ### Response ```json { "object": "contact_property", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" } ``` --- # Delete Contact Property > DELETE /contact-properties/:id — remove an existing contact property. `DELETE /contact-properties/:id` Remove an existing contact property. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `contact_property_id` | string | Yes | The Contact Property ID. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contactProperties.remove('b6d24b8e-af0b-4c3c-be0c-359bbd97381e'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::ContactProperties.delete("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` **PHP** ```php contactProperties->remove('b6d24b8e-af0b-4c3c-be0c-359bbd97381e'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.ContactProperties.remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.ContactProperties.Remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _removed = mb.contact_properties.remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contactProperties().remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactPropertyDeleteAsync("b6d24b8e-af0b-4c3c-be0c-359bbd97381e"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/contact-properties/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart contact-properties delete b6d24b8e-af0b-4c3c-be0c-359bbd97381e ``` ### Response ```json { "object": "contact_property", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "deleted": true } ``` --- # Add Contact to Segment > POST /contacts/:id/segments/:segment_id — add an existing contact to a segment. `POST /contacts/:id/segments/:segment_id` Add an existing contact to a segment. The contact is identified in the path by either its ID or its email address. Either `id` or `email` must be provided. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | No | The Contact ID. | | `email` | string | No | The Contact Email. | | `segment_id` | string | Yes | The Segment ID. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.addToSegment('e169aa45-1ecf-4183-9955-b1499d5701d3', '78261eea-8f8b-4381-83c6-79fa7120f1cf'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Contacts.add_to_segment("e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf") ``` **PHP** ```php contacts->addToSegment('e169aa45-1ecf-4183-9955-b1499d5701d3', '78261eea-8f8b-4381-83c6-79fa7120f1cf'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Contacts.add_to_segment("e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") added, err := client.Contacts.AddToSegment("e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _added = mb.contacts.add_to_segment("e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contacts().addToSegment( "e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactAddToSegmentAsync( "e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/segments/78261eea-8f8b-4381-83c6-79fa7120f1cf' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart contacts add-to-segment e169aa45-1ecf-4183-9955-b1499d5701d3 78261eea-8f8b-4381-83c6-79fa7120f1cf ``` ### Response ```json { "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf" } ``` --- # Remove Contact from Segment > DELETE /contacts/:id/segments/:segment_id — remove an existing contact from a segment. `DELETE /contacts/:id/segments/:segment_id` Remove an existing contact from a segment. The contact is identified in the path by either its ID or its email address. Either `id` or `email` must be provided. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | No | The Contact ID. | | `email` | string | No | The Contact Email. | | `segment_id` | string | Yes | The Segment ID. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.removeFromSegment('e169aa45-1ecf-4183-9955-b1499d5701d3', '78261eea-8f8b-4381-83c6-79fa7120f1cf'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Contacts.remove_from_segment("e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf") ``` **PHP** ```php contacts->removeFromSegment('e169aa45-1ecf-4183-9955-b1499d5701d3', '78261eea-8f8b-4381-83c6-79fa7120f1cf'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Contacts.remove_from_segment("e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Contacts.RemoveFromSegment("e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _removed = mb.contacts.remove_from_segment("e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contacts().removeFromSegment( "e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactRemoveFromSegmentAsync( "e169aa45-1ecf-4183-9955-b1499d5701d3", "78261eea-8f8b-4381-83c6-79fa7120f1cf"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/segments/78261eea-8f8b-4381-83c6-79fa7120f1cf' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart contacts remove-from-segment e169aa45-1ecf-4183-9955-b1499d5701d3 78261eea-8f8b-4381-83c6-79fa7120f1cf ``` ### Response ```json { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "audienceId": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "deleted": true } ``` --- # List Contact Segments > GET /contacts/:id/segments — retrieve the segments a contact is part of. `GET /contacts/:id/segments` Retrieve a list of segments that a contact is part of. The contact is identified in the path by either its ID or its email address. Either `id` or `email` must be provided. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | No | The Contact ID. | | `email` | string | No | The Contact Email. | **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of segments to retrieve. Maximum value: `100`. Minimum value: `1`. | | `after` | string | No | The ID *after* which we'll retrieve more segments (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. | | `before` | string | No | The ID *before* which we'll retrieve more segments (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.listSegments('e169aa45-1ecf-4183-9955-b1499d5701d3'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Contacts.list_segments("e169aa45-1ecf-4183-9955-b1499d5701d3") ``` **PHP** ```php contacts->listSegments('e169aa45-1ecf-4183-9955-b1499d5701d3'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Contacts.list_segments("e169aa45-1ecf-4183-9955-b1499d5701d3") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") segments, err := client.Contacts.ListSegments("e169aa45-1ecf-4183-9955-b1499d5701d3", nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _segments = mb.contacts.list_segments("e169aa45-1ecf-4183-9955-b1499d5701d3", None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contacts().listSegments("e169aa45-1ecf-4183-9955-b1499d5701d3"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactListSegmentsAsync("e169aa45-1ecf-4183-9955-b1499d5701d3"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/segments' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart contacts segments e169aa45-1ecf-4183-9955-b1499d5701d3 ``` ### Response ```json { "object": "list", "has_more": false, "data": [ { "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Registered Users", "created_at": "2026-10-06T22:59:55.000Z" } ] } ``` --- # Retrieve Contact Topics > GET /contacts/:id/topics — retrieve a list of topic subscriptions for a contact. `GET /contacts/:id/topics` Retrieve a list of topic subscriptions for a contact. The contact is identified in the path by either its ID or its email address. Either `id` or `email` must be provided. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | No | The Contact ID. | | `email` | string | No | The Contact Email. | **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of topics to retrieve. Maximum value: `100`. Minimum value: `1`. | | `after` | string | No | The ID *after* which we'll retrieve more topics (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. | | `before` | string | No | The ID *before* which we'll retrieve more topics (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.getTopics('e169aa45-1ecf-4183-9955-b1499d5701d3'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Contacts.get_topics("e169aa45-1ecf-4183-9955-b1499d5701d3") ``` **PHP** ```php contacts->getTopics('e169aa45-1ecf-4183-9955-b1499d5701d3'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Contacts.get_topics("e169aa45-1ecf-4183-9955-b1499d5701d3") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") topics, err := client.Contacts.GetTopics("e169aa45-1ecf-4183-9955-b1499d5701d3", nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _topics = mb.contacts.get_topics("e169aa45-1ecf-4183-9955-b1499d5701d3", None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contacts().getTopics("e169aa45-1ecf-4183-9955-b1499d5701d3"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactRetrieveTopicsAsync("e169aa45-1ecf-4183-9955-b1499d5701d3"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/topics' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart contacts topics e169aa45-1ecf-4183-9955-b1499d5701d3 ``` ### Response ```json { "object": "list", "has_more": false, "data": [ { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "name": "Product Updates", "description": "New features, and latest announcements.", "subscription": "opt_in" } ] } ``` --- # Update Contact Topics > PATCH /contacts/:id/topics — update topic subscriptions for a contact. `PATCH /contacts/:id/topics` Update topic subscriptions for a contact. The contact is identified in the path by either its ID or its email address. Either `id` or `email` must be provided. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | No | The Contact ID. | | `email` | string | No | The Contact Email. | **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `topics` | array | Yes | Array of topic subscription updates. Each item has the properties below. You can also send a bare JSON array as the body instead of wrapping it in `{ topics: [...] }` — the example below does exactly that. | | `topics[].id` | string | Yes | The Topic ID. | | `topics[].subscription` | string | Yes | The subscription action. Must be either `opt_in` or `opt_out`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.updateTopics('e169aa45-1ecf-4183-9955-b1499d5701d3', { topics: [ { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "subscription": "opt_out" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Contacts.update_topics("e169aa45-1ecf-4183-9955-b1499d5701d3", [ { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "subscription": "opt_out" } ]) ``` **PHP** ```php contacts->updateTopics('e169aa45-1ecf-4183-9955-b1499d5701d3', [ [ 'id' => "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", 'subscription' => "opt_out" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Contacts.update_topics("e169aa45-1ecf-4183-9955-b1499d5701d3", [ { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "subscription": "opt_out" } ]) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") contact, err := client.Contacts.UpdateTopics("e169aa45-1ecf-4183-9955-b1499d5701d3", &senddart.UpdateContactTopicsRequest{ Topics: []senddart.TopicSubscriptionUpdate{ { Id: "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", Subscription: "opt_out", }, }, }) ``` **Rust** ```rust use senddart::{SendDart, SubscriptionState, UpdateContactTopicsOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateContactTopicsOptions::new() .with_topic("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", SubscriptionState::OptOut); let _contact = mb.contacts.update_topics("e169aa45-1ecf-4183-9955-b1499d5701d3", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.UpdateContactTopicsRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); UpdateContactTopicsRequest request = UpdateContactTopicsRequest.builder() .topic("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "opt_out") .build(); SendDartResponse response = senddart.contacts().updateTopics( "e169aa45-1ecf-4183-9955-b1499d5701d3", request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactUpdateTopicsAsync("e169aa45-1ecf-4183-9955-b1499d5701d3", new ContactTopicsUpdateOptions { Topics = new List { new() { Id = "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", Subscription = "opt_out", }, }, }); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/topics' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '[ { "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "subscription": "opt_out" } ]' ``` **CLI** ```bash senddart contacts set-topics e169aa45-1ecf-4183-9955-b1499d5701d3 \ --topics '[{"id":"b6d24b8e-af0b-4c3c-be0c-359bbd97381e","subscription":"opt_out"}]' ``` ### Response ```json { "id": "e169aa45-1ecf-4183-9955-b1499d5701d3" } ``` The `id` in the response is the **contact** id (not a topic id). --- # List Polls > GET /polls — list emails that have in-email poll responses. `GET /polls` Returns one summary row per email that has collected poll responses, ordered by the most recent response first. Use the `email_id` to fetch the full answer breakdown with [Retrieve Poll Results](https://www.senddart.com/docs/api/polls-get). Requires an API key with read access. **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of rows to retrieve. Minimum `1`, maximum `100`. A value outside that range is rejected with a `422 validation_error`. Unlike the other list endpoints there is no default of 20 on an unpaged request: omit `limit` and every row is returned, up to the ceiling below. Omitting it while paging with `after` or `before` does fall back to 20. | | `after` | string | No | The `email_id` after which to retrieve more rows (pagination). The id itself is excluded. Cannot be combined with `before`. | | `before` | string | No | The `email_id` before which to retrieve more rows (pagination). The id itself is excluded. Cannot be combined with `after`. | > **Warning:** This endpoint reads at most the **200 most recently answered emails** before paginating, and `has_more` does not report that ceiling. If your account has more than 200 poll-bearing emails, the older ones are not reachable through `after` paging here — read the per-email breakdown with [Retrieve Poll Results](https://www.senddart.com/docs/api/polls-get) instead. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.polls.list(); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Polls.list ``` **PHP** ```php polls->list(); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Polls.list() ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") polls, err := client.Polls.List(nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _polls = mb.polls.list(None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.polls().list(); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.PollListAsync(); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/polls' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart polls list ``` ### Response ```json { "object": "list", "has_more": false, "data": [ { "object": "poll", "email_id": "8f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8d", "subject": "How was your experience?", "responses": 128, "distinct_answers": 3, "last_response_at": "2026-07-04T10:12:00.000Z" } ] } ``` --- # Retrieve Poll Results > GET /polls/:emailId — the aggregated answer breakdown for one email. `GET /polls/:emailId` Retrieve the aggregated poll results for a single email: a tally per answer (most-voted first, with each answer's share of all responses), the total number of responses, and the number of distinct respondents. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `email_id` | string | Yes | The id of the email the poll was sent on. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.polls.get('8f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8d'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Polls.get("8f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8d") ``` **PHP** ```php polls->get('8f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8d'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Polls.get("8f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8d") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") poll, err := client.Polls.Get("8f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8d") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _poll = mb.polls.get("8f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8d").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.polls().get("8f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8d"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.PollRetrieveAsync("8f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8d"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/polls/8f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8d' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart polls get 8f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8d ``` ### Response ```json { "object": "poll_result", "email_id": "8f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8d", "total": 128, "unique_respondents": 121, "answers": [ { "answer": "Great", "count": 74, "pct": 57.8 }, { "answer": "Okay", "count": 39, "pct": 30.5 }, { "answer": "Poor", "count": 15, "pct": 11.7 } ] } ``` A vote also emits a `poll.responded` [automation](https://www.senddart.com/docs/automations/trigger) event, so you can trigger a workflow (or branch on `event.answer`) when a contact responds. --- # Campaign Follow-ups & Controls > Engagement follow-ups, mailing-list To, and the unsubscribe policy on POST /campaigns. `POST /campaigns` Three optional controls extend a campaign beyond the base fields. ## Engagement follow-ups Up to 5 `followups` send automatically after the campaign finishes — each fires `delay` later to the recipients matching its `condition`, threaded as a reply to their original email (same conversation; subject defaults to `Re: `). Bodies support the same merge tags as the campaign. | Field | Description | | --- | --- | | `condition` | One of `opened`, `clicked`, `not_opened`, `not_clicked`, `replied`, `not_replied`. | | `delay` | Natural-language duration after the send completes, e.g. `"5 hours"`, `"4 days"` (max 30 days). | | `subject` | Optional; defaults to `Re: ` to keep the thread. | | `html` | The follow-up body (required). | > **Note:** Open/click conditions require tracking to be enabled on the sending domain. ## Mailing-list To Set `list_to: true` and every message shows a generated `recipient-@your-domain` address as the visible To header. Delivery is unchanged — each mail is still sent individually to its real recipient. ## Unsubscribe policy | `unsubscribe_policy` | Behavior | | --- | --- | | `account` (default) | Any opt-out blocks the recipient — today's behavior. | | `domain` | Only opt-outs recorded for THIS sending domain (plus account-wide ones) block. An unsubscribe from one of your other domains does not. | | `ignore` | The unsubscribe list is skipped. Hard-bounced and complained addresses are ALWAYS excluded regardless. | > **Warning:** Use `ignore` only where you have a lawful basis to email recipients who opted out. ## A/B winning metric The `ab_test.metric` now accepts `reply` in addition to `open` and `click` — the winner is the variant with the higher reply rate (replies are matched from your inbound mail). **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.create({ "domain": "yourdomain.com", "from": "You ", "subject": "Big news", "html": "

Hi {{name}} …

", "list_to": true, "unsubscribe_policy": "domain", "ab_test": { "enabled": true, "subject_b": "Bigger news", "test_pct": 20, "metric": "reply" }, "followups": [ { "condition": "not_opened", "delay": "5 hours", "html": "

Bumping this…

" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.create({ "domain": "yourdomain.com", "from": "You ", "subject": "Big news", "html": "

Hi {{name}} …

", "list_to": true, "unsubscribe_policy": "domain", "ab_test": { "enabled": true, "subject_b": "Bigger news", "test_pct": 20, "metric": "reply" }, "followups": [ { "condition": "not_opened", "delay": "5 hours", "html": "

Bumping this…

" } ] }) ``` **PHP** ```php campaigns->create([ 'domain' => "yourdomain.com", 'from' => "You ", 'subject' => "Big news", 'html' => "

Hi {{name}} …

", 'list_to' => true, 'unsubscribe_policy' => "domain", 'ab_test' => [ 'enabled' => true, 'subject_b' => "Bigger news", 'test_pct' => 20, 'metric' => "reply" ], 'followups' => [ [ 'condition' => "not_opened", 'delay' => "5 hours", 'html' => "

Bumping this…

" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.create({ "domain": "yourdomain.com", "from": "You ", "subject": "Big news", "html": "

Hi {{name}} …

", "list_to": True, "unsubscribe_policy": "domain", "ab_test": { "enabled": True, "subject_b": "Bigger news", "test_pct": 20, "metric": "reply" }, "followups": [ { "condition": "not_opened", "delay": "5 hours", "html": "

Bumping this…

" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") campaign, err := client.Campaigns.Create(&senddart.CreateCampaignRequest{ Domain: "yourdomain.com", From: "You ", Subject: "Big news", Html: "

Hi {{name}} …

", ListTo: true, UnsubscribePolicy: "domain", AbTest: &senddart.CampaignAbTest{ Enabled: true, SubjectB: "Bigger news", TestPct: 20, Metric: "reply", }, Followups: []senddart.CampaignFollowupInput{ { Condition: "not_opened", Delay: "5 hours", Html: "

Bumping this…

", }, }, }) ``` **Rust** ```rust use senddart::{AbMetric, CampaignAbTestOptions, CampaignFollowup, CreateCampaignOptions, FollowupCondition, SendDart, UnsubscribePolicy}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateCampaignOptions::new( "yourdomain.com", "You ", "Big news", ) .with_html("

Hi {{name}} …

") .with_list_to(true) .with_unsubscribe_policy(UnsubscribePolicy::Domain) .with_ab_test(CampaignAbTestOptions::enabled() .with_subject_b("Bigger news") .with_test_pct(20) .with_metric(AbMetric::Reply)) .with_followup(CampaignFollowup::new( FollowupCondition::NotOpened, "5 hours", "

Bumping this…

", )); let _campaign = mb.campaigns.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CampaignAbTest; import com.senddart.requests.CampaignFollowup; import com.senddart.requests.CreateCampaignRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateCampaignRequest request = CreateCampaignRequest.builder() .domain("yourdomain.com") .from("You ") .subject("Big news") .html("

Hi {{name}} …

") .listTo(true) .unsubscribePolicy("domain") .abTest(CampaignAbTest.builder() .enabled(true) .subjectB("Bigger news") .testPct(20) .metric("reply") .build()) .followup(CampaignFollowup.builder() .condition("not_opened") .delay("5 hours") .html("

Bumping this…

") .build()) .build(); SendDartResponse response = senddart.campaigns().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignCreateAsync(new CampaignCreateOptions { Domain = "yourdomain.com", From = "You ", Subject = "Big news", HtmlBody = "

Hi {{name}} …

", ListTo = true, UnsubscribePolicy = "domain", AbTest = new CampaignAbTest { Enabled = true, SubjectB = "Bigger news", TestPct = 20, Metric = "reply", }, Followups = new List { new() { Condition = "not_opened", Delay = "5 hours", HtmlBody = "

Bumping this…

", }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/campaigns' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "domain": "yourdomain.com", "from": "You ", "subject": "Big news", "html": "

Hi {{name}} …

", "list_to": true, "unsubscribe_policy": "domain", "ab_test": { "enabled": true, "subject_b": "Bigger news", "test_pct": 20, "metric": "reply" }, "followups": [ { "condition": "not_opened", "delay": "5 hours", "html": "

Bumping this…

" } ] }' ``` **CLI** ```bash senddart campaigns create \ --domain 'yourdomain.com' \ --from 'You ' \ --subject 'Big news' \ --html '

Hi {{name}} …

' \ --list-to \ --unsubscribe-policy 'domain' \ --ab-test '{"enabled":true,"subject_b":"Bigger news","test_pct":20,"metric":"reply"}' \ --followups '[{"condition":"not_opened","delay":"5 hours","html":"

Bumping this…

"}]' ``` --- # Import from Google Sheet > POST /audiences/:id/contacts/import-sheet — import a link-shared sheet; headers become merge tags. `POST /audiences/:id/contacts/import-sheet` Imports contacts from a Google Sheet shared as “Anyone with the link can view”. The sheet needs an `email` column; every other header (e.g. `name`, `phone_no`, `marks`, `country`) is auto-registered as a contact property, so each column is usable as a merge tag — `Hi {{name}}, we tried reaching you at {{phone_no}}` resolves per row. Rows land in a fresh segment you can target from a campaign. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `url` | string | Yes | The sheet's share URL (docs.google.com/spreadsheets/…). A #gid selects a tab. | | `segment_name` | string | No | Name for the created segment. Defaults to a dated “Sheet import”. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.audiences.importSheet('AUDIENCE_ID', { "url": "https://docs.google.com/spreadsheets/d/SHEET_ID", "segment_name": "Webinar signups" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Audiences.import_sheet("AUDIENCE_ID", { "url": "https://docs.google.com/spreadsheets/d/SHEET_ID", "segment_name": "Webinar signups" }) ``` **PHP** ```php audiences->importSheet('AUDIENCE_ID', [ 'url' => "https://docs.google.com/spreadsheets/d/SHEET_ID", 'segment_name' => "Webinar signups" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Audiences.import_sheet("AUDIENCE_ID", { "url": "https://docs.google.com/spreadsheets/d/SHEET_ID", "segment_name": "Webinar signups" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") imported, err := client.Audiences.ImportSheet("AUDIENCE_ID", &senddart.ImportSheetRequest{ Url: "https://docs.google.com/spreadsheets/d/SHEET_ID", SegmentName: "Webinar signups", }) ``` **Rust** ```rust use senddart::{ImportSheetOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = ImportSheetOptions::new("https://docs.google.com/spreadsheets/d/SHEET_ID") .with_segment_name("Webinar signups"); let _imported = mb.audiences.import_sheet("AUDIENCE_ID", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.audiences().importSheet( "AUDIENCE_ID", "https://docs.google.com/spreadsheets/d/SHEET_ID", "Webinar signups"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AudienceImportSheetAsync( "AUDIENCE_ID", "https://docs.google.com/spreadsheets/d/SHEET_ID", "Webinar signups"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/import-sheet' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "url": "https://docs.google.com/spreadsheets/d/SHEET_ID", "segment_name": "Webinar signups" }' ``` **CLI** ```bash senddart audiences import-sheet AUDIENCE_ID \ --url 'https://docs.google.com/spreadsheets/d/SHEET_ID' \ --segment-name 'Webinar signups' ``` ### Response ```json { "object": "sheet_import", "imported": 42, "updated": 3, "skipped": 0, "total": 45, "segment_id": "4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", "segment_name": "Sheet import 2026-07-04", "segment_added": 45, "variables": ["name", "phone_no", "marks", "country"] } ``` --- # List Sent Emails > GET /emails — list the emails your account has sent, newest first. `GET /emails` List the emails your account has sent. The list returns a reference to each email; use an email's `id` to fetch its full body and event log with [GET /emails/:id](https://www.senddart.com/docs/api/emails-get), or its [attachments](https://www.senddart.com/docs/api/emails-list-attachments). This endpoint returns only emails **sent** by your account. To list emails received by your domains, use [GET /emails/receiving](https://www.senddart.com/docs/api/emails-received-list). > **Note:** This endpoint is always paginated. See [Pagination](https://www.senddart.com/docs/api/pagination) for navigating with `limit`, `after`, and `before`. ## Query parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of emails to retrieve per page. Default `20`, maximum `100`, minimum `1`. | | `after` | string | No | The email `id` **after** which more emails are retrieved (the next page). The passed id is not included. Cannot be combined with `before`. | | `before` | string | No | The email `id` **before** which more emails are retrieved (the previous page). The passed id is not included. Cannot be combined with `after`. | | `status` | string | No | Return only emails whose current state matches, compared against the same value as `last_event` — e.g. `delivered`, `opened`, `bounced`, `scheduled`, `failed`. | | `search` | string | No | Case-insensitive substring match on the recipients, subject, or sender. Applied across the whole list, not just the current page. `q` is accepted as an alias. | | `campaign_id` | string | No | Return only emails sent by that campaign. Takes precedence over `automation_id` and `source` if more than one is supplied. | | `automation_id` | string | No | Return only emails sent by that automation. Ignored when `campaign_id` is also supplied. | | `source` | string | No | Pass `source=individual` to return only one-off sends — emails that belong to no campaign and no automation. `source=api` narrows that to sends made with an API key (plus mail sent before the door was recorded), `source=dashboard` to mail composed in the dashboard. Honoured only when neither `campaign_id` nor `automation_id` is supplied. | | `domain_id` | string | No | Return only emails sent from that sending domain. Composes with the filters above. | | `folder` | string | No | Mailbox folder: `outbox` (currently sending), `sent`, `scheduled`, or `failed`. Any other value is a 422 — received mail is served by GET /emails/receiving, drafts by GET /email-drafts. Independent of `status` / `last_event`. Official 5.1.1 SDKs and the CLI (`--folder`) forward this query. | ## Request **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.list(); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.list ``` **PHP** ```php emails->list(); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.list() ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") emails, err := client.Emails.List(nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _emails = mb.emails.list(None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().list(); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailListAsync(); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails list ``` ## Filter by mailbox folder Pass `folder` to list by mailbox instead of by delivery `status`. `outbox` is still sending, `sent` has been accepted for delivery, `scheduled` is held for a future send, and `failed` never left SendDart. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.list({ folder: 'outbox' }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.list({ "folder": "outbox" }) ``` **PHP** ```php emails->list([ 'folder' => "outbox" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.list({ "folder": "outbox" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") emails, err := client.Emails.ListFiltered(&senddart.ListEmailsRequest{ Folder: "outbox", }) ``` **Rust** ```rust use senddart::{ListEmailsParams, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = Some(ListEmailsParams::new().with_folder("outbox")); let _emails = mb.emails.list_filtered(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.ListEmailsParams; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().list(ListEmailsParams.builder().folder("outbox").build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailListAsync(new EmailListOptions { Folder = "outbox" }); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/emails?folder=outbox' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails list \ --folder outbox ``` ## Response A paginated `list` object. Each item in `data` is an email reference with its `id`, addressing, `subject`, `last_event`, and timestamps. ```json { "object": "list", "has_more": false, "data": [ { "id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "object": "email", "message_id": "<111-222-333@email.example.com>", "to": ["delivered@example.com"], "from": "Acme ", "created_at": "2026-06-23T22:13:42.674Z", "subject": "Hello World", "bcc": null, "cc": null, "reply_to": null, "last_event": "delivered", "scheduled_at": null } ] } ``` ## Errors Returns `validation_error` if `limit` is outside 1–100 or if both `before` and `after` are supplied. A malformed or unknown cursor is **not** an error — it returns an empty page (`data: []`, `has_more: false`). See the [error reference](https://www.senddart.com/docs/api/errors). --- # List Attachments > GET /emails/:id/attachments — list the attachments on a sent email. `GET /emails/:id/attachments` List the attachments on an email your account has sent. Each entry returns the attachment metadata — `filename`, `size`, and MIME fields. SendDart does not retain the original file bytes for sent mail, so `download_url` and `expires_at` are **`null`** for sent-email attachments; binary retrieval is not guaranteed. (For received mail, attachment bytes are downloadable — see [List Received Attachments](https://www.senddart.com/docs/api/emails-received-list-attachments).) > **Note:** This endpoint is **not** paginated. Every attachment on the email is returned in one `list` response, `has_more` is always `false`, and `limit` / `after` / `before` are ignored if you send them. (The received-mail sibling, [List Received Attachments](https://www.senddart.com/docs/api/emails-received-list-attachments), *is* paginated.) ## Path parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The id of the sent email. | ## Response fields Each item in `data` is an attachment object: | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | No | The attachment id. | | `filename` | string | No | The file name. | | `size` | number | null | No | The file size in bytes, or `null` when the attachment was sent by hosted `path` URL — the size is derived from stored base64 `content`, which a URL-sent attachment does not have. | | `content_type` | string | No | The MIME type (e.g. `image/png`). | | `content_disposition` | string | No | `inline` or `attachment`. | | `content_id` | string | No | The Content-ID, for inline images referenced by `cid:`. | | `download_url` | string | null | No | A signed URL to download the file bytes. Always `null` for sent-email attachments — the original bytes are not retained. | | `expires_at` | string | null | No | ISO 8601 time at which `download_url` expires. Always `null` for sent-email attachments. | ## Request **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.listAttachments('4ef9a417-02e9-4d39-ad75-9611e0fcc33c'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.list_attachments("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **PHP** ```php emails->listAttachments('4ef9a417-02e9-4d39-ad75-9611e0fcc33c'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.list_attachments("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") attachments, err := client.Emails.ListAttachments("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _attachments = mb.emails.list_attachments("4ef9a417-02e9-4d39-ad75-9611e0fcc33c").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().listAttachments("4ef9a417-02e9-4d39-ad75-9611e0fcc33c"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailListAttachmentsAsync("4ef9a417-02e9-4d39-ad75-9611e0fcc33c"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/emails/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails attachments 4ef9a417-02e9-4d39-ad75-9611e0fcc33c ``` ## Response ```json { "object": "list", "has_more": false, "data": [ { "object": "attachment", "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318", "filename": "avatar.png", "size": 4096, "content_type": "image/png", "content_disposition": "inline", "content_id": "img001", "download_url": null, "expires_at": null } ] } ``` ## Errors Returns `not_found` (404) if no email with that id exists for your account. There are no pagination errors on this endpoint — it takes no query parameters. See the [error reference](https://www.senddart.com/docs/api/errors). --- # Retrieve Attachment > GET /emails/:id/attachments/:attachment_id — fetch a single attachment from a sent email. `GET /emails/:id/attachments/:attachment_id` Retrieve a single attachment from a sent email by its id. The response returns the attachment metadata. SendDart does not retain the original file bytes for sent mail, so `download_url` and `expires_at` are **`null`** — binary retrieval is not guaranteed for sent-email attachments. ## Path parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The id of the sent email. | | `attachment_id` | string | Yes | The id of the attachment to retrieve. | ## Response fields | Name | Type | Required | Description | | --- | --- | --- | --- | | `object` | string | No | Always `attachment`. | | `id` | string | No | The attachment id. | | `filename` | string | No | The file name. | | `size` | number | null | No | The file size in bytes, or `null` when the attachment was sent by hosted `path` URL (the size is derived from stored base64 `content`). | | `content_type` | string | No | The MIME type. | | `content_disposition` | string | No | `inline` or `attachment`. | | `content_id` | string | No | The Content-ID, for inline images referenced by `cid:`. | | `download_url` | string | null | No | A signed URL to download the file bytes. Always `null` for sent-email attachments — the original bytes are not retained. | | `expires_at` | string | null | No | ISO 8601 time at which `download_url` expires. Always `null` for sent-email attachments. | ## Request **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.getAttachment('4ef9a417-02e9-4d39-ad75-9611e0fcc33c', '2a0c9ce0-3112-4728-976e-47ddcd16a318'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.get_attachment("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318") ``` **PHP** ```php emails->getAttachment('4ef9a417-02e9-4d39-ad75-9611e0fcc33c', '2a0c9ce0-3112-4728-976e-47ddcd16a318'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.get_attachment("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") attachment, err := client.Emails.GetAttachment("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _attachment = mb.emails.get_attachment("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().getAttachment( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailRetrieveAttachmentAsync( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/emails/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments/2a0c9ce0-3112-4728-976e-47ddcd16a318' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails attachment 4ef9a417-02e9-4d39-ad75-9611e0fcc33c 2a0c9ce0-3112-4728-976e-47ddcd16a318 ``` ## Response ```json { "object": "attachment", "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318", "filename": "avatar.png", "size": 4096, "content_type": "image/png", "content_disposition": "inline", "content_id": "img001", "download_url": null, "expires_at": null } ``` ## Errors Returns `not_found` (404) if the email or the attachment does not exist for your account. See the [error reference](https://www.senddart.com/docs/api/errors). --- # List Received Emails > GET /emails/receiving — list the emails received by your domains. `GET /emails/receiving` List the emails received by your domains. The list returns a reference to each received email; use an email's `id` to fetch its full content with [GET /emails/receiving/:id](https://www.senddart.com/docs/api/emails-received-get), or its [attachments](https://www.senddart.com/docs/api/emails-received-list-attachments). This endpoint returns only emails **received** by your domains. To list emails your account has sent, use [GET /emails](https://www.senddart.com/docs/api/emails-list). > **Note:** This endpoint is paginated. The `limit` parameter is optional — if you omit it, up to 1,000 received emails are returned in a single response. Always check `has_more` and keep paging with `after` if it is `true`. See [Pagination](https://www.senddart.com/docs/api/pagination). ## Query parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of received emails to retrieve per page. Optional. Maximum `100`, minimum `1`. | | `after` | string | No | The email `id` **after** which more emails are retrieved. The passed id is not included. Cannot be combined with `before`. | | `before` | string | No | The email `id` **before** which more emails are retrieved. The passed id is not included. Cannot be combined with `after`. | | `received_for` | string | No | Return only mail delivered to that address. Matched case-insensitively against the envelope recipient list, so it finds mail addressed via `bcc` or an alias too. | ## Request **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.receiving.list(); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails::Receiving.list ``` **PHP** ```php emails->receiving->list(); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.Receiving.list() ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") inbound, err := client.Emails.Receiving.List(nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _inbound = mb.emails.receiving.list(None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().receiving().list(); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ReceivedEmailListAsync(); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/emails/receiving' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails receiving list ``` ## Response A paginated `list` object. Each item in `data` is a received-email reference with its addressing, `subject`, a short body `snippet` (the first ~180 characters of the plain-text body, or of the tag-stripped HTML when there is no text part; omitted when the body is empty), `message_id`, its `read` state, and an `attachments` summary. ```json { "object": "list", "has_more": true, "data": [ { "object": "received_email", "id": "a39999a6-88e3-48b1-888b-beaabcde1b33", "to": ["recipient@yourdomain.com"], "from": "sender@example.com", "created_at": "2026-06-23T14:37:40.951Z", "subject": "Hello World", "snippet": "Congrats on sending your first email!", "message_id": "<111-222-333@email.example.com>", "read": false, "read_at": null, "raw_available": false, "attachments": [ { "id": "47e999c7-c89c-4999-bf32-aaaaa1c3ff21", "filename": "example.txt", "content_type": "text/plain", "content_disposition": "attachment", "size": 13, "downloadable": false } ] } ] } ``` ## Errors Returns `validation_error` if `limit` is outside 1–100 or if both `before` and `after` are supplied. A malformed or unknown cursor is **not** an error — it returns an empty page (`data: []`, `has_more: false`). See the [error reference](https://www.senddart.com/docs/api/errors). --- # Retrieve Received Email > GET /emails/receiving/:id — fetch a single received email, its body, headers, and attachments. `GET /emails/receiving/:id` Retrieve a single received email by id, including its `html`/`text` body, parsed `headers`, the `attachments` array, and a `raw` download for the original `.eml` file. ## Path parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The id of the received email. | ## Response fields | Name | Type | Required | Description | | --- | --- | --- | --- | | `object` | string | No | Always `received_email`. | | `id` | string | No | The received-email id. | | `domain_id` | string | null | No | The receiving domain the message arrived on — the field to group by when an account receives on more than one domain. `null` on rows stored before it was recorded. | | `to` | string[] | No | The recipient addresses parsed from the To header. | | `from` | string | No | The sender address. | | `from_name` | string | null | No | The sender's display name from the `From` header ("Alice Baker" for `Alice Baker `), decoded. `null` when the header carried only an address. | | `subject` | string | No | The subject line. | | `html` | string | No | The HTML body (omitted when absent). | | `text` | string | No | The plain-text body (omitted when absent). | | `headers` | object | No | Parsed message headers as a name → value map (omitted when absent). | | `cc` | string[] | No | Carbon-copy recipients (omitted when absent). | | `bcc` | string[] | No | Blind carbon-copy recipients (omitted when absent). | | `received_for` | string[] | No | The envelope RCPT addresses the message was delivered to on your domains (omitted when absent). | | `message_id` | string | No | The original `Message-ID` header (omitted when absent). | | `category` | string | null | No | AI-classified reply intent when this message is a recognised reply: `interested`, `neutral`, or `not_interested`. `null` for non-replies and not-yet-classified messages. | | `reply_to_email_id` | string | null | No | When this received message is a reply to an email you sent, the id of that sent email. `null` otherwise. | | `read` | boolean | No | Whether the message has been read. `false` until it is opened in the dashboard Inbox or marked read with [PATCH /emails/receiving/:id](https://www.senddart.com/docs/api/emails-received-update). Fetching it with this endpoint does **not** mark it read. | | `read_at` | string | null | No | ISO 8601 time the message was first marked read; `null` while unread. | | `spf` | string | No | SPF result string, e.g. `pass` (omitted when absent). | | `verdicts` | object | No | Inbound authentication verdicts: `{ spf, dkim, dmarc, spam, virus }`. Each value is a string such as `PASS` or `FAIL` (omitted when absent). | | `raw_available` | boolean | No | Whether the original raw `.eml` message was retained and is downloadable via [GET /emails/receiving/:id/raw](https://www.senddart.com/docs/api/emails-received-raw). | | `raw` | object | No | A download for the original raw email: `{ download_url }`. The URL requires your API key, exactly like every other endpoint. Present only when `raw_available` is `true`. (A top-level `raw_url` relative-path alias is also returned for backward compatibility.) | | `attachments` | object[] | No | The attachments: each is `{ id, filename, content_type, content_disposition, content_id, size, downloadable, download_url }`. `download_url` (and the legacy relative-path alias `url`) is present only when `downloadable` is `true`. Omitted when the email has no attachments. | | `created_at` | string | No | ISO 8601 time the email was received. | ## Request **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.receiving.get('4ef9a417-02e9-4d39-ad75-9611e0fcc33c'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails::Receiving.get("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **PHP** ```php emails->receiving->get('4ef9a417-02e9-4d39-ad75-9611e0fcc33c'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.Receiving.get("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") received, err := client.Emails.Receiving.Get("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _received = mb.emails.receiving.get("4ef9a417-02e9-4d39-ad75-9611e0fcc33c").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().receiving().get("4ef9a417-02e9-4d39-ad75-9611e0fcc33c"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ReceivedEmailRetrieveAsync("4ef9a417-02e9-4d39-ad75-9611e0fcc33c"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails receiving get 4ef9a417-02e9-4d39-ad75-9611e0fcc33c ``` ## Response ```json { "object": "received_email", "id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "to": ["delivered@yourdomain.com"], "from": "onboarding@example.com", "from_name": "Acme Onboarding", "created_at": "2026-06-23T22:13:42.674Z", "subject": "Hello World", "html": "Congrats on sending your first email!", "headers": { "from": "Acme ", "return-path": "bounce@example.com", "mime-version": "1.0" }, "received_for": ["forwarded@yourdomain.com"], "message_id": "<111-222-333@email.example.com>", "category": "interested", "reply_to_email_id": "55f6ab21-9f7c-4d0a-a3e9-1b2c3d4e5f6a", "read": true, "read_at": "2026-06-24T09:02:17.113Z", "spf": "pass", "raw_available": true, "raw": { "download_url": "https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/raw" }, "attachments": [ { "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318", "filename": "avatar.png", "content_type": "image/png", "content_disposition": "inline", "content_id": "img001", "size": 4096, "downloadable": true, "download_url": "https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments/2a0c9ce0-3112-4728-976e-47ddcd16a318" } ] } ``` ## Errors Returns `not_found` (404) if no received email with that id exists for your account. See the [error reference](https://www.senddart.com/docs/api/errors). --- # List Received Attachments > GET /emails/receiving/:id/attachments — list the attachments on a received email. `GET /emails/receiving/:id/attachments` List the attachments on a received email. Each entry carries its `filename`, `size`, and MIME metadata, plus a `download_url` for the file bytes when they were stored (`downloadable: true`). The URL is not a public link — fetch it with your API key like any other endpoint. > **Note:** This endpoint is paginated. The `limit` parameter is optional — if you omit it, up to 1,000 attachments are returned in a single response, with `has_more` set to `true` in the unlikely event more exist. See [Pagination](https://www.senddart.com/docs/api/pagination). ## Path parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The id of the received email. | ## Query parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of attachments to retrieve per page. Optional. Maximum `100`, minimum `1`. | | `after` | string | No | The attachment `id` **after** which more attachments are retrieved. The passed id is not included. Cannot be combined with `before`. | | `before` | string | No | The attachment `id` **before** which more attachments are retrieved. The passed id is not included. Cannot be combined with `after`. | ## Request **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.receiving.listAttachments('4ef9a417-02e9-4d39-ad75-9611e0fcc33c'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails::Receiving.list_attachments("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **PHP** ```php emails->receiving->listAttachments('4ef9a417-02e9-4d39-ad75-9611e0fcc33c'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.Receiving.list_attachments("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") attachments, err := client.Emails.Receiving.ListAttachments("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _attachments = mb.emails.receiving.list_attachments("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().receiving().listAttachments("4ef9a417-02e9-4d39-ad75-9611e0fcc33c"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ReceivedEmailListAttachmentsAsync("4ef9a417-02e9-4d39-ad75-9611e0fcc33c"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails receiving attachments 4ef9a417-02e9-4d39-ad75-9611e0fcc33c ``` ## Response ```json { "object": "list", "has_more": false, "data": [ { "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318", "filename": "avatar.png", "size": 4096, "content_type": "image/png", "content_disposition": "inline", "content_id": "img001", "downloadable": true, "download_url": "https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments/2a0c9ce0-3112-4728-976e-47ddcd16a318" } ] } ``` ## Errors Returns `not_found` (404) if no received email with that id exists for your account; `validation_error` for a bad cursor or out-of-range `limit`. See the [error reference](https://www.senddart.com/docs/api/errors). --- # Retrieve Received Attachment > GET /emails/receiving/:id/attachments/:attachment_id — fetch a single attachment from a received email. `GET /emails/receiving/:id/attachments/:attachment_id` Download a single attachment from a received email by its id. Unlike most API endpoints, this returns the **raw file bytes** as a binary download — not a JSON object. Use the `Content-Type` and `Content-Disposition` of the response to handle the file. ## Path parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The id of the received email. | | `attachment_id` | string | Yes | The id of the attachment to download. | ## Response On success the response body is the raw attachment bytes. The `Content-Type` header carries the file's MIME type (render-capable types such as HTML/SVG are served as `application/octet-stream` for safety), and a `Content-Disposition: attachment` header carries the original filename. There is no JSON envelope. ```bash HTTP/1.1 200 OK Content-Type: image/png Content-Disposition: attachment; filename="avatar.png" X-Content-Type-Options: nosniff ``` ## Request **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.receiving.getAttachment('4ef9a417-02e9-4d39-ad75-9611e0fcc33c', '2a0c9ce0-3112-4728-976e-47ddcd16a318'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails::Receiving.get_attachment("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318") ``` **PHP** ```php emails->receiving->getAttachment('4ef9a417-02e9-4d39-ad75-9611e0fcc33c', '2a0c9ce0-3112-4728-976e-47ddcd16a318'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.Receiving.get_attachment("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") data, err := client.Emails.Receiving.GetAttachment("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _bytes = mb.emails.receiving.get_attachment("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318").await?; ``` **Java** ```java import com.senddart.SendDart; SendDart senddart = new SendDart("mb_xxxxxxxxx"); byte[] data = senddart.emails().receiving().getAttachment( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ReceivedEmailGetAttachmentAsync( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "2a0c9ce0-3112-4728-976e-47ddcd16a318"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments/2a0c9ce0-3112-4728-976e-47ddcd16a318' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails receiving attachment 4ef9a417-02e9-4d39-ad75-9611e0fcc33c 2a0c9ce0-3112-4728-976e-47ddcd16a318 ``` ## Errors Returns `not_found` (404) if the received email or the attachment does not exist for your account, or if the attachment bytes were not stored for this email. See the [error reference](https://www.senddart.com/docs/api/errors). --- # Delete Received Email > DELETE /emails/receiving/:id — permanently delete a received email and its stored objects. `DELETE /emails/receiving/:id` Permanently deletes a received email and all of its associated storage objects — the raw `.eml` file and every attachment stored for that email. This action cannot be undone. Requires a **write-scoped** API key. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The id of the received email to delete. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.receiving.remove('4ef9a417-02e9-4d39-ad75-9611e0fcc33c'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails::Receiving.delete("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **PHP** ```php emails->receiving->remove('4ef9a417-02e9-4d39-ad75-9611e0fcc33c'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.Receiving.remove("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Emails.Receiving.Remove("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _removed = mb.emails.receiving.remove("4ef9a417-02e9-4d39-ad75-9611e0fcc33c").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().receiving().remove("4ef9a417-02e9-4d39-ad75-9611e0fcc33c"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ReceivedEmailDeleteAsync("4ef9a417-02e9-4d39-ad75-9611e0fcc33c"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails receiving delete 4ef9a417-02e9-4d39-ad75-9611e0fcc33c ``` ## Response ```json { "object": "received_email", "id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "deleted": true } ``` Returns `not_found` (404) if the received email does not exist for your account. See the [error reference](https://www.senddart.com/docs/api/errors). --- # Mark Received Email Read or Unread > PATCH /emails/receiving/:id — mark a received email as read or unread. `PATCH /emails/receiving/:id` Set the read state of a received email. The dashboard Inbox marks a message read when you open it and shows unread messages — and the domains and inboxes holding them — in bold, exactly like a mail client; use this endpoint to drive the same state from your own tooling (for example, mark a message read once your ticketing system has ingested it, or unread to surface it again). Requires a **write-scoped** API key. > **Note:** Reading a message through [GET /emails/receiving/:id](https://www.senddart.com/docs/api/emails-received-get) never changes its read state. An integration polling for content is not the account owner reading their inbox. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The id of the received email. | **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `read` | boolean | Yes | `true` marks the email read, `false` marks it unread. Marking an already-read email read again is a no-op that keeps the original `read_at`. | **Node.js** ```js const res = await fetch('https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c', { method: 'PATCH', headers: { 'Authorization': 'Bearer mb_xxxxxxxxx', 'Content-Type': 'application/json', }, body: JSON.stringify({ "read": true }), }); const data = await res.json(); console.log(data); ``` **Ruby** ```ruby require 'net/http' require 'uri' uri = URI('https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Patch.new(uri) req['Authorization'] = 'Bearer mb_xxxxxxxxx' req['Content-Type'] = 'application/json' req.body = <<~JSON { "read": true } JSON res = http.request(req) puts res.body ``` **PHP** ```php 'PATCH', CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer mb_xxxxxxxxx', 'User-Agent: my-app/1.0', 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => <<<'JSON' { "read": true } JSON, ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` **Python** ```python import requests res = requests.patch( "https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c", headers={"Authorization": "Bearer mb_xxxxxxxxx", "Content-Type": "application/json"}, json={ "read": true }, ) print(res.json()) ``` **Go** ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, _ := http.NewRequest("PATCH", "https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c", strings.NewReader(`{ "read": true }`)) req.Header.Set("Authorization", "Bearer mb_xxxxxxxxx") req.Header.Set("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(string(out)) } ``` **Rust** ```rust use reqwest::Client; #[tokio::main] async fn main() -> Result<(), Box> { let res = Client::new() .patch("https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c") .header("Authorization", "Bearer mb_xxxxxxxxx") .header("User-Agent", "my-app/1.0") .header("Content-Type", "application/json") .body(r#"{ "read": true }"#) .send() .await?; println!("{}", res.text().await?); Ok(()) } ``` **Java** ```java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; var client = HttpClient.newHttpClient(); var request = HttpRequest.newBuilder() .uri(URI.create("https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c")) .header("Authorization", "Bearer mb_xxxxxxxxx") .header("User-Agent", "my-app/1.0") .header("Content-Type", "application/json") .method("PATCH", HttpRequest.BodyPublishers.ofString(""" { "read": true } """)) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); ``` **.NET** ```csharp using System.Net.Http; using System.Text; var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Patch, "https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c"); request.Headers.Add("Authorization", "Bearer mb_xxxxxxxxx"); request.Headers.Add("User-Agent", "my-app/1.0"); request.Content = new StringContent(@"{ ""read"": true }", Encoding.UTF8, "application/json"); var response = await client.SendAsync(request); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "read": true }' ``` ## Response The updated [received-email object](https://www.senddart.com/docs/api/emails-received-get), with `read` and `read_at` reflecting the new state. ```json { "object": "received_email", "id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "to": ["delivered@yourdomain.com"], "from": "onboarding@example.com", "subject": "Hello World", "read": true, "read_at": "2026-06-24T09:02:17.113Z", "created_at": "2026-06-23T22:13:42.674Z" } ``` ## Errors Returns `validation_error` (422) when the body is not a JSON object with a boolean `read`, and `not_found` (404) if no received email with that id exists for your account. See the [error reference](https://www.senddart.com/docs/api/errors). --- # Download Raw Received Email > GET /emails/receiving/:id/raw — download the original RFC 822 .eml bytes for a received email. `GET /emails/receiving/:id/raw` Downloads the original RFC 822 message bytes for a received email. Unlike most API endpoints, this route does **not** return a JSON object — the response body is the raw `.eml` binary. The response carries: - `Content-Type: message/rfc822` - `Content-Disposition: attachment; filename=".eml"` - `X-Content-Type-Options: nosniff` The SDK method `mb.emails.receiving.getRaw(id)` returns an **`ArrayBuffer`** containing the raw bytes. Parse or save it as a binary file — do not treat it as JSON. Not every received email has stored raw bytes; if the original message was not retained, the endpoint returns `not_found`. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The id of the received email. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.receiving.getRaw('4ef9a417-02e9-4d39-ad75-9611e0fcc33c'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails::Receiving.get_raw("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **PHP** ```php emails->receiving->getRaw('4ef9a417-02e9-4d39-ad75-9611e0fcc33c'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.Receiving.get_raw("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") raw, err := client.Emails.Receiving.GetRaw("4ef9a417-02e9-4d39-ad75-9611e0fcc33c") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _raw = mb.emails.receiving.get_raw("4ef9a417-02e9-4d39-ad75-9611e0fcc33c").await?; ``` **Java** ```java import com.senddart.SendDart; SendDart senddart = new SendDart("mb_xxxxxxxxx"); byte[] data = senddart.emails().receiving().getRaw("4ef9a417-02e9-4d39-ad75-9611e0fcc33c"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ReceivedEmailGetRawAsync("4ef9a417-02e9-4d39-ad75-9611e0fcc33c"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/raw' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails receiving raw 4ef9a417-02e9-4d39-ad75-9611e0fcc33c ``` ## Response On success the response body is the raw RFC 822 message bytes (binary, not JSON). Save or stream the body as a `.eml` file. ```bash HTTP/1.1 200 OK Content-Type: message/rfc822 Content-Disposition: attachment; filename="4ef9a417-02e9-4d39-ad75-9611e0fcc33c.eml" X-Content-Type-Options: nosniff ``` Returns `not_found` (404) if the received email does not exist for your account, or if no raw message was stored for it. See the [error reference](https://www.senddart.com/docs/api/errors). --- # Forward Received Email > POST /emails/receiving/:id/forward — forward a received email (with its attachments) to another address. `POST /emails/receiving/:id/forward` Forwards a received email to another address through the normal send pipeline. The original subject, body, and attachments are re-sent (inline images keep their `content_id` so they still render). `from` must be an address on one of your verified domains — it is validated exactly like [POST /emails](https://www.senddart.com/docs/api/emails-send). **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The id of the received email to forward. | **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `to` | string | string[] | Yes | The address(es) to forward to. | | `from` | string | Yes | A verified sending address. | | `subject` | string | No | Optional; overrides the original subject. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.receiving.forward('4ef9a417-02e9-4d39-ad75-9611e0fcc33c', { "to": "delivered@test.senddart.com", "from": "Acme " }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails::Receiving.forward("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", { "to": "delivered@test.senddart.com", "from": "Acme " }) ``` **PHP** ```php emails->receiving->forward('4ef9a417-02e9-4d39-ad75-9611e0fcc33c', [ 'to' => "delivered@test.senddart.com", 'from' => "Acme " ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.Receiving.forward("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", { "to": "delivered@test.senddart.com", "from": "Acme " }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") forwarded, err := client.Emails.Receiving.Forward("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", &senddart.ForwardReceivedEmailRequest{ To: []string{"delivered@test.senddart.com"}, From: "Acme ", }) ``` **Rust** ```rust use senddart::{ForwardReceivedEmailOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = ForwardReceivedEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], ); let _forwarded = mb.emails.receiving.forward("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.ForwardEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); ForwardEmailRequest request = ForwardEmailRequest.builder() .to("delivered@test.senddart.com") .from("Acme ") .build(); SendDartResponse response = senddart.emails().receiving().forward( "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ReceivedEmailForwardAsync("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", new ReceivedEmailForwardOptions { To = "delivered@test.senddart.com", From = "Acme ", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/forward' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "to": "delivered@test.senddart.com", "from": "Acme " }' ``` **CLI** ```bash senddart emails receiving forward 4ef9a417-02e9-4d39-ad75-9611e0fcc33c \ --to 'delivered@test.senddart.com' \ --from 'Acme ' ``` ## Response ```json { "object": "email", "id": "6278820d-2421-42d0-85f0-80e9e28c1c69" } ``` The response is the outbound email's id — the forward is sent like any other email and shows up in your sent mail and logs. Attachments whose bytes were not retained (e.g. inbound storage was off when the mail arrived) are skipped rather than failing the forward. Returns `not_found` (404) if the received email does not exist for your account, and `missing_required_field` (422) when `to` or `from` is omitted. See the [error reference](https://www.senddart.com/docs/api/errors). --- # Reply to Received Email > POST /emails/receiving/:id/reply — threaded reply to the sender; plus AI reply intent. `POST /emails/receiving/:id/reply` Sends a reply to the received email's sender, threaded into the same conversation (In-Reply-To the received Message-ID; subject defaults to `Re: …`). `from` must be an address on one of your verified domains. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `from` | string | Yes | A verified sending address. | | `html` | string | No | Reply body (or `text`). | | `text` | string | No | Plain-text body (or `html`). | | `subject` | string | No | Optional; defaults to `Re: `. | | `attachments` | array | No | Optional files to send with the reply — same shape and limits as [POST /emails](https://www.senddart.com/docs/api/emails-send): `{ filename, content (base64) | path (URL), content_type?, content_id? }`, 25MB per file / 40MB total. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.receiving.reply('56761188-7520-42d8-8898-ff6fc54ce618', { "from": "Acme ", "html": "

Thanks — on it!

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails::Receiving.reply("56761188-7520-42d8-8898-ff6fc54ce618", { "from": "Acme ", "html": "

Thanks — on it!

" }) ``` **PHP** ```php emails->receiving->reply('56761188-7520-42d8-8898-ff6fc54ce618', [ 'from' => "Acme ", 'html' => "

Thanks — on it!

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.Receiving.reply("56761188-7520-42d8-8898-ff6fc54ce618", { "from": "Acme ", "html": "

Thanks — on it!

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") replied, err := client.Emails.Receiving.Reply("56761188-7520-42d8-8898-ff6fc54ce618", &senddart.ReplyReceivedEmailRequest{ From: "Acme ", Html: "

Thanks — on it!

", }) ``` **Rust** ```rust use senddart::{ReplyReceivedEmailOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = ReplyReceivedEmailOptions::new("Acme ") .with_html("

Thanks — on it!

"); let _replied = mb.emails.receiving.reply("56761188-7520-42d8-8898-ff6fc54ce618", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.ReplyEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); ReplyEmailRequest request = ReplyEmailRequest.builder() .from("Acme ") .html("

Thanks — on it!

") .build(); SendDartResponse response = senddart.emails().receiving().reply( "56761188-7520-42d8-8898-ff6fc54ce618", request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ReceivedEmailReplyAsync("56761188-7520-42d8-8898-ff6fc54ce618", new ReceivedEmailReplyOptions { From = "Acme ", HtmlBody = "

Thanks — on it!

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails/receiving/56761188-7520-42d8-8898-ff6fc54ce618/reply' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "html": "

Thanks — on it!

" }' ``` **CLI** ```bash senddart emails receiving reply 56761188-7520-42d8-8898-ff6fc54ce618 \ --from 'Acme ' \ --html '

Thanks — on it!

' ``` ### Response ```json { "object": "email", "id": "6278820d-2421-42d0-85f0-80e9e28c1c69" } ``` The response is the outbound email's id — the reply is sent like any other email and shows up in your sent mail and logs. Provide `html` or `text` (or both); omitting both — or omitting `from` — returns a `422 missing_required_field`. The recipient is derived from the received email's `Reply-To` header (falling back to its `From`). See [Errors](https://www.senddart.com/docs/api/errors). ## AI reply intent Inbound replies are automatically classified as `interested`, `neutral`, or `not_interested` (surfaced as `category` on received emails and as a badge in the dashboard). Classification uses your configured AI model, with a built-in fallback — it never delays ingestion. --- # List Logs > GET /logs — list the API request logs for your account. `GET /logs` List the API request logs for your account. Each entry records a request made with one of your API keys — the `endpoint`, `method`, `response_status`, and originating `user_agent`. Use a log's `id` to fetch the full request and response bodies with [GET /logs/:id](https://www.senddart.com/docs/api/logs-get). > **Note:** This endpoint is always paginated. See [Pagination](https://www.senddart.com/docs/api/pagination) for navigating with `limit`, `after`, and `before`. ## Query parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of logs to retrieve per page. Default `20`, maximum `100`, minimum `1`. | | `after` | string | No | The log `id` **after** which more logs are retrieved. The passed id is not included. Cannot be combined with `before`. | | `before` | string | No | The log `id` **before** which more logs are retrieved. The passed id is not included. Cannot be combined with `after`. | | `method` | string | No | Filter to an exact HTTP method, e.g. `POST` or `GET`. | | `status` | number | No | Filter to an exact HTTP response status code, e.g. `200` or `429`. | ## Response fields Each item in `data` is a log reference: | Name | Type | Required | Description | | --- | --- | --- | --- | | `object` | string | No | Always `log`. | | `id` | string | No | The log id — a numeric string (e.g. `"48213"`), not a UUID. Use it verbatim as an `after`/`before` cursor. | | `created_at` | string | No | When the request was made. | | `endpoint` | string | No | The request path, including the `/api` base (e.g. `/api/emails`). | | `method` | string | No | The HTTP method (e.g. `POST`). | | `response_status` | number | No | The HTTP status code returned. | | `user_agent` | string | No | The `User-Agent` of the caller. | ## Request **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.logs.list(); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Logs.list ``` **PHP** ```php logs->list(); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Logs.list() ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") logs, err := client.Logs.List(nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _logs = mb.logs.list(None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.logs().list(); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.LogListAsync(); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/logs' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart logs list ``` ## Response ```json { "object": "list", "has_more": false, "data": [ { "object": "log", "id": "48213", "created_at": "2026-06-23T13:43:54.622Z", "endpoint": "/api/emails", "method": "POST", "response_status": 200, "user_agent": "curl/8.7.1" }, { "object": "log", "id": "48212", "created_at": "2026-06-23T12:15:00.123Z", "endpoint": "/api/emails/4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "method": "GET", "response_status": 200, "user_agent": "python-requests/2.31.0" } ] } ``` ## Errors Returns `validation_error` if `limit` is outside 1–100 or if both `before` and `after` are supplied. A malformed or unknown cursor is **not** an error — it returns an empty page (`data: []`, `has_more: false`). See the [error reference](https://www.senddart.com/docs/api/errors). --- # Retrieve Log > GET /logs/:id — fetch a single API request log with its request and response bodies. `GET /logs/:id` Retrieve a single API request log by id, including the captured `request_body` and `response_body`. The shape of those two fields varies depending on the original request that was logged. ## Path parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The log id — a numeric string (e.g. `48213`), as returned by [GET /logs](https://www.senddart.com/docs/api/logs-list). | ## Response fields | Name | Type | Required | Description | | --- | --- | --- | --- | | `object` | string | No | Always `log`. | | `id` | string | No | The log id — a numeric string (e.g. `"48213"`), not a UUID. | | `created_at` | string | No | When the request was made. | | `endpoint` | string | No | The request path. | | `method` | string | No | The HTTP method. | | `response_status` | number | No | The HTTP status code returned. | | `user_agent` | string | No | The `User-Agent` of the caller. | | `request_body` | object | No | The captured request body. Shape varies by the logged request. | | `response_body` | object | No | The captured response body. Shape varies by the logged request. | ## Request **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.logs.get('48213'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Logs.get("48213") ``` **PHP** ```php logs->get('48213'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Logs.get("48213") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") entry, err := client.Logs.Get("48213") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _entry = mb.logs.get("48213").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.logs().get("48213"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.LogRetrieveAsync("48213"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/logs/48213' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart logs get 48213 ``` ## Response ```json { "object": "log", "id": "48213", "created_at": "2026-06-23T13:43:54.622Z", "endpoint": "/api/emails", "method": "POST", "response_status": 200, "user_agent": "curl/8.7.1", "request_body": { "from": "Acme ", "to": ["delivered@example.com"], "subject": "Hello World" }, "response_body": { "id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" } } ``` ## Errors Returns `not_found` (404) if no log with that id exists for your account. See the [error reference](https://www.senddart.com/docs/api/errors). --- # Pagination > How cursor-based pagination works across SendDart list endpoints: limit, after, before, and has_more. Several SendDart list endpoints support **cursor-based pagination** so you can browse large datasets reliably. Because the cursor is an object `id` rather than an offset, paging stays stable even when records are created or deleted while you are still requesting pages. ## Response shape Every paginated response is a `list` object with these fields: | Name | Type | Required | Description | | --- | --- | --- | --- | | `object` | string | No | Always `list` for a paginated response. | | `has_more` | boolean | No | Whether more items exist beyond the current page. | | `data` | array | No | The items for the current page. | ```json { "object": "list", "has_more": true, "data": [ { "id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c", "subject": "Hello World" }, { "id": "3a9f8c2b-1e5d-4f8a-9c7b-2d6e5f8a9c7b", "subject": "Welcome aboard" } ] } ``` ## Parameters Navigate the results with these query parameters. Use an object's `id` as the cursor — the cursor itself is always **excluded** from the returned page. | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Items to return per page. Default `20`, maximum `100`, minimum `1`. | | `after` | string | No | Return the page that **starts after** the object with this id (the next page). Use the id of the last item on the current page. | | `before` | string | No | Return the page that **ends before** the object with this id (the previous page). Use the id of the first item on the current page. | > **Warning:** You can use either `after` or `before`, but not both in the same request. ## Optional vs. always-paginated For older list endpoints the `limit` parameter is **optional** — omit it and up to 1,000 items are returned in a single response (`has_more` reports the truncation), for example: - [List Received Emails](https://www.senddart.com/docs/api/emails-received-list) — `GET /emails/receiving` (capped at 1,000 per response; `has_more` tells you when to keep paging) - [List Received Attachments](https://www.senddart.com/docs/api/emails-received-list-attachments) — `GET /emails/receiving/:id/attachments` One list endpoint is not paginated at all: [List Attachments](https://www.senddart.com/docs/api/emails-list-attachments) — `GET /emails/:id/attachments` — reads no pagination parameters, always returns every attachment on the email, and always reports `has_more: false`. A sent email carries a handful of attachments, so there is nothing to page through. Newer list endpoints are **always paginated** — they return at most `limit` items per page, defaulting to `20` even when you do not send `limit`: - [List Sent Emails](https://www.senddart.com/docs/api/emails-list) — `GET /emails` - [List Logs](https://www.senddart.com/docs/api/logs-list) — `GET /logs` - [List Audiences](https://www.senddart.com/docs/api/audiences-list) — `GET /audiences` - [List Templates](https://www.senddart.com/docs/api/templates-list) — `GET /templates` - [List Automations](https://www.senddart.com/docs/api/automations-list) — `GET /automations` - [List Automation Runs](https://www.senddart.com/docs/api/automations-list-runs) — `GET /automations/:id/runs` - [List Webhooks](https://www.senddart.com/docs/api/webhooks-list) — `GET /webhooks` - [List Event Definitions](https://www.senddart.com/docs/api/events-list) — `GET /events` ## Forward pagination To page forward (newer to older), take the `id` of the **last item** on the current page and pass it as `after`. Stop when `has_more` is `false`. **cURL** ```bash # First page curl -X GET 'https://www.senddart.com/api/emails?limit=50' \ -H 'Authorization: Bearer mb_xxxxxxxxx' # Next page — pass the id of the last item from the previous page curl -X GET 'https://www.senddart.com/api/emails?limit=50&after=LAST_ID_FROM_PREVIOUS_PAGE' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); // First page const { data: firstPage } = await mb.emails.list({ limit: 50 }); // Next page (if there is one) — pass the id of the last item as `after` if (firstPage.has_more) { const lastId = firstPage.data[firstPage.data.length - 1].id; const { data: secondPage } = await mb.emails.list({ limit: 50, after: lastId }); } ``` **Python** ```python import requests auth = {"Authorization": "Bearer mb_xxxxxxxxx"} # First page first_page = requests.get("https://www.senddart.com/api/emails", params={"limit": 50}, headers=auth).json() # Next page (if there is one) if first_page["has_more"]: last_id = first_page["data"][-1]["id"] second_page = requests.get( "https://www.senddart.com/api/emails", params={"limit": 50, "after": last_id}, headers=auth, ).json() ``` ## Backward pagination To page backward (older to newer), take the `id` of the **first item** on the current page and pass it as `before`. ```bash curl -X GET 'https://www.senddart.com/api/emails?limit=50&before=FIRST_ID_FROM_CURRENT_PAGE' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` ## Best practices - Always check `has_more` before fetching another page — it tells you when you have reached the end. - Pick a `limit` that fits your workload: small pages for interactive UIs, larger pages (up to 100) for bulk processing. - Mind [rate limits](https://www.senddart.com/docs/api/introduction) when paging through large datasets — add backoff between pages if needed. ## Errors Pagination requests return `validation_error` (422) if the cursor format is invalid, if `limit` is outside 1–100, or if both `before` and `after` are supplied. See the [error reference](https://www.senddart.com/docs/api/errors). --- # Batch Delivery Modes > How POST /emails/batch decides between sending inline (200) and queueing for background delivery (202). `POST /emails/batch` A [batch send](https://www.senddart.com/docs/api/emails-batch) is answered one of two ways, chosen by the **size of the batch**. Small batches are sent while your request is open and return `200`, exactly as they always have. Larger batches are accepted, queued, and returned `202 Accepted` — the emails are then delivered in the background. Both modes return the same `data` array of created email ids, in request order, so the ids are available immediately either way. ## The boundary | batch size | status | meaning | | --- | --- | --- | | 1–40 | `200 OK` | Every email was handed to the mail service before the response. Unchanged behaviour. | | 41–100 | `202 Accepted` | Every email was accepted and queued. Delivery happens in the background, normally within minutes; a full 100-email batch typically finishes in about ten. | The boundary is 40 because that is the largest batch that reliably completes inside a single request. Each email in an inline batch is a full send — a chain of database round trips plus the handoff to the mail service, about two seconds each — so 40 emails take roughly 97 seconds of the 120 available. A 100-email batch would need about 168 seconds, which is why it is queued instead of being sent until the request runs out of time. > **Note:** One exception: a batch containing a [reserved test recipient](https://www.senddart.com/docs/emails/send-test) (`@test.senddart.com`) is always sent inline, whatever its size, because those addresses are simulated rather than transmitted. ## The 202 response ```json { "data": [ { "id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" }, { "id": "3a9f8c2b-1e5d-4f8a-9c7b-2d6e5f8a9c7b" } ], "queued": true, "queued_count": 100 } ``` | Name | Type | Required | Description | | --- | --- | --- | --- | | `data` | object[] | No | One `{ id }` per email, in the order you submitted them. Same field as the `200` response. | | `queued` | boolean | No | Present and `true` only on a queued (`202`) batch. Absent on an inline `200`. | | `queued_count` | number | No | How many emails were queued. Always equal to the length of `data`. | If your client only reads `data`, no change is needed — every SendDart SDK treats `202` as success and returns the same ids. Branch on `queued` if you want to know which mode you got. ## Following a queued batch Each queued email is a normal email object from the moment you get the `202`. There is no separate batch resource to poll — use the ids you were given: - [GET /emails/:id](https://www.senddart.com/docs/api/emails-get) — the current `status` and event log for one email. - [GET /emails](https://www.senddart.com/docs/api/emails-list) — page through them, optionally filtered with `status`. - [POST /emails/:id/cancel](https://www.senddart.com/docs/api/emails-cancel) — cancel one that has not been sent yet. A queued email starts at `scheduled` and moves to `sent` (then `delivered`, `bounced`, and so on as events arrive) or to `failed` with an `error` explaining why. Webhooks behave exactly as they do for any other send: you receive `email.sent`, `email.delivered`, `email.bounced`, `email.failed`, and `email.suppressed` as they happen. A queued batch does **not** emit `email.scheduled` — you did not schedule it, and the `202` is your receipt. ## What is checked when Anything whose answer cannot change between accepting the batch and sending it is checked **before** the `202`, so you hear about it synchronously. Anything that can change is re-checked at send time, per email — which is also how [scheduled sends](https://www.senddart.com/docs/emails/schedule) have always worked. | checked | when | what you see | | --- | --- | --- | | Payload validation of every item | before the `202` | The whole batch is rejected and nothing is queued. | | API key domain scope | before the `202` | `restricted_api_key`, nothing queued. | | From-domain is verified | before the `202` | `validation_error`, nothing queued. | | `topic_id` exists | before the `202` | `validation_error`, nothing queued. | | Plan domain allowance | before the `202` | `plan_limit_reached` (402), nothing queued. | | Sending quota and credits | at send time, per email | Emails over your limit stay `scheduled` and retry hourly, rather than the batch being rejected. | | Suppression list and topic opt-outs | at send time, per email | That email becomes `failed` with the reason; the rest still send. | | Sending reputation and warm-up | at send time, per email | That email stays `scheduled` and is retried after the stated window. | > **Warning:** Quota is consumed when each email is actually sent, not when the batch is accepted. If a batch exceeds your remaining daily allowance, the emails that fit go out and the rest wait — they retry hourly for up to three days and then fail with a quota reason. Check your [limits](https://www.senddart.com/docs/api/limits) before queueing a batch you know is near the cap, or split it across days. ## Retrying safely Pass an `Idempotency-Key` and the whole answer — including a `202` and its ids — is recorded against that key. Retrying with the same key replays the recorded response and queues nothing more, so a batch can never be enqueued twice. The queueing itself is atomic: the emails, their delivery jobs and the recorded answer are written in one transaction, so a request that is cut off part-way through leaves nothing behind and can simply be retried. See [Idempotency keys](https://www.senddart.com/docs/emails/idempotency). ## When an inline batch runs out of time An inline batch (40 or fewer) that has not finished when its time budget expires stops itself rather than being cut off, and reports exactly what went out: ```json { "statusCode": 503, "name": "batch_incomplete", "message": "Only 34 of 40 emails were sent before this request ran out of time. …", "sent": [{ "id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c" }], "sent_count": 34 } ``` The emails in `sent` **were** sent; the remainder were not. Resend only the remainder, with a new `Idempotency-Key`. The same `sent`/`sent_count` fields appear when an inline batch fails part-way through for any other reason (a quota or reputation limit reached mid-batch, for example). > **Warning:** The status of a partial result depends on whether you supplied an `Idempotency-Key`. With a key it is `503` with `Retry-After`, because retrying that key replays the recorded answer and re-sends nothing. **Without** a key the same name and body are returned as `422` and no `Retry-After` is set — the SDKs retry `503` and `429` automatically, and an automatic retry of an unrecorded partial batch would re-send the emails that already went out. ## Client timeouts Every SendDart SDK defaults to a 30-second per-request timeout, which is shorter than a large inline batch takes. A queued (`202`) batch answers in about two seconds and is unaffected. If you deliberately send inline batches near the boundary, raise your client timeout — a client that gives up mid-request cannot tell what was sent, and retrying without an `Idempotency-Key` risks duplicates. ## Errors See the [error reference](https://www.senddart.com/docs/api/errors). `batch_incomplete` is specific to this endpoint; every other name a batch can return is shared with [POST /emails](https://www.senddart.com/docs/api/emails-send). --- # Claim Domain > POST /domains/claim — claim a domain that is already verified by another account. `POST /domains/claim` Claims a domain that is already verified by **another SendDart account**. Use this when [creating a domain](https://www.senddart.com/docs/api/domains-create) fails because the domain is already in use elsewhere. SendDart creates a placeholder domain on your account and returns a `domain_claim` object with a single TXT `record` to publish at your DNS provider. After publishing it, call [Verify Domain Claim](https://www.senddart.com/docs/api/domains-verify-claim) and poll [Get Domain Claim](https://www.senddart.com/docs/api/domains-get-claim) to follow the `status`. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | Yes | The name of the domain you want to claim, e.g. `yourdomain.com`. | | `region` | string | No | Optional. When supplied it must be an available region — `us-east-1` or `ap-south-1`. Any other value, including a region listed as coming soon, returns a `validation_error` (422); this endpoint does not fall back to the default. Omit it to use the default region. See [Choosing a region](https://www.senddart.com/docs/domains/region). | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.domains.claim({ "name": "yourdomain.com" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Domains.claim({ "name": "yourdomain.com" }) ``` **PHP** ```php domains->claim([ 'name' => "yourdomain.com" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Domains.claim({ "name": "yourdomain.com" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") claim, err := client.Domains.Claim(&senddart.ClaimDomainRequest{ Name: "yourdomain.com", }) ``` **Rust** ```rust use senddart::{ClaimDomainOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let _claim = mb.domains.claim(ClaimDomainOptions::new("yourdomain.com")).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.ClaimDomainRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.domains().claim(ClaimDomainRequest.builder().name("yourdomain.com").build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.DomainClaimAsync(new DomainClaimOptions { Name = "yourdomain.com" }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/domains/claim' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "yourdomain.com" }' ``` **CLI** ```bash senddart domains claim start yourdomain.com ``` ### Response The `domain_claim` object. The `domain_id` is the placeholder domain id — use it for the get and verify calls below. ```json { "object": "domain_claim", "id": "dacf4072-4119-4d88-932f-6c6126d3a9d1", "name": "yourdomain.com", "status": "pending", "domain_id": "d91cd9bd-1176-453e-8fc1-35364d380206", "region": "us-east-1", "record": { "type": "TXT", "name": "yourdomain.com", "value": "senddart-domain-verification=3f8a1c2d4e5b6a7f8091a2b3c4d5e6f7", "ttl": "Auto" }, "blocked_reason": null, "failure_reason": null, "created_at": "2026-06-16T17:12:02.059Z", "expires_at": "2026-06-23T17:12:02.059Z" } ``` > **Note:** The claim `expires_at` roughly a week after creation. Publish the TXT record and verify before then, or start a new claim. Errors: `missing_required_field` (422) if `name` is absent; `validation_error` (422) if `name` is not a valid domain, the domain already exists on your account, or `region` is not an available region; `plan_limit_reached` (402) when your account is already at its plan's domain limit — the body carries `kind: "domains"` with `used`, `limit`, `requested` and `next_plan`. See [Errors](https://www.senddart.com/docs/api/errors). --- # Get Domain Claim > GET /domains/:domain_id/claim — retrieve the latest claim for a domain. `GET /domains/:domain_id/claim` Retrieves the latest claim for a domain. Poll this endpoint to follow a claim’s `status` after you [start a claim](https://www.senddart.com/docs/api/domains-claim). The `:domain_id` is the **placeholder domain id** returned in the `domain_claim` object. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `domain_id` | string | Yes | The placeholder domain id returned when the claim was created. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.domains.getClaim('d91cd9bd-1176-453e-8fc1-35364d380206'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Domains.get_claim("d91cd9bd-1176-453e-8fc1-35364d380206") ``` **PHP** ```php domains->getClaim('d91cd9bd-1176-453e-8fc1-35364d380206'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Domains.get_claim("d91cd9bd-1176-453e-8fc1-35364d380206") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") claim, err := client.Domains.GetClaim("d91cd9bd-1176-453e-8fc1-35364d380206") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _claim = mb.domains.get_claim("d91cd9bd-1176-453e-8fc1-35364d380206").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.domains().getClaim("d91cd9bd-1176-453e-8fc1-35364d380206"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.DomainRetrieveClaimAsync("d91cd9bd-1176-453e-8fc1-35364d380206"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/domains/d91cd9bd-1176-453e-8fc1-35364d380206/claim' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart domains claim get d91cd9bd-1176-453e-8fc1-35364d380206 ``` ### Response ```json { "object": "domain_claim", "id": "dacf4072-4119-4d88-932f-6c6126d3a9d1", "name": "yourdomain.com", "status": "pending", "domain_id": "d91cd9bd-1176-453e-8fc1-35364d380206", "region": "us-east-1", "record": { "type": "TXT", "name": "yourdomain.com", "value": "senddart-domain-verification=3f8a1c2d4e5b6a7f8091a2b3c4d5e6f7", "ttl": "Auto" }, "blocked_reason": null, "failure_reason": null, "created_at": "2026-06-16T17:12:02.059Z", "expires_at": "2026-06-23T17:12:02.059Z" } ``` Errors: `not_found` if no claim exists for that domain id or it is not yours. See [Errors](https://www.senddart.com/docs/api/errors). --- # Verify Domain Claim > POST /domains/:domain_id/claim/verify — trigger DNS verification for a domain claim. `POST /domains/:domain_id/claim/verify` Starts an **asynchronous verification process** for a domain claim. SendDart checks the claim’s TXT record and, once it resolves, transfers the domain to your account. Add the TXT record returned by [Claim Domain](https://www.senddart.com/docs/api/domains-claim) before calling this, then poll [Get Domain Claim](https://www.senddart.com/docs/api/domains-get-claim) to follow the `status`. > **Note:** After the claim completes, the domain is transferred to your account as a **brand-new domain with its own DKIM keys** — the previous account’s DNS records can’t be reused. Fetch it with [Retrieve a domain](https://www.senddart.com/docs/api/domains-get), publish the new DKIM record(s), then run [Verify a domain](https://www.senddart.com/docs/api/domains-verify) to finish setup before sending. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `domain_id` | string | Yes | The placeholder domain id returned when the claim was created. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.domains.verifyClaim('d91cd9bd-1176-453e-8fc1-35364d380206'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Domains.verify_claim("d91cd9bd-1176-453e-8fc1-35364d380206") ``` **PHP** ```php domains->verifyClaim('d91cd9bd-1176-453e-8fc1-35364d380206'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Domains.verify_claim("d91cd9bd-1176-453e-8fc1-35364d380206") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") claim, err := client.Domains.VerifyClaim("d91cd9bd-1176-453e-8fc1-35364d380206") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _claim = mb.domains.verify_claim("d91cd9bd-1176-453e-8fc1-35364d380206").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.domains().verifyClaim("d91cd9bd-1176-453e-8fc1-35364d380206"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.DomainVerifyClaimAsync("d91cd9bd-1176-453e-8fc1-35364d380206"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/domains/d91cd9bd-1176-453e-8fc1-35364d380206/claim/verify' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart domains claim verify d91cd9bd-1176-453e-8fc1-35364d380206 ``` ### Response ```json { "object": "domain_claim", "id": "dacf4072-4119-4d88-932f-6c6126d3a9d1", "name": "yourdomain.com", "status": "pending", "domain_id": "d91cd9bd-1176-453e-8fc1-35364d380206", "region": "us-east-1", "record": { "type": "TXT", "name": "yourdomain.com", "value": "senddart-domain-verification=3f8a1c2d4e5b6a7f8091a2b3c4d5e6f7", "ttl": "Auto" }, "blocked_reason": null, "failure_reason": null, "created_at": "2026-06-16T17:12:02.059Z", "expires_at": "2026-06-23T17:12:02.059Z" } ``` Errors: `not_found` if the claim does not exist or is not yours, and `plan_limit_reached` (402) when completing the claim would exceed your plan's domain limit — the claim stays `pending` and never flips until you upgrade, so handle this status explicitly instead of polling forever. See [Errors](https://www.senddart.com/docs/api/errors). --- # Create Webhook > POST /webhooks — create a webhook to receive real-time notifications about email events. `POST /webhooks` Creates a webhook. SendDart POSTs an event payload to your `endpoint` URL whenever one of the subscribed `events` occurs. The response includes a `signing_secret` — store it and use it to verify the signature on every incoming request. See [Webhooks](https://www.senddart.com/docs/webhooks/overview). **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `endpoint` | string | Yes | The HTTPS URL where webhook events will be sent. | | `events` | string[] | Yes | Array of event types to subscribe to. See the table below. | | `secret` | string | No | Optional. Provide your own signing secret (e.g. to mirror a secret across providers). When omitted, SendDart mints a fresh `whsec_…` secret. Either way the plaintext is returned once in this response and never again. | **Event types** | Name | Type | Required | Description | | --- | --- | --- | --- | | `email.sent` | enum | No | SendDart accepted the email and queued it for delivery. | | `email.delivered` | enum | No | The receiving server accepted the message. | | `email.delivery_delayed` | enum | No | Delivery was temporarily deferred and SendDart is retrying. | | `email.bounced` | enum | No | The message could not be delivered (hard rejection). | | `email.complained` | enum | No | The recipient marked the message as spam. | | `email.opened` | enum | No | The recipient’s mail client loaded the tracking pixel (requires open tracking). | | `email.clicked` | enum | No | The recipient clicked a tracked link (requires click tracking). | | `email.failed` | enum | No | The email could not be sent (e.g. invalid recipient, quota reached). | | `email.scheduled` | enum | No | The email was accepted for future delivery with a `scheduled_at` time. | | `email.suppressed` | enum | No | The send was skipped because the recipient is on the account suppression list. | | `email.received` | enum | No | An inbound email arrived at one of your verified receiving domains. | | `email.replied` | enum | No | A reply to one of your sent emails was detected. | | `email.unsubscribed` | enum | No | A recipient unsubscribed via an unsubscribe link or header. | | `contact.created` | enum | No | A contact was created in one of your audiences. | | `contact.updated` | enum | No | A contact was updated. | | `contact.deleted` | enum | No | A contact was deleted. | | `domain.created` | enum | No | A domain was added to your account. | | `domain.updated` | enum | No | A domain’s settings or verification status changed. | | `domain.deleted` | enum | No | A domain was removed from your account. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.webhooks.create({ "endpoint": "https://example.com/handler", "events": ["email.sent", "email.delivered"] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Webhooks.create({ "endpoint": "https://example.com/handler", "events": [ "email.sent", "email.delivered" ] }) ``` **PHP** ```php webhooks->create([ 'endpoint' => "https://example.com/handler", 'events' => [ "email.sent", "email.delivered" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Webhooks.create({ "endpoint": "https://example.com/handler", "events": [ "email.sent", "email.delivered" ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") webhook, err := client.Webhooks.Create(&senddart.CreateWebhookRequest{ Endpoint: "https://example.com/handler", Events: []string{"email.sent", "email.delivered"}, }) ``` **Rust** ```rust use senddart::{CreateWebhookOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateWebhookOptions::new( "https://example.com/handler", ["email.sent", "email.delivered"], ); let _webhook = mb.webhooks.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateWebhookRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateWebhookRequest request = CreateWebhookRequest.builder() .endpoint("https://example.com/handler") .events("email.sent", "email.delivered") .build(); SendDartResponse response = senddart.webhooks().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.WebhookCreateAsync(new WebhookCreateOptions { Endpoint = "https://example.com/handler", Events = new List { "email.sent", "email.delivered" }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/webhooks' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "endpoint": "https://example.com/handler", "events": ["email.sent", "email.delivered"] }' ``` **CLI** ```bash senddart webhooks create \ --endpoint 'https://example.com/handler' \ --events 'email.sent,email.delivered' ``` ### Response ```json { "object": "webhook", "id": "17", "signing_secret": "whsec_xxxxxxxxxx" } ``` > **Warning:** The `signing_secret` is only returned here, at creation. Store it securely — it cannot be retrieved again later. --- # Rotate Webhook Secret > POST /webhooks/:id/rotate — replace the signing secret for a webhook. `POST /webhooks/:id/rotate` Rotates the signing secret for a webhook, invalidating the old secret immediately. Use this if your current secret has been compromised or as part of a regular credential rotation policy. The new plaintext secret is returned **once** in this response — store it securely before the request completes. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The webhook id as returned by [Create Webhook](https://www.senddart.com/docs/api/webhooks-create) or [List Webhooks](https://www.senddart.com/docs/api/webhooks-list) — a numeric string (e.g. `17`), not a UUID. A non-numeric id returns `not_found` (404). | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.webhooks.rotate('17'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Webhooks.rotate("17") ``` **PHP** ```php webhooks->rotate('17'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Webhooks.rotate("17") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") rotated, err := client.Webhooks.Rotate("17") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _rotated = mb.webhooks.rotate("17").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.webhooks().rotate("17"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.WebhookRotateAsync("17"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/webhooks/17/rotate' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart webhooks rotate 17 ``` ### Response ```json { "object": "webhook", "id": "17", "signing_secret": "whsec_xxxxxxxxxx" } ``` > **Warning:** The new `signing_secret` is only returned here, at rotation. The old secret stops working immediately. Store the new value securely — it cannot be retrieved again. --- # Test Webhook > POST /webhooks/:id/test — send a test event to a webhook endpoint. `POST /webhooks/:id/test` Sends a synchronous test delivery to the webhook's `endpoint`. SendDart fires a `test` event regardless of the webhook's subscribed event types and returns the live result — including the HTTP status your endpoint responded with. No retry is queued on failure, and a test never affects the endpoint's health (its `failure_count`, last-delivery status, or the 50-failure auto-disable) — it is recorded in the delivery history only. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The webhook id as returned by [Create Webhook](https://www.senddart.com/docs/api/webhooks-create) or [List Webhooks](https://www.senddart.com/docs/api/webhooks-list) — a numeric string (e.g. `17`), not a UUID. A non-numeric id returns `not_found` (404). | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.webhooks.test('17'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Webhooks.test("17") ``` **PHP** ```php webhooks->test('17'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Webhooks.test("17") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") result, err := client.Webhooks.Test("17") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _result = mb.webhooks.test("17").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.webhooks().test("17"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.WebhookTestAsync("17"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/webhooks/17/test' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart webhooks test 17 ``` ### Response Returns a `webhook_test` object. `ok` is `true` when your endpoint responded with a 2xx status. `status` is the HTTP status code your endpoint returned. `error` is present only when delivery failed (network error or non-2xx response). ```json { "object": "webhook_test", "id": "17", "ok": true, "status": 200 } ``` > **Note:** A failed test — e.g. `"ok": false, "status": 404, "error": "HTTP 404"` — means your endpoint is reachable but returned a non-2xx response. Check your server logs and ensure the endpoint accepts `POST` requests with a `Content-Type: application/json` body. --- # Retrieve Webhook > GET /webhooks/:id — retrieve a single webhook. `GET /webhooks/:id` Retrieves a single webhook by id, including its `status`, `endpoint`, subscribed `events`, and delivery-health fields. The `signing_secret` is **never** returned on retrieval — it is only shown once, at creation or rotation. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The webhook id as returned by [Create Webhook](https://www.senddart.com/docs/api/webhooks-create) or [List Webhooks](https://www.senddart.com/docs/api/webhooks-list) — a numeric string (e.g. `17`), not a UUID. A non-numeric id returns `not_found` (404). | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.webhooks.get('17'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Webhooks.get("17") ``` **PHP** ```php webhooks->get('17'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Webhooks.get("17") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") webhook, err := client.Webhooks.Get("17") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _webhook = mb.webhooks.get("17").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.webhooks().get("17"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.WebhookRetrieveAsync("17"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/webhooks/17' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart webhooks get 17 ``` ### Response ```json { "object": "webhook", "id": "17", "created_at": "2026-06-22T15:28:00.000Z", "status": "enabled", "endpoint": "https://example.com/handler", "events": ["email.sent"], "has_secret": true, "last_delivery_at": "2026-06-27T10:00:00.000Z", "last_delivery_status": 200, "failure_count": 0 } ``` Errors: `not_found` if the webhook does not exist or is not yours. See [Errors](https://www.senddart.com/docs/api/errors). --- # List Webhooks > GET /webhooks — list every webhook on your account. `GET /webhooks` Lists the webhooks on your account. This endpoint is always paginated: `limit` defaults to `20` (maximum `100`) even when you do not send it. Keep paging with `after` while `has_more` is `true`. **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of webhooks to retrieve. Minimum `1`, maximum `100`, default `20`. | | `after` | string | No | The id after which to retrieve more webhooks (for pagination). Not included in the result. Cannot be combined with `before`. | | `before` | string | No | The id before which to retrieve more webhooks (for pagination). Not included in the result. Cannot be combined with `after`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.webhooks.list(); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Webhooks.list ``` **PHP** ```php webhooks->list(); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Webhooks.list() ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") webhooks, err := client.Webhooks.List(nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _webhooks = mb.webhooks.list(None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.webhooks().list(); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.WebhookListAsync(); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/webhooks' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart webhooks list ``` ### Response ```json { "object": "list", "has_more": false, "data": [ { "object": "webhook", "id": "12", "created_at": "2026-06-10T10:15:30.000Z", "status": "disabled", "endpoint": "https://first-webhook.example.com/handler", "events": ["email.sent"], "has_secret": true, "last_delivery_at": null, "last_delivery_status": null, "failure_count": 0 }, { "object": "webhook", "id": "17", "created_at": "2026-06-22T15:28:00.000Z", "status": "enabled", "endpoint": "https://second-webhook.example.com/receive", "events": ["email.bounced"], "has_secret": true, "last_delivery_at": "2026-06-27T10:00:00.000Z", "last_delivery_status": 200, "failure_count": 0 } ] } ``` --- # Update Webhook > PATCH /webhooks/:id — update a webhook’s endpoint, events, or status. `PATCH /webhooks/:id` Updates an existing webhook. Send any of `endpoint`, `events`, or `status`; omitted fields are left unchanged. Use `status` to pause delivery without deleting the webhook. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The webhook id as returned by [Create Webhook](https://www.senddart.com/docs/api/webhooks-create) or [List Webhooks](https://www.senddart.com/docs/api/webhooks-list) — a numeric string (e.g. `17`), not a UUID. A non-numeric id returns `not_found` (404). | **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `endpoint` | string | No | The HTTPS URL where webhook events will be sent. | | `events` | string[] | No | Array of event types to subscribe to. Replaces the existing set. See [Create Webhook](https://www.senddart.com/docs/api/webhooks-create) for the available values. | | `status` | string | No | The webhook status. Either `enabled` or `disabled`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.webhooks.update('17', { "endpoint": "https://new-webhook.example.com/handler", "events": ["email.sent", "email.delivered"], "status": "enabled" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Webhooks.update("17", { "endpoint": "https://new-webhook.example.com/handler", "events": [ "email.sent", "email.delivered" ], "status": "enabled" }) ``` **PHP** ```php webhooks->update('17', [ 'endpoint' => "https://new-webhook.example.com/handler", 'events' => [ "email.sent", "email.delivered" ], 'status' => "enabled" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Webhooks.update("17", { "endpoint": "https://new-webhook.example.com/handler", "events": [ "email.sent", "email.delivered" ], "status": "enabled" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") updated, err := client.Webhooks.Update("17", &senddart.UpdateWebhookRequest{ Endpoint: "https://new-webhook.example.com/handler", Events: []string{"email.sent", "email.delivered"}, Status: "enabled", }) ``` **Rust** ```rust use senddart::{SendDart, UpdateWebhookOptions, WebhookStatus}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateWebhookOptions::new() .with_endpoint("https://new-webhook.example.com/handler") .with_events(["email.sent", "email.delivered"]) .with_status(WebhookStatus::Enabled); let _updated = mb.webhooks.update("17", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.UpdateWebhookRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); UpdateWebhookRequest request = UpdateWebhookRequest.builder() .endpoint("https://new-webhook.example.com/handler") .events("email.sent", "email.delivered") .status("enabled") .build(); SendDartResponse response = senddart.webhooks().update("17", request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.WebhookUpdateAsync("17", new WebhookUpdateOptions { Endpoint = "https://new-webhook.example.com/handler", Events = new List { "email.sent", "email.delivered" }, Status = "enabled", }); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/webhooks/17' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "endpoint": "https://new-webhook.example.com/handler", "events": ["email.sent", "email.delivered"], "status": "enabled" }' ``` **CLI** ```bash senddart webhooks update 17 \ --endpoint 'https://new-webhook.example.com/handler' \ --events 'email.sent,email.delivered' \ --status 'enabled' ``` ### Response ```json { "object": "webhook", "id": "17" } ``` Errors: `not_found` if the webhook does not exist or is not yours. See [Errors](https://www.senddart.com/docs/api/errors). --- # Delete Webhook > DELETE /webhooks/:id — remove a webhook. `DELETE /webhooks/:id` Permanently removes a webhook. SendDart stops delivering events to its endpoint immediately. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The webhook id as returned by [Create Webhook](https://www.senddart.com/docs/api/webhooks-create) or [List Webhooks](https://www.senddart.com/docs/api/webhooks-list) — a numeric string (e.g. `17`), not a UUID. A non-numeric id returns `not_found` (404). | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.webhooks.remove('17'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Webhooks.delete("17") ``` **PHP** ```php webhooks->remove('17'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Webhooks.remove("17") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Webhooks.Remove("17") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _removed = mb.webhooks.remove("17").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.webhooks().remove("17"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.WebhookDeleteAsync("17"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/webhooks/17' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart webhooks delete 17 ``` ### Response ```json { "object": "webhook", "id": "17", "deleted": true } ``` Errors: `not_found` if the webhook does not exist or is not yours. See [Errors](https://www.senddart.com/docs/api/errors). --- # Send Event > POST /events/send — send a custom event to trigger automations for a contact. `POST /events/send` Records a custom event for a contact and immediately enrolls that contact into every **enabled** [automation](https://www.senddart.com/docs/automations/overview) **belonging to the given `domain`** whose trigger matches the event name. `domain` is required — every automation belongs to one of your sending domains, so the same event name (e.g. `user.created`) used across several products can never trigger another product's automations. The contact is identified by `contact_id` or `email` — supply one of the two. If you send both, `contact_id` wins and `email` is ignored. If an email is supplied and no matching contact exists in that domain's contacts, one is created automatically when the run starts; each domain keeps its own contact records, so unsubscribe state stays separate per domain. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `event` | string | Yes | The custom event name. Must not start with the reserved `senddart:` prefix. | | `domain` | string | Yes | The sending domain this event belongs to (one of your domains, e.g. `yourdomain.com`). Only automations belonging to this domain are triggered. | | `contact_id` | string | No | Identify the contact by id. Provide `contact_id` OR `email`; when both are present `contact_id` takes precedence and `email` is ignored. An id that matches no contact in this domain returns `not_found` (404). | | `email` | string | No | Identify the contact by email address. Provide `contact_id` OR `email`. If no contact with this address exists in the domain's contacts, one is created when the run starts. | | `payload` | object | No | Optional. Arbitrary key-value data associated with the event. Must be an object (not an array). Fields become available as `event.*` variables in automation steps. | > **Warning:** If an [event definition](https://www.senddart.com/docs/api/events-create) with a schema exists for this event name, the payload is validated against it — fields that don't match the expected type are rejected with a `422` error and the event is not delivered. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.events.send({ "event": "purchase.completed", "domain": "yourdomain.com", "email": "user@example.com", "payload": { "plan": "pro", "amount": 49 } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Events.send({ "event": "purchase.completed", "domain": "yourdomain.com", "email": "user@example.com", "payload": { "plan": "pro", "amount": 49 } }) ``` **PHP** ```php events->send([ 'event' => "purchase.completed", 'domain' => "yourdomain.com", 'email' => "user@example.com", 'payload' => [ 'plan' => "pro", 'amount' => 49 ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Events.send({ "event": "purchase.completed", "domain": "yourdomain.com", "email": "user@example.com", "payload": { "plan": "pro", "amount": 49 } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") event, err := client.Events.Send(&senddart.SendEventRequest{ Event: "purchase.completed", Domain: "yourdomain.com", Email: "user@example.com", Payload: map[string]any{"plan": "pro", "amount": 49}, }) ``` **Rust** ```rust use senddart::{SendDart, SendEventOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEventOptions::new("purchase.completed", "yourdomain.com") .with_email("user@example.com") .with_payload_entry("plan", serde_json::json!("pro")) .with_payload_entry("amount", serde_json::json!(49)); let _event = mb.events.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEventRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEventRequest request = SendEventRequest.builder() .event("purchase.completed") .domain("yourdomain.com") .email("user@example.com") .payload("plan", "pro") .payload("amount", 49) .build(); SendDartResponse response = senddart.events().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EventSendAsync(new EventSendOptions { Event = "purchase.completed", Domain = "yourdomain.com", Email = "user@example.com", Payload = new Dictionary { ["plan"] = "pro", ["amount"] = 49, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/events/send' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "event": "purchase.completed", "domain": "yourdomain.com", "email": "user@example.com", "payload": { "plan": "pro", "amount": 49 } }' ``` **CLI** ```bash senddart events send \ --name 'purchase.completed' \ --domain 'yourdomain.com' \ --email 'user@example.com' \ --data '{"plan":"pro","amount":49}' ``` ### Response ```json { "object": "event", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "event": "purchase.completed", "contact_id": "e169aa45-1ecf-4183-9955-b1499d5701d3", "enrolled": 1 } ``` `enrolled` is the number of automations the contact was enrolled into as a result of this event. Errors: `validation_error` (422) if `event`, the contact identifier, or `domain` is missing, the domain is not one of yours, the event name uses the reserved prefix, or the payload does not match the event definition's schema; `not_found` (404) when the supplied `contact_id` matches no contact in that domain; `restricted_api_key` (401) when a domain-scoped key targets a `domain` outside its scope; `automation_quota_exceeded` (429) when the rolling 30-day automation-run quota is exhausted — the body carries `kind: "automation_runs"` with `used`, `limit`, `period` and `next_plan`. See [Errors](https://www.senddart.com/docs/api/errors). --- # Create Event > POST /events — create a custom event definition, optionally with a payload schema. `POST /events` Creates a [custom event](https://www.senddart.com/docs/automations/custom-events) definition. If a `schema` is defined, payloads are validated when the event is [sent](https://www.senddart.com/docs/api/events-send) — fields that don't match the expected type are rejected with a `422` error and the event is not delivered. > **Warning:** This endpoint has two modes, chosen by the body. If the body contains any of `contact_id`, `contactId` or `email`, SendDart treats the request as an alias for [POST /events/send](https://www.senddart.com/docs/api/events-send) and **ingests an event instead of creating a definition** — it then requires an event name — accepted as `event`, `name`, `event_name` or `eventName` — plus `domain`, counts against your automation-run quota, and returns an `event` object with `contact_id` and `enrolled`. The definition-create behaviour documented on this page applies only to bodies with none of those three keys. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | Yes | The name of the custom event. Can be any string (e.g. `user.created`, `welcome`, `my-custom-event`) — dot notation is a recommended convention but is not required. Must not start with the reserved `senddart:` prefix. | | `schema` | object | No | An optional schema definition for the event payload. Must be an object with flat key/type pairs. Supported types: `string`, `number`, `boolean`, `date`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.events.create({ "name": "user.created", "schema": { "plan": "string" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Events.create({ "name": "user.created", "schema": { "plan": "string" } }) ``` **PHP** ```php events->create([ 'name' => "user.created", 'schema' => [ 'plan' => "string" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Events.create({ "name": "user.created", "schema": { "plan": "string" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") definition, err := client.Events.Create(&senddart.CreateEventRequest{ Name: "user.created", Schema: map[string]string{"plan": "string"}, }) ``` **Rust** ```rust use senddart::{CreateEventOptions, EventFieldType, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateEventOptions::new("user.created") .with_schema_field("plan", EventFieldType::String); let _definition = mb.events.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateEventRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateEventRequest request = CreateEventRequest.builder() .name("user.created") .schema("plan", "string") .build(); SendDartResponse response = senddart.events().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EventCreateAsync(new EventCreateOptions { Name = "user.created", Schema = new Dictionary { ["plan"] = "string" }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/events' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "user.created", "schema": { "plan": "string" } }' ``` **CLI** ```bash senddart events create \ --name 'user.created' \ --schema '{"plan":"string"}' ``` ### Response Returns the created event definition (HTTP 201). ```json { "object": "event", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "name": "user.created", "schema": { "plan": "string" }, "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:00:00.000Z" } ``` Errors: `validation_error` if `name` is missing, uses the reserved prefix, or an event definition with the same name already exists. See [Errors](https://www.senddart.com/docs/api/errors). --- # List Events > GET /events — list your custom event definitions. `GET /events` Lists your [custom event](https://www.senddart.com/docs/automations/custom-events) definitions. This endpoint is always paginated: `limit` defaults to `20` even when you do not send it, so an account with more definitions than that gets one page plus `has_more: true`. Page through the rest with `after`. **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of event definitions to retrieve. Minimum `1`, maximum `100`, default `20`. | | `after` | string | No | The id after which to retrieve more definitions (for pagination). Not included in the result. Cannot be combined with `before`. | | `before` | string | No | The id before which to retrieve more definitions (for pagination). Not included in the result. Cannot be combined with `after`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.events.list(); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Events.list ``` **PHP** ```php events->list(); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Events.list() ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") events, err := client.Events.List(nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _events = mb.events.list(None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.events().list(); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EventListAsync(); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/events' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart events list ``` ### Response ```json { "object": "list", "has_more": false, "data": [ { "object": "event", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "name": "user.created", "schema": { "plan": "string" }, "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:00:00.000Z" } ] } ``` Returns `validation_error` if `limit` is outside 1–100 or if both `after` and `before` are supplied. See [Errors](https://www.senddart.com/docs/api/errors) and [Pagination](https://www.senddart.com/docs/api/pagination). --- # Update Event > PATCH /events/:id — update a custom event definition's payload schema. `PATCH /events/:id` Updates a [custom event](https://www.senddart.com/docs/automations/custom-events) definition's payload `schema` in place. The event **name is immutable** — renaming it would silently detach every automation whose trigger or wait step references it, so create a new event instead. Pass `schema` as a flat `key → type` map (`string` | `number` | `boolean` | `date`), or `null` to clear validation. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The ID of the event definition to update. | **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `schema` | object | null | No | The replacement payload schema (flat key→type map), or `null` to remove validation. Treat this as required: the request **always** replaces the stored schema, so omitting `schema` has the same effect as sending `null` — the schema is cleared and payload validation stops. Passing `name` is rejected with `422 validation_error`. | > **Warning:** This is a full replacement, not a merge. `PATCH /events/:id` with an empty body — or with any other field but no `schema` — removes the payload schema and future [/events/send](https://www.senddart.com/docs/api/events-send) payloads stop being validated. Always send the complete schema you want to keep. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.events.update('b6d24b8e-af0b-4c3c-be0c-359bbd97381e', { "schema": { "plan": "string", "seats": "number" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Events.update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", { "schema": { "plan": "string", "seats": "number" } }) ``` **PHP** ```php events->update('b6d24b8e-af0b-4c3c-be0c-359bbd97381e', [ 'schema' => [ 'plan' => "string", 'seats' => "number" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Events.update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", { "schema": { "plan": "string", "seats": "number" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") definition, err := client.Events.Update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", &senddart.UpdateEventRequest{ Schema: map[string]string{"plan": "string", "seats": "number"}, }) ``` **Rust** ```rust use senddart::{EventFieldType, SendDart, UpdateEventOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateEventOptions::new() .with_schema_field("plan", EventFieldType::String) .with_schema_field("seats", EventFieldType::Number); let _definition = mb.events.update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.UpdateEventRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); UpdateEventRequest request = UpdateEventRequest.builder() .schema("plan", "string") .schema("seats", "number") .build(); SendDartResponse response = senddart.events().update( "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EventUpdateAsync("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", new Dictionary { ["plan"] = "string", ["seats"] = "number", }); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/events/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "schema": { "plan": "string", "seats": "number" } }' ``` **CLI** ```bash senddart events update b6d24b8e-af0b-4c3c-be0c-359bbd97381e \ --schema '{"plan":"string","seats":"number"}' ``` ### Response ```json { "object": "event", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "name": "user.created", "schema": { "plan": "string", "seats": "number" }, "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-24T09:00:00.000Z" } ``` An unknown id returns `404 not_found`; sending `name` or an invalid `schema` returns `422 validation_error`. See [Errors](https://www.senddart.com/docs/api/errors). --- # Delete Event > DELETE /events/:id — delete a custom event definition. `DELETE /events/:id` Deletes a [custom event](https://www.senddart.com/docs/automations/custom-events) definition. Deleting the definition removes its payload schema, so future [sends](https://www.senddart.com/docs/api/events-send) of the same event name are no longer validated — it does not affect automations that trigger on the event name. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The ID of the event definition to delete. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.events.remove('b6d24b8e-af0b-4c3c-be0c-359bbd97381e'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Events.delete("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` **PHP** ```php events->remove('b6d24b8e-af0b-4c3c-be0c-359bbd97381e'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Events.remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Events.Remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _removed = mb.events.remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.events().remove("b6d24b8e-af0b-4c3c-be0c-359bbd97381e"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EventDeleteAsync("b6d24b8e-af0b-4c3c-be0c-359bbd97381e"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/events/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart events delete b6d24b8e-af0b-4c3c-be0c-359bbd97381e ``` ### Response ```json { "object": "event", "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", "deleted": true } ``` An unknown id returns `404 not_found`. See [Errors](https://www.senddart.com/docs/api/errors). --- # List Send Sources > GET /emails/sources — per-source send and engagement rollups for campaigns, automations and individual sends. `GET /emails/sources` Rolls up every email on your account by **what sent it** and returns one row per source: one per campaign, one per automation, an `api` row covering [`POST /emails`](https://www.senddart.com/docs/api/emails-send) sends made with an API key, and an `individual` row for mail composed in the dashboard. Use it for a one-request overview of which surfaces are sending and how that mail is performing, without walking [`GET /emails`](https://www.senddart.com/docs/api/emails-list) yourself. Read-only; requires a read-scoped key. Rows are ordered by `last_sent_at`, newest activity first. This endpoint takes no query parameters and is **not** paginated: it returns every source in one response and `has_more` is always `false`. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.sources(); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.sources ``` **PHP** ```php emails->sources(); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.sources() ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sources, err := client.Emails.Sources() ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _sources = mb.emails.sources().await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().sources(); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailListSourcesAsync(); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/emails/sources' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails sources ``` ### Response **Response fields** | Name | Type | Required | Description | | --- | --- | --- | --- | | `kind` | string | No | The source type: `campaign`, `automation`, `api` (one-off API-key sends), or `individual` (composed in the dashboard). | | `id` | string | null | No | The campaign or automation id. Always `null` for the `individual` row. | | `name` | string | null | No | The campaign or automation name. `null` when the parent campaign or automation has since been deleted; for an unnamed campaign the subject line stands in here instead. | | `subject` | string | null | No | The campaign subject line, as a secondary label. `null` for automation and individual rows, and `null` when the subject was already used as `name`. | | `status` | string | null | No | The current campaign or automation status. `null` for the individual row and for a deleted parent. | | `total` | number | No | Emails attributed to this source. | | `sent` | number | No | How many of those were actually handed off for delivery (they have a `sent_at`). | | `delivered` | number | No | Recorded `delivered` events for this source. | | `opened` | number | No | Recorded `opened` events. These are raw event counts, not unique recipients — one recipient opening twice counts twice. | | `clicked` | number | No | Recorded `clicked` events, counted the same raw way as `opened`. | | `replied` | number | No | Recorded `replied` events. | | `failed` | number | No | Emails from this source in the `failed` status. | | `last_sent_at` | string | null | No | ISO 8601 creation time of the newest email in the group, or `null` when the group is empty. | ```json { "object": "list", "has_more": false, "data": [ { "kind": "campaign", "id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", "name": "June newsletter", "subject": "What's new in June", "status": "sent", "total": 1240, "sent": 1240, "delivered": 1216, "opened": 612, "clicked": 104, "replied": 12, "failed": 0, "last_sent_at": "2026-06-23T10:20:00.000Z" }, { "kind": "automation", "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "name": "Welcome series", "subject": null, "status": "enabled", "total": 318, "sent": 318, "delivered": 311, "opened": 190, "clicked": 44, "replied": 3, "failed": 0, "last_sent_at": "2026-06-22T18:04:00.000Z" }, { "kind": "individual", "id": null, "name": null, "subject": null, "status": null, "total": 47, "sent": 47, "delivered": 47, "opened": 29, "clicked": 8, "replied": 1, "failed": 0, "last_sent_at": "2026-06-21T09:12:00.000Z" } ] } ``` > **Note:** The `individual` row is omitted entirely when the account has never sent a direct email. A campaign or automation that was deleted still appears while its emails remain in the logs, with `name` and `status` as `null`. --- # Send an email > POST /emails — send a single transactional email. `POST /emails` Send a single email from a verified domain. The `from` address must belong to a domain you have verified; provide at least one of `html` or `text`. Returns the created email's `id`. Pass an optional `Idempotency-Key` header to make retries safe — see [Idempotency keys](https://www.senddart.com/docs/emails/idempotency). ## Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `Authorization` | string | Yes | Bearer API key, e.g. `Bearer mb_xxxxxxxxx`. | | `Idempotency-Key` | string | No | Optional unique key so a retried request is processed only once (remembered 24h). | ## Body parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `from` | string | Yes | Sender address on a verified domain. Accepts `Name ` or a bare address. | | `to` | string | string[] | Yes | Recipient address(es). Between 1 and 50 recipients. | | `subject` | string | Yes | The email subject line. | | `html` | string | No | HTML body. Provide `html` or `text` (or both). Markdown-style `[text](url)` links and bare URLs (`https://…` / `www.…`) in the body text are converted to tracked hyperlinks automatically at send time; content already inside `
` tags, attribute values, and `
`/`` blocks is left untouched. |
| `text` | string | No | Plain-text body. Provide `text` or `html` (or both). |
| `preview_text` | string | No | Inbox preview text (preheader) shown next to the subject in the recipient's inbox list. Injected as a hidden element at the top of the HTML body — never visible in the opened email, and excluded from the plain-text part. Max **150 characters**. |
| `cc` | string | string[] | No | Carbon-copy recipient(s). Up to 50. |
| `bcc` | string | string[] | No | Blind carbon-copy recipient(s). Up to 50. |
| `reply_to` | string | string[] | No | Reply-To address(es). |
| `headers` | object | No | Map of custom MIME header name → value. See [Custom headers](https://www.senddart.com/docs/emails/headers). |
| `attachments` | object[] | No | Files to attach (max **25 MB per file** and **40 MB total per email**, measured on the decoded bytes — base64 inflates the request body by roughly 33%). Each item is `{ filename, content | path, content_type, content_id }`. See [Attachments](https://www.senddart.com/docs/emails/attachments). |
| `scheduled_at` | string | No | Schedule the email to be sent later. Natural language (e.g. `in 1 min`) or ISO 8601 (e.g. `2026-08-05T11:52:01.858Z`). See [Schedule email](https://www.senddart.com/docs/emails/schedule). |
| `topic_id` | string | No | Topic ID for subscription handling. Each `to`/`cc`/`bcc` address is checked against the topic: recipients who are unsubscribed from the topic are **skipped** (removed from the recipient lists) and the message is sent to the rest. If every `to` recipient is skipped, the request is rejected with a `validation_error`. Addresses that are not contacts are kept unless they have unsubscribed from the topic themselves. An unknown `topic_id` returns a `validation_error`. Setting `topic_id` also marks the send as subscription mail, so SendDart adds a per-recipient unsubscribe footer and the RFC 8058 `List-Unsubscribe` headers; opting out removes that address from **this topic only** — it is not a suppression and does not affect your other email. A send **without** `topic_id` carries no unsubscribe link or header. See [Unsubscribe links](https://www.senddart.com/docs/emails/unsubscribe). |
| `template` | object | No | Send using a published template instead of inline body: `{ id, variables }`. `id` is the template id or alias; `variables` is an object of key/value pairs. When a `template` is set you cannot also send `html`/`text`; `from`, `subject`, and `reply_to` in the payload take precedence over the template defaults. |

### attachments[] properties

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `filename` | string | No | Name of the attached file. |
| `content` | string | No | Content of the attached file, passed as a Base64 string. Provide `content` or `path`. |
| `path` | string | No | URL where the attachment file is hosted; fetched at send time. Provide `path` or `content`. |
| `content_type` | string | No | Content type for the attachment. Derived from `filename` when not set. |
| `content_id` | string | No | Embeds the file as an inline image: reference it in your HTML via ``. |

> **Note:** The `Idempotency-Key` header should be unique per API request, has a maximum length of **255 characters**, and expires after **24 hours**.

## Request

**Node.js**

```js
import { SendDart } from 'senddart';

const mb = new SendDart('mb_xxxxxxxxx');

const { data, error } = await mb.emails.send({
  "from": "Acme ",
  "to": ["delivered@test.senddart.com"],
  "subject": "Hello from SendDart",
  "html": "

It works!

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Hello from SendDart", "html": "

It works!

" }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Hello from SendDart", 'html' => "

It works!

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Hello from SendDart", "html": "

It works!

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Hello from SendDart", Html: "

It works!

", }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Hello from SendDart", ) .with_html("

It works!

"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Hello from SendDart") .html("

It works!

") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Hello from SendDart", HtmlBody = "

It works!

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Hello from SendDart", "html": "

It works!

" }' ``` **CLI** ```bash senddart emails send \ --from 'Acme ' \ --to 'delivered@test.senddart.com' \ --subject 'Hello from SendDart' \ --html '

It works!

' ``` ## Response ```json { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` ## Errors Returns `missing_required_field` if `from`, `to`, or `subject` is missing; `validation_error` if neither `html` nor `text` is provided, if `to` is outside 1–50 recipients, or if the `from` domain is not verified; `invalid_from_address` / `invalid_to_address` for malformed addresses; and `409 concurrent_idempotent_requests` if a request with the same in-flight `Idempotency-Key` is already processing. See the [error reference](https://www.senddart.com/docs/api/errors). --- # Send a batch > POST /emails/batch — send up to 100 emails in one request. `POST /emails/batch` Send up to 100 emails in a single request. The body is a JSON **array** of email objects, each with the same shape as a [single send](https://www.senddart.com/docs/api/emails-send). Every item is validated before any email is sent; if one fails validation, the whole batch is rejected and nothing is sent. See [Batch sending](https://www.senddart.com/docs/emails/batch). > **Note:** A small batch returns `200` once every email has been sent; a large one returns **`202`** with `queued: true` and is delivered by the background sender. Both bodies carry `data` with one id per email in request order, so a client that reads `data` needs no change. [Batch delivery modes](https://www.senddart.com/docs/api/emails-batch-delivery) covers the boundary, following a queued batch, and the `batch_incomplete` case. ## Body | Name | Type | Required | Description | | --- | --- | --- | --- | | `(array)` | object[] | Yes | An array of 1–100 email objects. Each object accepts the same fields as `POST /emails` (`from`, `to`, `subject`, `html`/`text`, `cc`, `bcc`, `reply_to`, `headers`, `topic_id`, `template`). | > **Warning:** The `attachments` and `scheduled_at` fields are **not supported** on the batch endpoint. An optional `Idempotency-Key` header (max 255 characters, expires after 24 hours) applies to the whole batch. ## Request **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.batch.send([ { "from": "Acme ", "to": ["delivered+a@test.senddart.com"], "subject": "Hi A", "html": "

Hello A

" }, { "from": "Acme ", "to": ["delivered+b@test.senddart.com"], "subject": "Hi B", "html": "

Hello B

" } ]); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Batch.send([ { "from": "Acme ", "to": [ "delivered+a@test.senddart.com" ], "subject": "Hi A", "html": "

Hello A

" }, { "from": "Acme ", "to": [ "delivered+b@test.senddart.com" ], "subject": "Hi B", "html": "

Hello B

" } ]) ``` **PHP** ```php batch->send([ [ 'from' => "Acme ", 'to' => [ "delivered+a@test.senddart.com" ], 'subject' => "Hi A", 'html' => "

Hello A

" ], [ 'from' => "Acme ", 'to' => [ "delivered+b@test.senddart.com" ], 'subject' => "Hi B", 'html' => "

Hello B

" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Batch.send([ { "from": "Acme ", "to": [ "delivered+a@test.senddart.com" ], "subject": "Hi A", "html": "

Hello A

" }, { "from": "Acme ", "to": [ "delivered+b@test.senddart.com" ], "subject": "Hi B", "html": "

Hello B

" } ]) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") batch, err := client.Batch.SendEmails([]*senddart.BatchEmailRequest{ { From: "Acme ", To: []string{"delivered+a@test.senddart.com"}, Subject: "Hi A", Html: "

Hello A

", }, { From: "Acme ", To: []string{"delivered+b@test.senddart.com"}, Subject: "Hi B", Html: "

Hello B

", }, }) ``` **Rust** ```rust use senddart::{BatchEmailOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let items = vec![ BatchEmailOptions::new( "Acme ", ["delivered+a@test.senddart.com"], "Hi A", ) .with_html("

Hello A

"), BatchEmailOptions::new( "Acme ", ["delivered+b@test.senddart.com"], "Hi B", ) .with_html("

Hello B

"), ]; let _batch = mb.batch.send_emails(items).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.BatchEmailRequest; import java.util.List; SendDart senddart = new SendDart("mb_xxxxxxxxx"); List requests = List.of( BatchEmailRequest.builder() .from("Acme ") .to("delivered+a@test.senddart.com") .subject("Hi A") .html("

Hello A

") .build(), BatchEmailRequest.builder() .from("Acme ") .to("delivered+b@test.senddart.com") .subject("Hi B") .html("

Hello B

") .build()); SendDartResponse response = senddart.batch().sendEmails(requests); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailBatchSendAsync(new List { new() { From = "Acme ", To = "delivered+a@test.senddart.com", Subject = "Hi A", HtmlBody = "

Hello A

", }, new() { From = "Acme ", To = "delivered+b@test.senddart.com", Subject = "Hi B", HtmlBody = "

Hello B

", }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails/batch' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '[ { "from": "Acme ", "to": ["delivered+a@test.senddart.com"], "subject": "Hi A", "html": "

Hello A

" }, { "from": "Acme ", "to": ["delivered+b@test.senddart.com"], "subject": "Hi B", "html": "

Hello B

" } ]' ``` **CLI** ```bash senddart emails batch \ --data '[{"from":"Acme ","to":["delivered+a@test.senddart.com"],"subject":"Hi A","html":"

Hello A

"},{"from":"Acme ","to":["delivered+b@test.senddart.com"],"subject":"Hi B","html":"

Hello B

"}]' ``` ## Response A `data` array of created emails, in request order. ```json { "data": [ { "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" }, { "id": "1b2c3d4e-5f60-7a8b-9c0d-1e2f3a4b5c6d" } ] } ``` ## Errors Returns `validation_error` if the body is not a non-empty array, if it contains more than 100 emails, or if any item fails validation (the failing item's error is returned and nothing is sent). See the [error reference](https://www.senddart.com/docs/api/errors). --- # Retrieve an email > GET /emails/:id — fetch an email object and its event log. `GET /emails/:id` Retrieve a single email by id, including its current status and the ordered `events` array. Only emails belonging to your account are returned. ## Path parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The email id returned when the email was created. | ## Response fields | Name | Type | Required | Description | | --- | --- | --- | --- | | `object` | string | No | Always `email`. | | `id` | string | No | The email id. | | `message_id` | string | No | The RFC 5322 Message-ID assigned to the message, e.g. `<111-222-333@email.example.com>`. | | `from` | string | No | The sender address the email was sent from. | | `to` | string[] | No | The recipient addresses. | | `cc` | string[] | No | Carbon-copy addresses (empty array if none). | | `bcc` | string[] | No | Blind carbon-copy addresses (empty array if none). | | `reply_to` | string[] | No | Reply-To addresses (empty array if none). | | `subject` | string | No | The subject line. | | `html` | string | No | The HTML body that was sent (may be `null`). | | `text` | string | No | The plain-text body that was sent (may be `null`). | | `status` | string | No | Current status — see [Managing emails](https://www.senddart.com/docs/emails/managing). | | `last_event` | string | No | The most recent recorded event type (falls back to `status`). | | `scheduled_at` | string | No | The scheduled send time, or `null` if the email was not scheduled. | | `created_at` | string | No | ISO 8601 creation timestamp. | | `events` | object[] | No | Ordered event log: each entry is `{ type, created_at }`. | ## Request **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.get('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.get("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") ``` **PHP** ```php emails->get('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.get("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") email, err := client.Emails.Get("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _email = mb.emails.get("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().get("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailRetrieveAsync("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails get 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 ``` ## Response The email object plus an `events` array. `cc`, `bcc`, and `reply_to` are always present (empty array `[]` when nothing was set). `text` and `html` are present when the original send included them, `null` otherwise. ```json { "object": "email", "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "message_id": "<111-222-333@email.example.com>", "from": "Acme ", "to": ["delivered@test.senddart.com"], "cc": [], "bcc": [], "reply_to": [], "subject": "Hello from SendDart", "html": "

It works!

", "text": null, "status": "delivered", "last_event": "delivered", "scheduled_at": null, "created_at": "2026-06-23T10:00:00.000Z", "events": [ { "type": "sent", "created_at": "2026-06-23T10:00:00.000Z" }, { "type": "delivered", "created_at": "2026-06-23T10:00:04.512Z" } ] } ``` ## Errors Returns `not_found` (404) if no email with that id exists for your account. See the [error reference](https://www.senddart.com/docs/api/errors). --- # Update an email > PATCH /emails/:id — reschedule a scheduled email. `PATCH /emails/:id` Reschedule a still-`scheduled` email by setting a new `scheduled_at`. Only emails in the `scheduled` state can be updated — once an email has been sent, its delivery time is fixed. See [Schedule email](https://www.senddart.com/docs/emails/schedule). ## Path parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The id of the scheduled email to reschedule. | ## Body parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `scheduled_at` | string | Yes | New ISO 8601 datetime to send the email. | ## Request **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.update('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', { "scheduled_at": "2026-06-25T09:00:00Z" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", { "scheduled_at": "2026-06-25T09:00:00Z" }) ``` **PHP** ```php emails->update('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', [ 'scheduled_at' => "2026-06-25T09:00:00Z" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", { "scheduled_at": "2026-06-25T09:00:00Z" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") updated, err := client.Emails.Update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", &senddart.UpdateEmailRequest{ ScheduledAt: "2026-06-25T09:00:00Z", }) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _updated = mb.emails.update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "2026-06-25T09:00:00Z").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().update( "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "2026-06-25T09:00:00Z"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailUpdateAsync( "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "2026-06-25T09:00:00Z"); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "scheduled_at": "2026-06-25T09:00:00Z" }' ``` **CLI** ```bash senddart emails update 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 \ --scheduled-at '2026-06-25T09:00:00Z' ``` ## Response ```json { "object": "email", "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` ## Errors Returns `not_found` (404) if the email does not exist for your account; `validation_error` if the email is not in the `scheduled` state, or if `scheduled_at` is missing or not a valid ISO timestamp. See the [error reference](https://www.senddart.com/docs/api/errors). --- # Cancel an email > POST /emails/:id/cancel — cancel a scheduled email. `POST /emails/:id/cancel` Cancel a still-`scheduled` email so it is never sent. The email moves to the `canceled` status and its pending delivery job is removed. Only emails in the `scheduled` state can be canceled. See [Schedule email](https://www.senddart.com/docs/emails/schedule). ## Path parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The id of the scheduled email to cancel. | ## Request **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.cancel('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") ``` **PHP** ```php emails->cancel('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") canceled, err := client.Emails.Cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _canceled = mb.emails.cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.emails().cancel("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailCancelAsync("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794/cancel' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart emails cancel 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 ``` ## Response ```json { "object": "email", "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" } ``` ## Errors Returns `not_found` (404) if the email does not exist for your account; `validation_error` if the email is not in the `scheduled` state (i.e. it has already been sent or canceled). See the [error reference](https://www.senddart.com/docs/api/errors). --- # Create a domain > POST /domains — add a sending domain and get its SPF and DKIM records. `POST /domains` Adds a domain, provisions its sending identity (DKIM + custom MAIL FROM), and returns the domain object — including the `records` array of DNS entries to publish. The new domain starts with status `not_started`. Requires a key with full access. **Body** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | Yes | The bare domain to add, e.g. `yourdomain.com`. Lower-cased and validated as a domain. | | `region` | string | No | Optional. The region the sending identity is created in. Available values: `us-east-1` | `ap-south-1` (default `us-east-1`). `eu-west-1`, `sa-east-1` and `ap-northeast-1` are coming soon and return a `validation_error` (422) today; an unrecognised value falls back to the default. See [Choosing a region](https://www.senddart.com/docs/domains/region). | | `custom_return_path` | string | No | Optional. The subdomain used for the Return-Path (`MAIL FROM`) address, which carries SPF authentication, DMARC alignment, and bounce handling. Defaults to `send` (i.e. `send.yourdomain.com`). Avoid values that could undermine credibility (e.g. `testing`), as they may be exposed to recipients. See [Custom return path](https://www.senddart.com/docs/domains/managing). | | `open_tracking` | boolean | No | Optional. Track the open rate of each email. Applied whenever this flag is on; if a `tracking_subdomain` is configured and verified the open pixel is served from it, otherwise from a shared SendDart-hosted host. Defaults to false. See [Open and click tracking](https://www.senddart.com/docs/domains/tracking). | | `click_tracking` | boolean | No | Optional. Track clicks within the body of each HTML email. Applied whenever this flag is on; if a `tracking_subdomain` is configured and verified the rewritten links are served from it, otherwise from a shared SendDart-hosted host. Defaults to true. | | `tracking_subdomain` | string | No | Optional. A custom subdomain for click and open tracking. For example, setting `links` on `example.com` produces a CNAME record for `links.example.com`. Avoid values with a negative connotation (e.g. `tracking`). | | `tls` | string | No | Optional. The domain’s TLS preference. `opportunistic` (default) encrypts the connection when the receiving server supports TLS and otherwise sends unencrypted; `enforced` records a preference that delivery should require TLS. Defaults to `opportunistic`. See [Enforced TLS](https://www.senddart.com/docs/domains/managing). | | `capabilities` | object | No | Optional. Configure the domain capabilities. `sending` is always `enabled`. Contains `receiving` (`enabled` | `disabled`, default `disabled`) to also receive mail for the domain. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.domains.create({ "name": "yourdomain.com" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Domains.create({ "name": "yourdomain.com" }) ``` **PHP** ```php domains->create([ 'name' => "yourdomain.com" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Domains.create({ "name": "yourdomain.com" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") domain, err := client.Domains.Create(&senddart.CreateDomainRequest{ Name: "yourdomain.com", }) ``` **Rust** ```rust use senddart::{CreateDomainOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let _domain = mb.domains.create(CreateDomainOptions::new("yourdomain.com")).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateDomainRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.domains().create(CreateDomainRequest.builder().name("yourdomain.com").build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.DomainCreateAsync(new DomainCreateOptions { Name = "yourdomain.com" }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/domains' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "yourdomain.com" }' ``` **CLI** ```bash senddart domains add yourdomain.com ``` Response — the domain object. The `records` array lists every DNS entry to publish (the DKIM TXT, the SPF MX and TXT on the `send.` subdomain, and — when a `tracking_subdomain` is configured — a Tracking CNAME): ```json { "object": "domain", "id": "d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e", "name": "yourdomain.com", "zone": "yourdomain.com", "status": "not_started", "region": "us-east-1", "created_at": "2026-06-23T12:00:00.000Z", "custom_return_path": "send", "open_tracking": false, "click_tracking": true, "tracking_subdomain": null, "tls": "opportunistic", "capabilities": { "sending": "enabled", "receiving": "disabled" }, "tracking_domain": null, "tracking_verified": false, "aws_last_checked_at": null, "aws_check_error": null, "records": [ { "record": "DKIM", "name": "senddart._domainkey.yourdomain.com", "type": "TXT", "ttl": "Auto", "status": "not_started", "value": "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A..." }, { "record": "SPF", "name": "send.yourdomain.com", "type": "MX", "ttl": "Auto", "status": "not_started", "value": "feedback-smtp.us-east-1.amazonses.com", "priority": 10 }, { "record": "SPF", "name": "send.yourdomain.com", "type": "TXT", "ttl": "Auto", "status": "not_started", "value": "v=spf1 include:amazonses.com ~all" } ] } ``` > **Note:** The `Tracking` CNAME is only returned when a `tracking_subdomain` is set. The DKIM and SPF records are always returned. DMARC is **not** generated — publish it yourself, see [DNS records](https://www.senddart.com/docs/domains/dns). `zone` is the managing DNS zone that each record `name` is relative to — it is the domain itself unless the domain is delegated to a parent zone. `aws_last_checked_at` and `aws_check_error` report the last provider DNS poll: the ISO timestamp of the most recent check, and the error it returned (or `null` when the check succeeded or has not run yet). Errors: `missing_required_field` if `name` is absent, `validation_error` if `name` is not a valid domain, you already have that domain, or `region` is not an available region, `domain_conflict` (409) if the domain — or a parent/subdomain of it — is already verified by a **different** account (use [`POST /domains/claim`](https://www.senddart.com/docs/api/domains-claim)), `restricted_api_key` if the key lacks full access, and `plan_limit_reached` (402) when the account is already at its plan's domain limit — the body carries `kind: "domains"` with `used`, `limit`, `requested` and `next_plan`. See [Errors](https://www.senddart.com/docs/api/errors). --- # Retrieve a domain > GET /domains/:id — fetch a single domain and its current DNS record statuses. `GET /domains/:id` Retrieves a single domain by id, including its current `status` and the `records` array (each with its own per-record status). **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.domains.get('d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Domains.get("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e") ``` **PHP** ```php domains->get('d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Domains.get("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") domain, err := client.Domains.Get("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _domain = mb.domains.get("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.domains().get("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.DomainRetrieveAsync("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/domains/d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart domains get d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e ``` Response: ```json { "object": "domain", "id": "d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e", "name": "yourdomain.com", "zone": "yourdomain.com", "status": "verified", "region": "us-east-1", "created_at": "2026-06-23T12:00:00.000Z", "custom_return_path": "send", "open_tracking": false, "click_tracking": false, "tracking_subdomain": "links", "tls": "opportunistic", "capabilities": { "sending": "enabled", "receiving": "disabled" }, "tracking_domain": "links.yourdomain.com", "tracking_verified": true, "aws_last_checked_at": "2026-06-23T12:05:00.000Z", "aws_check_error": null, "records": [ { "record": "DKIM", "name": "senddart._domainkey.yourdomain.com", "type": "TXT", "ttl": "Auto", "status": "verified", "value": "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A..." } ] } ``` Errors: `not_found` if the domain does not exist or is not yours. See [Errors](https://www.senddart.com/docs/api/errors). --- # Check MX records > GET /domains/mx-check — preflight a hostname's existing MX records before enabling receiving. `GET /domains/mx-check` A preflight for [receiving](https://www.senddart.com/docs/receiving/introduction): does a hostname already have MX records, and do they all point at our inbound host? Use it before pointing a domain's MX at us so you can warn about an existing mail provider (switching MX would redirect **all** of that domain's mail to us). Read-only; requires a read-scoped key. **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | Yes | The hostname to check, e.g. `mail.yourdomain.com`. | ### Request ```bash curl "https://www.senddart.com/api/domains/mx-check?name=mail.yourdomain.com" \ -H "Authorization: Bearer $SENDDART_API_KEY" ``` ```js import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY); const { data } = await mb.domains.mxCheck('mail.yourdomain.com'); ``` ### Response ```json { "has_mx": true, "ours": false, "records": [ { "exchange": "aspmx.l.google.com", "priority": 1 }, { "exchange": "alt1.aspmx.l.google.com", "priority": 5 } ] } ``` **Response fields** | Name | Type | Required | Description | | --- | --- | --- | --- | | `has_mx` | boolean | No | Whether the hostname has any MX records at all. | | `ours` | boolean | No | Whether every MX record already points at our inbound host (i.e. receiving is ready). | | `records` | object[] | No | The discovered MX records, each `{ exchange, priority }`, sorted by priority. | A missing `name` returns `missing_required_field` (422). An invalid, unresolvable, or MX-less hostname returns `200` with `{ has_mx: false, ours: false, records: [] }` — this endpoint fails open and never returns `validation_error`. See [Errors](https://www.senddart.com/docs/api/errors). --- # List domains > GET /domains — list every domain on your account. `GET /domains` Lists all domains on your account, newest first. Each entry is the same domain object returned by [retrieve](https://www.senddart.com/docs/api/domains-get). **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of domains to retrieve. Minimum `1`, maximum `100`. Optional — when omitted, this endpoint returns up to `1000` domains in a single response and sets `has_more: true` if it had to truncate. | | `after` | string | No | The ID *after* which to retrieve more domains (for pagination). This ID is not included in the returned list. Cannot be combined with `before`. | | `before` | string | No | The ID *before* which to retrieve more domains (for pagination). This ID is not included in the returned list. Cannot be combined with `after`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.domains.list(); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Domains.list ``` **PHP** ```php domains->list(); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Domains.list() ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") domains, err := client.Domains.List(nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _domains = mb.domains.list(None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.domains().list(); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.DomainListAsync(); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/domains' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart domains list ``` Response: ```json { "object": "list", "has_more": false, "data": [ { "object": "domain", "id": "d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e", "name": "yourdomain.com", "zone": "yourdomain.com", "status": "verified", "region": "us-east-1", "created_at": "2026-06-23T12:00:00.000Z", "custom_return_path": "send", "open_tracking": false, "click_tracking": false, "tracking_subdomain": null, "tls": "opportunistic", "capabilities": { "sending": "enabled", "receiving": "disabled" }, "tracking_domain": null, "tracking_verified": false, "aws_last_checked_at": null, "aws_check_error": null, "records": [ ... ] } ] } ``` --- # Update a domain > PATCH /domains/:id — toggle open and click tracking. `PATCH /domains/:id` Updates a domain’s settings. Send any subset of the body fields below; omitted fields are left unchanged. Returns a slim acknowledgement with the domain `id`. Requires a key with full access. See [Open and click tracking](https://www.senddart.com/docs/domains/tracking). **Body** | Name | Type | Required | Description | | --- | --- | --- | --- | | `open_tracking` | boolean | No | Enable or disable the open-tracking pixel for mail sent from this domain. Applied whenever enabled; the pixel is served from your `tracking_subdomain` when one is configured and verified, otherwise from a shared SendDart-hosted host. | | `click_tracking` | boolean | No | Enable or disable link rewriting for click tracking on this domain. Applied whenever enabled; rewritten links pass through your `tracking_subdomain` when one is configured and verified, otherwise through a shared SendDart-hosted host. | | `tracking_subdomain` | string | No | A custom subdomain for click and open tracking (e.g. `links` produces a CNAME for `links.yourdomain.com`). This value can only be changed after it has first been specified, never removed — this preserves links in already-sent email. After changing it, the new DNS record must be verified; until then links use the shared SendDart tracking host, and all previously used records remain active and are included in the response. | | `tls` | string | No | The domain’s TLS preference. `opportunistic` (default) encrypts the connection when the receiving server supports TLS and otherwise sends unencrypted; `enforced` records a preference that delivery should require TLS. | | `capabilities` | object | No | Update the domain capabilities. `sending` is always `enabled` and cannot be disabled. Set `receiving` (`enabled` | `disabled`) to toggle whether the domain also receives mail; omitting it keeps the current value. | | `receiving` | boolean | No | A top-level alias for `capabilities.receiving`. Enabling it adds the Receiving MX record to `records`; disabling removes it. `capabilities.receiving` wins when both are sent. | | `custom_return_path` | string | No | A new Return-Path (`MAIL FROM`) subdomain label — this is the only supported way to change it after creation. Must be a valid DNS label (letters, digits and hyphens, starting and ending alphanumeric, 63 characters or less); anything else returns a `validation_error`. Changing it re-points MAIL FROM and replaces the SPF MX and TXT records, which must then be published at your DNS provider and re-verified. | | `custom_tracking` | boolean | No | Turn the custom tracking host on or off. Setting `tracking_subdomain` implies `true`. Setting `false` clears `tracking_domain`, `tracking_subdomain` and `tracking_verified` so new sends fall back to the shared SendDart tracking host — the historical tracking DNS records are retained so links in already-sent mail keep working. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.domains.update('d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e', { "open_tracking": true, "click_tracking": true }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Domains.update("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e", { "open_tracking": true, "click_tracking": true }) ``` **PHP** ```php domains->update('d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e', [ 'open_tracking' => true, 'click_tracking' => true ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Domains.update("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e", { "open_tracking": True, "click_tracking": True }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") updated, err := client.Domains.Update("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e", &senddart.UpdateDomainRequest{ OpenTracking: senddart.Bool(true), ClickTracking: senddart.Bool(true), }) ``` **Rust** ```rust use senddart::{SendDart, UpdateDomainOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateDomainOptions::new() .with_open_tracking(true) .with_click_tracking(true); let _updated = mb.domains.update("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.UpdateDomainRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.domains().update( "d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e", UpdateDomainRequest.builder().openTracking(true).clickTracking(true).build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.DomainUpdateAsync("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e", new DomainUpdateOptions { OpenTracking = true, ClickTracking = true, }); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/domains/d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "open_tracking": true, "click_tracking": true }' ``` **CLI** ```bash senddart domains update d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e \ --open-tracking \ --click-tracking ``` Response: ```json { "object": "domain", "id": "d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e" } ``` > **Note:** The response is a slim acknowledgement with only `object` and `id`. To read the updated domain object, follow up with [`GET /domains/:id`](https://www.senddart.com/docs/api/domains-get). Errors: `not_found` if the domain does not exist or is not yours, `restricted_api_key` if the key lacks full access. See [Errors](https://www.senddart.com/docs/api/errors). --- # Verify a domain > POST /domains/:id/verify — re-check DNS and update the domain status. `POST /domains/:id/verify` Re-checks the domain’s DNS and updates the domain’s `status` (and every record’s `status`) to `verified`, `failed`, or still `pending`. Call this after publishing your DNS records, or any time you want to refresh verification state. Requires a key with full access. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.domains.verify('d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Domains.verify("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e") ``` **PHP** ```php domains->verify('d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Domains.verify("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") verified, err := client.Domains.Verify("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _verified = mb.domains.verify("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.domains().verify("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.DomainVerifyAsync("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/domains/d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e/verify' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart domains verify d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e ``` Response — a slim acknowledgement. Fetch the domain with [`GET /domains/:id`](https://www.senddart.com/docs/api/domains-get) to read the refreshed statuses: ```json { "object": "domain", "id": "d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e" } ``` > **Note:** DNS can take time to propagate. If the domain is still `pending`, wait a bit and call verify again. Errors: `not_found` if the domain does not exist or is not yours, `restricted_api_key` if the key lacks full access. See [Errors](https://www.senddart.com/docs/api/errors). --- # DNS setup > Add DNS records at your provider and verify your domain. Automatic DNS setup is currently unavailable. Open your domain in the dashboard, copy the DNS records into your provider’s DNS settings, then click **Verify**. You can also download the records as CSV. The former DNS detection, provider apply, and Domain Connect callback endpoints return HTTP 410 (dns_setup_disabled). Use [Retrieve domain](https://www.senddart.com/docs/api/domains-get) to read the records and [Verify domain](https://www.senddart.com/docs/api/domains-verify) after adding them. --- # Delete a domain > DELETE /domains/:id — remove a domain and its sending identity. `DELETE /domains/:id` Deletes a domain and removes its sending identity. Requires a key with full access. > **Warning:** Deletion is blocked while a **scheduled** email still depends on this domain — the request returns a `validation_error` telling you to cancel that email first. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.domains.remove('d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Domains.delete("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e") ``` **PHP** ```php domains->remove('d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Domains.remove("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Domains.Remove("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _removed = mb.domains.remove("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.domains().remove("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.DomainDeleteAsync("d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/domains/d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart domains delete d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e ``` Response: ```json { "object": "domain", "id": "d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e", "deleted": true } ``` Errors: `not_found` if the domain does not exist or is not yours, `validation_error` if a scheduled email still uses it, `restricted_api_key` if the key lacks full access. See [Errors](https://www.senddart.com/docs/api/errors). --- # Create audience > POST /audiences — create a new contact list. `POST /audiences` Create a new audience. The only field is a `name`. Returns the new audience object with a generated `id`. **Body** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | Yes | A name for the audience. Required and must be non-empty. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.audiences.create({ "name": "Registered Users" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Audiences.create({ "name": "Registered Users" }) ``` **PHP** ```php audiences->create([ 'name' => "Registered Users" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Audiences.create({ "name": "Registered Users" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") audience, err := client.Audiences.Create(&senddart.CreateAudienceRequest{ Name: "Registered Users", }) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _audience = mb.audiences.create("Registered Users").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.audiences().create("Registered Users"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AudienceCreateAsync("Registered Users"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/audiences' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Registered Users" }' ``` **CLI** ```bash senddart audiences create \ --name 'Registered Users' ``` **Response (201)** ```json { "object": "audience", "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Registered Users", "domain": null, "created_at": "2026-06-23T17:22:43.000Z" } ``` Omitting `name` returns `422 missing_required_field`. See [Errors](https://www.senddart.com/docs/api/errors). --- # Retrieve audience > GET /audiences/:id — fetch a single audience by id. `GET /audiences/:id` Retrieve a single audience you own by its `id`. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.audiences.get('AUDIENCE_ID'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Audiences.get("AUDIENCE_ID") ``` **PHP** ```php audiences->get('AUDIENCE_ID'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Audiences.get("AUDIENCE_ID") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") audience, err := client.Audiences.Get("AUDIENCE_ID") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _audience = mb.audiences.get("AUDIENCE_ID").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.audiences().get("AUDIENCE_ID"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AudienceRetrieveAsync("AUDIENCE_ID"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/audiences/AUDIENCE_ID' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart audiences get AUDIENCE_ID ``` **Response (200)** ```json { "object": "audience", "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Registered Users", "domain": null, "created_at": "2026-06-23T17:22:43.000Z" } ``` An unknown id (or one you do not own) returns `404 not_found`. See [Errors](https://www.senddart.com/docs/api/errors). --- # List audiences > GET /audiences — page through the audiences you own. `GET /audiences` List the audiences belonging to your account, newest first. Returns a list object whose `data` array holds the audiences. Each audience carries a `domain` field — the sending domain when the audience is a per-domain contact pool, or `null` for an audience you created yourself. This list is **paginated** — at most 20 audiences come back unless you raise `limit`, and `has_more` tells you whether to keep walking with `after`. An account with 50 audiences receives 20 with `has_more: true`. **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | integer | No | How many audiences to return. An integer between 1 and 100, defaulting to **20** — this endpoint always applies the limit. | | `after` | string | No | Cursor: return the audiences that follow this audience id. The id itself is not included. See [Pagination](https://www.senddart.com/docs/api/pagination). | | `before` | string | No | Cursor: return the audiences that precede this audience id. Cannot be combined with `after`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.audiences.list(); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Audiences.list ``` **PHP** ```php audiences->list(); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Audiences.list() ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") audiences, err := client.Audiences.List(nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _audiences = mb.audiences.list(None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.audiences().list(); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AudienceListAsync(); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/audiences' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart audiences list ``` **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.audiences.list({ limit: 100, after: '78261eea-8f8b-4381-83c6-79fa7120f1cf' }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Audiences.list({ "limit": 100, "after": "78261eea-8f8b-4381-83c6-79fa7120f1cf" }) ``` **PHP** ```php audiences->list([ 'limit' => 100, 'after' => "78261eea-8f8b-4381-83c6-79fa7120f1cf" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Audiences.list({ "limit": 100, "after": "78261eea-8f8b-4381-83c6-79fa7120f1cf" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") audiences, err := client.Audiences.List(&senddart.ListParams{ Limit: 100, After: "78261eea-8f8b-4381-83c6-79fa7120f1cf", }) ``` **Rust** ```rust use senddart::{PaginationParams, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = Some(PaginationParams::new() .with_limit(100) .with_after("78261eea-8f8b-4381-83c6-79fa7120f1cf")); let _audiences = mb.audiences.list(params).await?; ``` **Java** ```java import com.senddart.ListParams; import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); ListParams params = ListParams.builder() .limit(100) .after("78261eea-8f8b-4381-83c6-79fa7120f1cf") .build(); SendDartResponse response = senddart.audiences().list(params); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AudienceListAsync(new PaginationOptions { Limit = 100, After = "78261eea-8f8b-4381-83c6-79fa7120f1cf", }); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/audiences?limit=100&after=78261eea-8f8b-4381-83c6-79fa7120f1cf' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart audiences list \ --limit 100 \ --after 78261eea-8f8b-4381-83c6-79fa7120f1cf ``` **Response (200)** ```json { "object": "list", "has_more": false, "data": [ { "object": "audience", "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Registered Users", "domain": null, "created_at": "2026-06-23T17:22:43.000Z" } ] } ``` A `limit` outside 1-100 (or a non-integer), or `after` and `before` together, returns `422 validation_error`. An unknown cursor returns an empty page rather than an error. See [Pagination](https://www.senddart.com/docs/api/pagination) and [Errors](https://www.senddart.com/docs/api/errors). --- # Delete audience > DELETE /audiences/:id — delete an audience and its contacts. `DELETE /audiences/:id` Delete an audience by `id`. This also removes the contacts belonging to it. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.audiences.remove('AUDIENCE_ID'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Audiences.delete("AUDIENCE_ID") ``` **PHP** ```php audiences->remove('AUDIENCE_ID'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Audiences.remove("AUDIENCE_ID") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Audiences.Remove("AUDIENCE_ID") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _removed = mb.audiences.remove("AUDIENCE_ID").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.audiences().remove("AUDIENCE_ID"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AudienceDeleteAsync("AUDIENCE_ID"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/audiences/AUDIENCE_ID' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart audiences delete AUDIENCE_ID ``` **Response (200)** ```json { "object": "audience", "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "deleted": true } ``` > **Warning:** Deletion is blocked while a campaign still references the audience — you get `422 validation_error` asking you to delete the campaign(s) first. An unknown id returns `404 not_found`. --- # Create contact > POST /contacts — add a contact to a sending domain (upsert by email). `POST /contacts` Add a contact to one of your **sending domains**. Contacts are domain-scoped: pass the `domain` the contact belongs to along with the required `email`. If a contact with that email already exists in the domain, it is **updated** instead of duplicated (upsert by email). Passing `audience_id` on this endpoint is rejected with a `422` — use the [audience-scoped variant](#audience-scoped-variant) below when you want to target an audience explicitly. **Body** | Name | Type | Required | Description | | --- | --- | --- | --- | | `domain` | string | Yes | The sending domain the contact belongs to (one of your domains, e.g. `yourdomain.com`). | | `email` | string | Yes | The contact’s email address. Stored lowercased. Must be a valid email. | | `first_name` | string | No | Optional first name. Stored as null when omitted. | | `last_name` | string | No | Optional last name. Stored as null when omitted. | | `unsubscribed` | boolean | No | Optional opt-out flag. Defaults to false. When true, campaigns skip this contact. | | `properties` | object | No | Optional map of custom property keys and values to attach to the contact (e.g. `{ "company_name": "Acme Corp", "score": 10 }`). Each key must be a registered contact property and the value must match its declared type (`string` or `number`). | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.create({ "domain": "yourdomain.com", "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Contacts.create({ "domain": "yourdomain.com", "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false }) ``` **PHP** ```php contacts->create([ 'domain' => "yourdomain.com", 'email' => "steve@example.com", 'first_name' => "Steve", 'last_name' => "Wozniak", 'unsubscribed' => false ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Contacts.create({ "domain": "yourdomain.com", "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": False }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") contact, err := client.Contacts.Create(&senddart.CreateContactRequest{ Domain: "yourdomain.com", Email: "steve@example.com", FirstName: "Steve", LastName: "Wozniak", Unsubscribed: false, }) ``` **Rust** ```rust use senddart::{CreateContactOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateContactOptions::new("steve@example.com") .with_domain("yourdomain.com") .with_first_name("Steve") .with_last_name("Wozniak") .with_unsubscribed(false); let _contact = mb.contacts.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateContactRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateContactRequest request = CreateContactRequest.builder() .domain("yourdomain.com") .email("steve@example.com") .firstName("Steve") .lastName("Wozniak") .unsubscribed(false) .build(); SendDartResponse response = senddart.contacts().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactCreateAsync(new ContactCreateOptions { Domain = "yourdomain.com", Email = "steve@example.com", FirstName = "Steve", LastName = "Wozniak", Unsubscribed = false, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/contacts' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "domain": "yourdomain.com", "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false }' ``` **CLI** ```bash senddart contacts create \ --domain 'yourdomain.com' \ --email 'steve@example.com' \ --first-name 'Steve' \ --last-name 'Wozniak' ``` **Response (201)** ```json { "object": "contact", "id": "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6" } ``` > **Note:** Upsert: re-posting an existing email merges the incoming `first_name`, `last_name`, and `properties` into the existing contact (preserving existing name values when omitted) and applies `unsubscribed` monotonically (once unsubscribed, a re-post cannot resubscribe). Use [PATCH](https://www.senddart.com/docs/api/contacts-update) to change only some fields. ## Audience-scoped variant The nested route `POST /audiences/:audience_id/contacts` still works and adds the contact to a specific audience instead of a domain — no `domain` field in the body: **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.create({ audienceId: 'AUDIENCE_ID', "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false }); console.log({ data, error }); ``` **Ruby** ```ruby require 'net/http' require 'uri' uri = URI('https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Post.new(uri) req['Authorization'] = 'Bearer mb_xxxxxxxxx' req['Content-Type'] = 'application/json' req.body = <<~JSON { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false } JSON res = http.request(req) puts res.body ``` **PHP** ```php contacts->create([ 'audienceId' => "AUDIENCE_ID", 'email' => "steve@example.com", 'first_name' => "Steve", 'last_name' => "Wozniak", 'unsubscribed' => false ]); ``` **Python** ```python import requests res = requests.post( "https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts", headers={"Authorization": "Bearer mb_xxxxxxxxx", "Content-Type": "application/json"}, json={ "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false }, ) print(res.json()) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") contact, err := client.Contacts.Create(&senddart.CreateContactRequest{ AudienceId: "AUDIENCE_ID", Email: "steve@example.com", FirstName: "Steve", LastName: "Wozniak", Unsubscribed: false, }) ``` **Rust** ```rust use senddart::{CreateContactOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateContactOptions::new("steve@example.com") .with_audience_id("AUDIENCE_ID") .with_first_name("Steve") .with_last_name("Wozniak") .with_unsubscribed(false); let _contact = mb.contacts.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateContactRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateContactRequest request = CreateContactRequest.builder() .audienceId("AUDIENCE_ID") .email("steve@example.com") .firstName("Steve") .lastName("Wozniak") .unsubscribed(false) .build(); SendDartResponse response = senddart.contacts().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactCreateAsync(new ContactCreateOptions { AudienceId = "AUDIENCE_ID", Email = "steve@example.com", FirstName = "Steve", LastName = "Wozniak", Unsubscribed = false, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false }' ``` A missing `email` returns `422 missing_required_field`; an invalid email, a missing `domain`, or a `domain` that is not one of yours returns `422 validation_error`. An audience id that is not yours returns `404 not_found`. See [Errors](https://www.senddart.com/docs/api/errors). --- # Retrieve contact > GET /contacts/:id — fetch a contact by id or email. `GET /contacts/:id` Retrieve a single contact. The `:id` segment accepts either the contact `id` or its `email`. An id is exact; when addressing by **email**, pass `?domain=` to say which of your sending domains the contact lives on (each domain keeps its own contact records). **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The contact’s `id` *or* its `email` — either value is accepted in this path segment. | **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `domain` | string | No | The sending domain the contact belongs to. Needed when addressing by email; an id is exact, so `domain` is not required then. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.get({ id: 'steve@example.com', domain: 'yourdomain.com' }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Contacts.get({ "id": "steve@example.com", "domain": "yourdomain.com" }) ``` **PHP** ```php contacts->get([ 'id' => "steve@example.com", 'domain' => "yourdomain.com" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Contacts.get({ "id": "steve@example.com", "domain": "yourdomain.com" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") contact, err := client.Contacts.Get(&senddart.GetContactRequest{ Id: "steve@example.com", Domain: "yourdomain.com", }) ``` **Rust** ```rust use senddart::{ContactLookup, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = ContactLookup::new("steve@example.com").with_domain("yourdomain.com"); let _contact = mb.contacts.get(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contacts().get( "steve@example.com", "yourdomain.com"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactRetrieveAsync("steve@example.com", "yourdomain.com"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/contacts/steve@example.com?domain=yourdomain.com' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart contacts get steve@example.com \ --domain yourdomain.com ``` **Response (200)** ```json { "object": "contact", "id": "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6", "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false, "properties": { "company_name": "Acme Corp", "department": "Engineering" }, "created_at": "2026-06-23T17:30:11.000Z" } ``` The `properties` map is always present and includes every registered contact property — the contact's own value wins; if a property has no value set, the property's `fallback_value` is used instead. An unknown contact returns `404 not_found`. See [Errors](https://www.senddart.com/docs/api/errors). ## Audience-scoped variant The nested route `GET /audiences/:audience_id/contacts/:id` still works and scopes the lookup to one audience (no `domain` query needed): **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.get({ audienceId: 'AUDIENCE_ID', id: 'steve@example.com' }); console.log({ data, error }); ``` **Ruby** ```ruby require 'net/http' require 'uri' uri = URI('https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/steve@example.com') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Get.new(uri) req['Authorization'] = 'Bearer mb_xxxxxxxxx' res = http.request(req) puts res.body ``` **PHP** ```php contacts->get([ 'audienceId' => "AUDIENCE_ID", 'id' => "steve@example.com" ]); ``` **Python** ```python import requests res = requests.get( "https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/steve@example.com", headers={"Authorization": "Bearer mb_xxxxxxxxx"}, ) print(res.json()) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") contact, err := client.Contacts.Get(&senddart.GetContactRequest{ AudienceId: "AUDIENCE_ID", Id: "steve@example.com", }) ``` **Rust** ```rust use senddart::{ContactLookup, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = ContactLookup::new("steve@example.com").with_audience_id("AUDIENCE_ID"); let _contact = mb.contacts.get(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contacts().getByAudience( "AUDIENCE_ID", "steve@example.com"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactRetrieveAsync( audienceId: "AUDIENCE_ID", contactIdOrEmail: "steve@example.com"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/steve@example.com' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` --- # Update contact > PATCH /contacts/:id — partially update a contact. `PATCH /contacts/:id` Partially update a contact, addressed by `id` or `email`. Only the fields you send are changed; omitted fields are left untouched. The contact’s `email` cannot be changed. An id is exact; when addressing by **email**, include a `domain` field in the body to say which of your sending domains the contact lives on. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The contact’s `id` *or* its `email` — either value is accepted in this path segment. | **Body** | Name | Type | Required | Description | | --- | --- | --- | --- | | `domain` | string | No | The sending domain the contact belongs to. Needed only when addressing by email; an id is exact. | | `first_name` | string | No | New first name. Send null (or an empty string) to clear it. | | `last_name` | string | No | New last name. Send null (or an empty string) to clear it. | | `unsubscribed` | boolean | No | New opt-out state. Set true to unsubscribe, false to re-subscribe. | | `properties` | object | No | A map of custom property keys and values to merge into the contact (e.g. `{ "department": "Engineering", "score": 10 }`). Incoming keys win; unmentioned keys are preserved. Each key must be a registered contact property and the value must match its declared type (`string` or `number`). | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.update({ id: '479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6', "unsubscribed": true }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Contacts.update({ "id": "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6", "unsubscribed": true }) ``` **PHP** ```php contacts->update([ 'id' => "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6", 'unsubscribed' => true ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Contacts.update({ "id": "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6", "unsubscribed": True }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") updated, err := client.Contacts.Update(&senddart.UpdateContactRequest{ Id: "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6", Unsubscribed: senddart.Bool(true), }) ``` **Rust** ```rust use senddart::{SendDart, UpdateContactOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateContactOptions::new("479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6") .with_unsubscribed(true); let _updated = mb.contacts.update(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.UpdateContactRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); UpdateContactRequest request = UpdateContactRequest.builder() .id("479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6") .unsubscribed(true) .build(); SendDartResponse response = senddart.contacts().update(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactUpdateAsync(new ContactUpdateOptions { Id = "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6", Unsubscribed = true, }); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/contacts/479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "unsubscribed": true }' ``` **CLI** ```bash senddart contacts update 479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6 \ --unsubscribed ``` **Response (200)** ```json { "object": "contact", "id": "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6" } ``` ## Audience-scoped variant The nested route `PATCH /audiences/:audience_id/contacts/:id` still works and scopes the update to one audience (no `domain` field needed): **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.update({ audienceId: 'AUDIENCE_ID', id: 'steve@example.com', "unsubscribed": true }); console.log({ data, error }); ``` **Ruby** ```ruby require 'net/http' require 'uri' uri = URI('https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/steve@example.com') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Patch.new(uri) req['Authorization'] = 'Bearer mb_xxxxxxxxx' req['Content-Type'] = 'application/json' req.body = <<~JSON { "unsubscribed": true } JSON res = http.request(req) puts res.body ``` **PHP** ```php contacts->update([ 'audienceId' => "AUDIENCE_ID", 'id' => "steve@example.com", 'unsubscribed' => true ]); ``` **Python** ```python import requests res = requests.patch( "https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/steve@example.com", headers={"Authorization": "Bearer mb_xxxxxxxxx", "Content-Type": "application/json"}, json={ "unsubscribed": true }, ) print(res.json()) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") updated, err := client.Contacts.Update(&senddart.UpdateContactRequest{ AudienceId: "AUDIENCE_ID", Id: "steve@example.com", Unsubscribed: senddart.Bool(true), }) ``` **Rust** ```rust use senddart::{SendDart, UpdateContactOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateContactOptions::new("steve@example.com") .with_audience_id("AUDIENCE_ID") .with_unsubscribed(true); let _updated = mb.contacts.update(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.UpdateContactRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); UpdateContactRequest request = UpdateContactRequest.builder() .audienceId("AUDIENCE_ID") .id("steve@example.com") .unsubscribed(true) .build(); SendDartResponse response = senddart.contacts().update(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactUpdateAsync(new ContactUpdateOptions { AudienceId = "AUDIENCE_ID", Id = "steve@example.com", Unsubscribed = true, }); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/steve@example.com' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "unsubscribed": true }' ``` An unknown contact (or audience) returns `404 not_found`. See [Errors](https://www.senddart.com/docs/api/errors). --- # Delete contact > DELETE /contacts/:id — remove a contact by id or email. `DELETE /contacts/:id` Remove a contact. The `:id` segment accepts either the contact `id` or its `email`. An id is exact; when addressing by **email**, append `?domain=` to say which of your sending domains the contact lives on. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The contact’s `id` *or* its `email` — either value is accepted in this path segment. | **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `domain` | string | No | The sending domain the contact belongs to. Needed only when addressing by email; an id is exact. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.remove({ id: '479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6' }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Contacts.delete({ "id": "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6" }) ``` **PHP** ```php contacts->remove([ 'id' => "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Contacts.remove({ "id": "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Contacts.Remove(&senddart.RemoveContactRequest{ Id: "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6", }) ``` **Rust** ```rust use senddart::{ContactLookup, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = ContactLookup::new("479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6"); let _removed = mb.contacts.remove(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contacts().remove("479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactDeleteAsync("479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/contacts/479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart contacts delete 479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6 ``` **Response (200)** ```json { "object": "contact", "id": "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6", "deleted": true } ``` ## Audience-scoped variant The nested route `DELETE /audiences/:audience_id/contacts/:id` still works and scopes the delete to one audience: **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.remove({ audienceId: 'AUDIENCE_ID', id: 'steve@example.com' }); console.log({ data, error }); ``` **Ruby** ```ruby require 'net/http' require 'uri' uri = URI('https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/steve@example.com') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Delete.new(uri) req['Authorization'] = 'Bearer mb_xxxxxxxxx' res = http.request(req) puts res.body ``` **PHP** ```php contacts->remove([ 'audienceId' => "AUDIENCE_ID", 'id' => "steve@example.com" ]); ``` **Python** ```python import requests res = requests.delete( "https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/steve@example.com", headers={"Authorization": "Bearer mb_xxxxxxxxx"}, ) print(res.json()) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Contacts.Remove(&senddart.RemoveContactRequest{ AudienceId: "AUDIENCE_ID", Id: "steve@example.com", }) ``` **Rust** ```rust use senddart::{ContactLookup, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = ContactLookup::new("steve@example.com").with_audience_id("AUDIENCE_ID"); let _removed = mb.contacts.remove(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contacts().removeByAudience( "AUDIENCE_ID", "steve@example.com"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactDeleteAsync( audienceId: "AUDIENCE_ID", contactIdOrEmail: "steve@example.com"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/steve@example.com' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` An unknown contact (or audience) returns `404 not_found`. See [Errors](https://www.senddart.com/docs/api/errors). --- # List contacts > GET /contacts — list every contact on a sending domain. `GET /contacts` List the contacts on one of your **sending domains**, newest first. `?domain=` is required. Returns a list object whose `data` array holds the contacts. **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `domain` | string | Yes | The sending domain whose contacts to list (one of your domains, e.g. `yourdomain.com`). | | `segment_id` | string | No | Optional. Only return contacts that belong to this [segment](https://www.senddart.com/docs/segments/overview). | | `limit` | integer | No | How many contacts to return. An integer between 1 and 100. Optional; if omitted, the whole pool comes back in a single response up to a ceiling of **1,000**, and `has_more` is `true` when that ceiling truncated the page. | | `after` | string | No | Cursor: return the contacts that follow this contact id. The id itself is not included. See [Pagination](https://www.senddart.com/docs/api/pagination). | | `before` | string | No | Cursor: return the contacts that precede this contact id. Cannot be combined with `after`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.list({ domain: 'yourdomain.com' }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Contacts.list({ "domain": "yourdomain.com" }) ``` **PHP** ```php contacts->list([ 'domain' => "yourdomain.com" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Contacts.list({ "domain": "yourdomain.com" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") contacts, err := client.Contacts.List(&senddart.ListContactsRequest{ Domain: "yourdomain.com", }) ``` **Rust** ```rust use senddart::{ListContactsParams, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let _contacts = mb.contacts.list(ListContactsParams::for_domain("yourdomain.com")).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contacts().list("yourdomain.com"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactListAsync(new ContactListOptions { Domain = "yourdomain.com" }); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/contacts?domain=yourdomain.com' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart contacts list \ --domain yourdomain.com ``` **Response (200)** ```json { "object": "list", "has_more": false, "data": [ { "object": "contact", "id": "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6", "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak", "unsubscribed": false, "properties": { "company_name": "Acme Corp" }, "created_at": "2026-06-23T17:30:11.000Z" } ] } ``` Each contact includes `object: "contact"` and a `properties` map (merged with registered fallback values). A missing `domain`, or one that is not one of yours, returns `422 validation_error` — as does a `limit` outside 1-100 (or a non-integer) or `after` and `before` together. An unknown cursor returns an empty page rather than an error. See [Pagination](https://www.senddart.com/docs/api/pagination) and [Errors](https://www.senddart.com/docs/api/errors). ## Audience-scoped variant The nested route `GET /audiences/:audience_id/contacts` still works and lists the contacts of one audience (no `domain` query needed): **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.list({ audienceId: 'AUDIENCE_ID' }); console.log({ data, error }); ``` **Ruby** ```ruby require 'net/http' require 'uri' uri = URI('https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Get.new(uri) req['Authorization'] = 'Bearer mb_xxxxxxxxx' res = http.request(req) puts res.body ``` **PHP** ```php contacts->list([ 'audienceId' => "AUDIENCE_ID" ]); ``` **Python** ```python import requests res = requests.get( "https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts", headers={"Authorization": "Bearer mb_xxxxxxxxx"}, ) print(res.json()) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") contacts, err := client.Contacts.List(&senddart.ListContactsRequest{ AudienceId: "AUDIENCE_ID", }) ``` **Rust** ```rust use senddart::{ListContactsParams, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let _contacts = mb.contacts.list(ListContactsParams::for_audience("AUDIENCE_ID")).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.ListContactsParams; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.contacts().list(ListContactsParams.builder().audienceId("AUDIENCE_ID").build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactListAsync(new ContactListOptions { AudienceId = "AUDIENCE_ID" }); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` --- # Update audience > PATCH /audiences/:id — rename an audience. `PATCH /audiences/:id` Rename an audience. The only field accepted is `name`. Returns the updated audience object. **Body** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | Yes | The new name for the audience. Must be non-empty. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.audiences.update('AUDIENCE_ID', { "name": "Beta Signups" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Audiences.update("AUDIENCE_ID", { "name": "Beta Signups" }) ``` **PHP** ```php audiences->update('AUDIENCE_ID', [ 'name' => "Beta Signups" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Audiences.update("AUDIENCE_ID", { "name": "Beta Signups" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") audience, err := client.Audiences.Update("AUDIENCE_ID", &senddart.UpdateAudienceRequest{ Name: "Beta Signups", }) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _audience = mb.audiences.update("AUDIENCE_ID", "Beta Signups").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.audiences().update("AUDIENCE_ID", "Beta Signups"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AudienceUpdateAsync("AUDIENCE_ID", "Beta Signups"); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/audiences/AUDIENCE_ID' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Beta Signups" }' ``` **CLI** ```bash senddart audiences update AUDIENCE_ID \ --name 'Beta Signups' ``` ### Response ```json { "object": "audience", "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Beta Signups", "created_at": "2026-06-23T17:22:43.000Z" } ``` Omitting `name` (or sending an empty string) returns `422 missing_required_field`. An unknown id returns `404 not_found`. See [Errors](https://www.senddart.com/docs/api/errors). --- # Import contacts (array) > POST /contacts/batch — bulk-import contacts into a sending domain from a JSON array. `POST /contacts/batch` Import up to **10,000 contacts** into one of your **sending domains** in a single request by sending a JSON array. Contacts are domain-scoped, so pass the `domain` they belong to alongside the rows. Invalid rows (missing or malformed `email`) are counted as skipped and never cause the whole request to fail. > **Note:** This is the recommended way to add many contacts. One batch request does the whole import in a single pass — it acquires your account's contact-limit lock once and writes the rows in chunks. Looping [POST /contacts](https://www.senddart.com/docs/api/contacts-create) once per contact does the opposite: every request queues behind the same per-account lock and holds a database connection while it waits, so a few hundred parallel creates get slow and start failing where one batch call finishes in seconds. If you have more than a handful of contacts, send them here — and if you have more than 10,000, send sequential batches rather than parallel single creates. **Body** | Name | Type | Required | Description | | --- | --- | --- | --- | | `domain` | string | Yes | The sending domain these contacts belong to (one of your domains, e.g. `yourdomain.com`). Can also be passed as a query parameter — `?domain=yourdomain.com` — which is what you want when the body is a bare JSON array. A missing `domain`, or one that is not yours, returns `422 validation_error`. | | `contacts` | array | Yes | Array of contact objects to import. You can also send a bare JSON array as the body instead of wrapping it in `{ contacts: [...] }`. | | `contacts[].email` | string | Yes | Email address. Rows with a missing or invalid email are skipped. | | `contacts[].first_name` | string | No | Optional first name. | | `contacts[].last_name` | string | No | Optional last name. | | `contacts[].unsubscribed` | boolean | No | Optional opt-out flag. Defaults to false. | | `contacts[].properties` | object | No | Optional map of custom property key/value pairs. Unlike `POST /contacts`, this endpoint does **not** check keys against your contact-property registry — any key matching `\w{1,64}` is accepted and stored (up to 50 keys per contact, values truncated at 1000 characters). Unregistered keys are written to the contact but have no declared type or fallback, so register them with `POST /contact-properties` if you want them usable as merge tags. | | `on_conflict` | string | No | `upsert` (default) — update the existing contact when the email already exists. `skip` — leave the existing contact untouched. Can also be passed as a query parameter, `?on_conflict=skip`, for use with a bare JSON array body. | **Node.js** ```js const res = await fetch('https://www.senddart.com/api/contacts/batch', { method: 'POST', headers: { 'Authorization': 'Bearer mb_xxxxxxxxx', 'Content-Type': 'application/json', }, body: JSON.stringify({ "domain": "yourdomain.com", "contacts": [ { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak" }, { "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" } ] }), }); const data = await res.json(); console.log(data); ``` **Ruby** ```ruby require 'net/http' require 'uri' uri = URI('https://www.senddart.com/api/contacts/batch') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Post.new(uri) req['Authorization'] = 'Bearer mb_xxxxxxxxx' req['Content-Type'] = 'application/json' req.body = <<~JSON { "domain": "yourdomain.com", "contacts": [ { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak" }, { "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" } ] } JSON res = http.request(req) puts res.body ``` **PHP** ```php 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer mb_xxxxxxxxx', 'User-Agent: my-app/1.0', 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => <<<'JSON' { "domain": "yourdomain.com", "contacts": [ { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak" }, { "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" } ] } JSON, ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` **Python** ```python import requests res = requests.post( "https://www.senddart.com/api/contacts/batch", headers={"Authorization": "Bearer mb_xxxxxxxxx", "Content-Type": "application/json"}, json={ "domain": "yourdomain.com", "contacts": [ { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak" }, { "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" } ] }, ) print(res.json()) ``` **Go** ```go package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, _ := http.NewRequest("POST", "https://www.senddart.com/api/contacts/batch", strings.NewReader(`{ "domain": "yourdomain.com", "contacts": [ { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak" }, { "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" } ] }`)) req.Header.Set("Authorization", "Bearer mb_xxxxxxxxx") req.Header.Set("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(string(out)) } ``` **Rust** ```rust use reqwest::Client; #[tokio::main] async fn main() -> Result<(), Box> { let res = Client::new() .post("https://www.senddart.com/api/contacts/batch") .header("Authorization", "Bearer mb_xxxxxxxxx") .header("User-Agent", "my-app/1.0") .header("Content-Type", "application/json") .body(r#"{ "domain": "yourdomain.com", "contacts": [ { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak" }, { "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" } ] }"#) .send() .await?; println!("{}", res.text().await?); Ok(()) } ``` **Java** ```java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; var client = HttpClient.newHttpClient(); var request = HttpRequest.newBuilder() .uri(URI.create("https://www.senddart.com/api/contacts/batch")) .header("Authorization", "Bearer mb_xxxxxxxxx") .header("User-Agent", "my-app/1.0") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString(""" { "domain": "yourdomain.com", "contacts": [ { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak" }, { "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" } ] } """)) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); ``` **.NET** ```csharp using System.Net.Http; using System.Text; var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://www.senddart.com/api/contacts/batch"); request.Headers.Add("Authorization", "Bearer mb_xxxxxxxxx"); request.Headers.Add("User-Agent", "my-app/1.0"); request.Content = new StringContent(@"{ ""domain"": ""yourdomain.com"", ""contacts"": [ { ""email"": ""steve@example.com"", ""first_name"": ""Steve"", ""last_name"": ""Wozniak"" }, { ""email"": ""ada@example.com"", ""first_name"": ""Ada"", ""last_name"": ""Lovelace"" } ] }", Encoding.UTF8, "application/json"); var response = await client.SendAsync(request); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/contacts/batch' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "domain": "yourdomain.com", "contacts": [ { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak" }, { "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" } ] }' ``` ### Response ```json { "object": "contact_import", "imported": 1, "updated": 1, "skipped": 0, "total": 2 } ``` `imported` counts new contacts; `updated` counts existing contacts merged by email. `skipped` includes invalid email rows and conflicts skipped by request. `total` counts source rows including duplicates, so it need not equal the sum of the other counts. `limit_skipped` and `system_skipped` are retained for compatibility and are zero: stored contacts are unlimited. All plans support unlimited stored contacts. Each import is serialized and committed atomically. The JSON batch API accepts up to 10,000 rows per request; larger CSVs use the direct-S3 upload and preview flow. ## Audience-scoped variant The nested route `POST /audiences/:audience_id/contacts/batch` imports the same JSON array into one specific audience instead of a domain — no `domain` field in the body. Everything else (the 10,000-row limit, `on_conflict`, the response, the contact-limit behaviour) is identical: **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.batch({ audienceId: 'AUDIENCE_ID', "contacts": [ { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak" }, { "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Contacts.batch({ "audience_id": "AUDIENCE_ID", "contacts": [ { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak" }, { "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" } ] }) ``` **PHP** ```php contacts->batch([ 'audienceId' => "AUDIENCE_ID", 'contacts' => [ [ 'email' => "steve@example.com", 'first_name' => "Steve", 'last_name' => "Wozniak" ], [ 'email' => "ada@example.com", 'first_name' => "Ada", 'last_name' => "Lovelace" ] ] ]); ``` **Python** ```python import requests res = requests.post( "https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/batch", headers={"Authorization": "Bearer mb_xxxxxxxxx", "Content-Type": "application/json"}, json={ "contacts": [ { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak" }, { "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" } ] }, ) print(res.json()) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") imported, err := client.Contacts.Batch(&senddart.BatchContactsRequest{ AudienceId: "AUDIENCE_ID", Contacts: []senddart.ContactInput{ { Email: "steve@example.com", FirstName: "Steve", LastName: "Wozniak", }, {Email: "ada@example.com", FirstName: "Ada", LastName: "Lovelace"}, }, }) ``` **Rust** ```rust use senddart::{ContactInput, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let items = vec![ ContactInput::new("steve@example.com") .with_first_name("Steve") .with_last_name("Wozniak"), ContactInput::new("ada@example.com") .with_first_name("Ada") .with_last_name("Lovelace"), ]; let _imported = mb.contacts.batch("AUDIENCE_ID", items, None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.BatchContactsRequest; import com.senddart.requests.ContactInput; SendDart senddart = new SendDart("mb_xxxxxxxxx"); BatchContactsRequest request = BatchContactsRequest.builder() .audienceId("AUDIENCE_ID") .contact(ContactInput.builder() .email("steve@example.com") .firstName("Steve") .lastName("Wozniak") .build()) .contact(ContactInput.builder() .email("ada@example.com") .firstName("Ada") .lastName("Lovelace") .build()) .build(); SendDartResponse response = senddart.contacts().batch(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactBatchAsync("AUDIENCE_ID", new List { new() { Email = "steve@example.com", FirstName = "Steve", LastName = "Wozniak", }, new() { Email = "ada@example.com", FirstName = "Ada", LastName = "Lovelace", }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/batch' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "contacts": [ { "email": "steve@example.com", "first_name": "Steve", "last_name": "Wozniak" }, { "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace" } ] }' ``` An empty or entirely-invalid contacts array returns `422 validation_error`. More than 10,000 rows per request is rejected with `422 validation_error`. On the domain-scoped route a missing `domain`, a `domain` that is not one of yours, or an `audience_id` in the body returns `422 validation_error`; on the audience-scoped route an unknown audience returns `404 not_found`. See [Errors](https://www.senddart.com/docs/api/errors). --- # Import contacts (CSV) > POST /audiences/:audience_id/contacts/import — bulk-import contacts from a CSV. `POST /audiences/:audience_id/contacts/import` Import up to **10,000 contacts** (max **5 MB**) from a CSV. The CSV can be sent as a JSON body field or as a raw `text/csv` / `text/plain` body. A header row is optional — if present, column names are matched to contact fields (`email`, `first_name`, `last_name`, `unsubscribed`). By default, any other columns are **automatically registered as custom properties** (so `company`, `plan`, … survive and become `{{merge}}` tags). Pass `?create_properties=false` on the query string for strict mode, where only columns matching an already-registered property are kept and the rest are reported in `ignored_columns`. **Body** | Name | Type | Required | Description | | --- | --- | --- | --- | | `csv` | string | Yes | CSV text. The `email` column is always required. Other columns map to contact fields or custom properties. You can also `POST` a raw `text/csv` body instead of a JSON wrapper. | | `on_conflict` | string | No | `upsert` (default) — update the existing contact when the email already exists. `skip` — leave it untouched. Can also be passed as a query parameter `?on_conflict=skip` when using a raw CSV body. | **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `create_properties` | boolean | No | Read from the **query string only** — a `create_properties` field in the JSON body is ignored. Defaults to `true`, so non-builtin CSV columns are auto-registered as string custom properties (up to 50 new per import) and no data is silently dropped. Pass `?create_properties=false` to keep only already-registered columns. | | `segment_id` | string | No | Read from the **query string only**. Also add every imported email to this [segment](https://www.senddart.com/docs/segments/overview). The segment must be one of yours and must belong to the audience you are importing into — otherwise the request is rejected with `422 validation_error` before any contact is written. When set, the response carries a `segment_added` count. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.contacts.import({ audienceId: 'AUDIENCE_ID', "csv": "email,first_name,last_name\nsteve@example.com,Steve,Wozniak\nada@example.com,Ada,Lovelace" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Contacts.import({ "audience_id": "AUDIENCE_ID", "csv": "email,first_name,last_name steve@example.com,Steve,Wozniak ada@example.com,Ada,Lovelace" }) ``` **PHP** ```php contacts->import([ 'audienceId' => "AUDIENCE_ID", 'csv' => "email,first_name,last_name steve@example.com,Steve,Wozniak ada@example.com,Ada,Lovelace" ]); ``` **Python** ```python import requests res = requests.post( "https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/import", headers={"Authorization": "Bearer mb_xxxxxxxxx", "Content-Type": "application/json"}, json={ "csv": "email,first_name,last_name\nsteve@example.com,Steve,Wozniak\nada@example.com,Ada,Lovelace" }, ) print(res.json()) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") imported, err := client.Contacts.Import(&senddart.ImportContactsRequest{ AudienceId: "AUDIENCE_ID", Csv: "email,first_name,last_name\nsteve@example.com,Steve,Wozniak\nada@example.com,Ada,Lovelace", }) ``` **Rust** ```rust use senddart::{ImportCsvOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let _imported = mb.contacts.import("AUDIENCE_ID", "email,first_name,last_name\nsteve@example.com,Steve,Wozniak\nada@example.com,Ada,Lovelace", ImportCsvOptions::new()).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.ImportContactsRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); ImportContactsRequest request = ImportContactsRequest.builder() .audienceId("AUDIENCE_ID") .csv("email,first_name,last_name\nsteve@example.com,Steve,Wozniak\nada@example.com,Ada,Lovelace") .build(); SendDartResponse response = senddart.contacts().importCsv(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ContactImportAsync( "AUDIENCE_ID", "email,first_name,last_name\nsteve@example.com,Steve,Wozniak\nada@example.com,Ada,Lovelace"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/audiences/AUDIENCE_ID/contacts/import' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "csv": "email,first_name,last_name\nsteve@example.com,Steve,Wozniak\nada@example.com,Ada,Lovelace" }' ``` ### Response (201) ```json { "object": "contact_import", "imported": 1, "updated": 1, "skipped": 0, "total": 2, "invalid_rows": 0, "limit_skipped": 0, "system_skipped": 0, "ignored_columns": [], "source_file": { "file_name": "contacts.csv", "storage_key": "contact-imports/9f3c1d7a4b2e6058c1d9e2f4/2026/06/23/20260623T172243000Z-7d3f0c1a-5b8e-4a92-9c07-1f6d2e4b8a35/contacts.csv", "archived": true }, "contact_limit": { "plan": { "id": "free", "name": "Free" }, "used_before": 12, "limit": 0, "remaining_before": null, "remaining_after": null, "limit_skipped": 0, "reached": false, "message": "Your plan includes unlimited stored contacts. Added 1 new contact and updated 1 existing contact. The complete original CSV is safely archived." } } ``` `imported` counts new contacts; `updated` counts existing contacts merged by email. `skipped` includes invalid email rows and conflicts skipped by request. `total` counts source rows including duplicates, so it need not equal the sum of the other counts. `limit_skipped` and `system_skipped` are retained for compatibility and are zero: stored contacts are unlimited. `ignored_columns` lists unregistered fields omitted when create_properties=false. source_file identifies the original S3 archive; send storage_key instead of csv to re-import without re-uploading. contact_limit remains a compatibility field: limit=0 and remaining=null mean unlimited storage. segment_added counts newly created memberships. Contacts and segment membership are committed atomically. An empty CSV, malformed quoting, invalid UTF-8, ambiguous column names, or more than 50 custom property columns is rejected. Property values can contain up to 1,000 characters. Invalid email rows are counted and skipped. Inline API imports support up to 10,000 contacts; the direct-S3 dashboard path supports larger row counts within the file-size limit. Unknown audiences return 404. --- # Create campaign > POST /campaigns — create a draft campaign against a sending domain. `POST /campaigns` Creates a **draft** campaign. The `domain` selects the recipients — the campaign sends to that domain’s contact pool — and the `from` address must be on a verified domain (it does not have to match `domain`). You must supply `html`, `text`, or both. Returns the new campaign `id`. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `domain` | string | Yes | The sending domain whose contacts receive the campaign (one of your domains). Orthogonal to `from` — the from address may be on a different verified domain. Passing `audience_id` is no longer accepted — pass `domain`. | | `from` | string | Yes | Sender address on a verified domain, e.g. `Acme `. | | `subject` | string | Yes | Subject line. Supports merge tags. | | `html` | string | No | HTML body. Required if `text` is omitted. Supports merge tags. Markdown-style `[text](url)` links and bare URLs (`https://…` / `www.…`) in the body text are converted to tracked hyperlinks automatically at send time; content already inside `
` tags, attribute values, and `
`/`` blocks is left untouched. |
| `text` | string | No | Plain-text body. Required if `html` is omitted. Supports merge tags. |
| `reply_to` | string | string[] | No | Optional Reply-To address. For multiple addresses, send an array of strings. |
| `name` | string | No | The friendly name of the campaign. Only used for internal reference. |
| `preview_text` | string | No | Optional preview text shown in the inbox after the subject line. Supports merge tags (rendered per recipient). Max **150 characters**. Follow-ups do not inherit it. |
| `segment_id` | string | No | Narrow the send to a segment of the domain’s contacts. The segment must belong to the same domain. |
| `topic_id` | string | No | Gate the send on topic subscription — only recipients subscribed to this topic receive the campaign. |
| `send` | boolean | No | When `true`, send (or schedule) the campaign immediately after create, without a separate `POST /campaigns/:id/send` call. |
| `scheduled_at` | string | No | Used with `send: true`. ISO 8601 timestamp or natural-language phrase (e.g. `in 1 hour`). If in the future the campaign is scheduled rather than sent now. Cannot be more than 30 days in the future. |
| `schedule_timezone` | string | No | Optional. IANA timezone name (e.g. `America/New_York`) the `scheduled_at` wall-clock time is interpreted in — also the zone daily batches roll over in. A `scheduled_at` that already carries a UTC offset (e.g. a trailing `Z`) is used as-is. Defaults to your account timezone for batch rollover; while it is unset, an offset-less `scheduled_at` is read as UTC. |
| `daily_batch_size` | number | No | Optional. Send to at most this many recipients per day — an integer between `1` and `100000`. Delivery continues the next day at the same local time until every contact is reached. Omit (or pass `null`) to send to everyone at once. |
| `recurrence` | string | No | Make the campaign repeat on a cadence: `daily`, `weekly`, or `monthly`. |
| `recurrence_every` | number | No | Number of periods between recurring sends (1–365). Defaults to `1`. |
| `ab_test` | object | No | A/B test configuration. Set `enabled: true` and supply at least one variant-B field (`subject_b`, `html_b`, `text_b`). `test_pct` (1–100, default 20) controls the split; `metric` (`open`, `click`, or `reply`, default `open`) picks the winner; `eval_hours` (1–168) sets how long to run the test before evaluating and sending the winner. |

**Node.js**

```js
import { SendDart } from 'senddart';

const mb = new SendDart('mb_xxxxxxxxx');

const { data, error } = await mb.campaigns.create({
  "domain": "yourdomain.com",
  "from": "Acme ",
  "subject": "What's new in June",
  "html": "

Hi {{FIRST_NAME}}!

", "name": "June newsletter" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.create({ "domain": "yourdomain.com", "from": "Acme ", "subject": "What's new in June", "html": "

Hi {{FIRST_NAME}}!

", "name": "June newsletter" }) ``` **PHP** ```php campaigns->create([ 'domain' => "yourdomain.com", 'from' => "Acme ", 'subject' => "What's new in June", 'html' => "

Hi {{FIRST_NAME}}!

", 'name' => "June newsletter" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.create({ "domain": "yourdomain.com", "from": "Acme ", "subject": "What's new in June", "html": "

Hi {{FIRST_NAME}}!

", "name": "June newsletter" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") campaign, err := client.Campaigns.Create(&senddart.CreateCampaignRequest{ Domain: "yourdomain.com", From: "Acme ", Subject: "What's new in June", Html: "

Hi {{FIRST_NAME}}!

", Name: "June newsletter", }) ``` **Rust** ```rust use senddart::{CreateCampaignOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateCampaignOptions::new( "yourdomain.com", "Acme ", "What's new in June", ) .with_html("

Hi {{FIRST_NAME}}!

") .with_name("June newsletter"); let _campaign = mb.campaigns.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateCampaignRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateCampaignRequest request = CreateCampaignRequest.builder() .domain("yourdomain.com") .from("Acme ") .subject("What's new in June") .html("

Hi {{FIRST_NAME}}!

") .name("June newsletter") .build(); SendDartResponse response = senddart.campaigns().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignCreateAsync(new CampaignCreateOptions { Domain = "yourdomain.com", From = "Acme ", Subject = "What's new in June", HtmlBody = "

Hi {{FIRST_NAME}}!

", Name = "June newsletter", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/campaigns' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "domain": "yourdomain.com", "from": "Acme ", "subject": "What'\''s new in June", "html": "

Hi {{FIRST_NAME}}!

", "name": "June newsletter" }' ``` **CLI** ```bash senddart campaigns create \ --domain 'yourdomain.com' \ --from 'Acme ' \ --subject 'What'\''s new in June' \ --html '

Hi {{FIRST_NAME}}!

' \ --name 'June newsletter' ``` ### Response ```json { "id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90" } ``` > **Note:** Errors: `missing_required_field` if `from`, `subject`, or `domain` is absent; `validation_error` if neither `html` nor `text` is provided, the domain is not yours, or `audience_id` is passed (no longer accepted — pass `domain`); `invalid_from_address` if `from` is malformed. --- # Retrieve campaign > GET /campaigns/:id — fetch a single campaign. `GET /campaigns/:id` Returns the campaign object for one of your campaigns. Campaigns created via both the API and the dashboard can be retrieved. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The campaign ID. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.get('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.get("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **PHP** ```php campaigns->get('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.get("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") campaign, err := client.Campaigns.Get("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _campaign = mb.campaigns.get("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.campaigns().get("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignRetrieveAsync("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/campaigns/8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart campaigns get 8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90 ``` ### Response **Response fields** | Name | Type | Required | Description | | --- | --- | --- | --- | | `object` | string | No | Always `campaign`. | | `id` | string | No | The campaign ID. | | `name` | string | null | No | The internal name of the campaign. | | `audience_id` | string | No | The contact pool the campaign targets — the id of the domain’s per-domain audience. | | `segment_id` | string | null | No | The segment the campaign is narrowed to, or `null`. | | `topic_id` | string | null | No | The topic gate, or `null`. | | `from` | string | null | No | The sender address. | | `subject` | string | null | No | The subject line. | | `reply_to` | string | string[] | null | No | The Reply-To address(es), or `null` if unset. | | `preview_text` | string | null | No | The inbox preview text, or `null` if unset. | | `html` | string | null | No | The HTML body, or `null` if unset. | | `text` | string | null | No | The plain-text body, or `null` if unset. | | `status` | string | No | One of `draft`, `scheduled`, `queued`, `paused`, `canceled`, `sent`, `failed`, or `recurring`. See [Statuses](https://www.senddart.com/docs/campaigns/managing). | | `scheduled_at` | string | null | No | ISO 8601 send time if scheduled, otherwise `null`. | | `sent_at` | string | null | No | ISO 8601 time the send began, otherwise `null`. | | `created_at` | string | No | ISO 8601 creation time. | | `ab_test` | object | No | A/B test configuration. Always present. `{ enabled: false }` when A/B is not active; when active includes `subject_b`, `test_pct`, `metric`, `status`, and `winner`. | | `recurrence` | object | null | No | Recurrence config `{ interval, every }` for a recurring campaign, or `null`. | | `parent_campaign_id` | string | null | No | For a recurring child send, the ID of the template campaign; `null` otherwise. | | `statistics` | object | No | Aggregate delivery and engagement stats: the counts `total`, `delivered`, `opened`, `clicked`, `replied`, `bounced`, `complained`, plus a `rates` object with `delivery`, `open`, `click`, `reply`, `bounce` and `complaint` percentages, each rounded to **one decimal place**. `open`, `click` and `reply` rates use `delivered` as the denominator (falling back to `total` when no delivery events were recorded); `delivery`, `bounce` and `complaint` use `total`. [`GET /campaigns/:id/stats`](https://www.senddart.com/docs/campaigns/tracking) returns these same fields alongside a `links` array. | | `followups` | array | No | Follow-up sends configured on the campaign — each `{ id, condition, delay, subject, html, status, run_at, sent_count }`. `condition` is one of `opened`, `clicked`, `not_opened`, `not_clicked`, `replied`, `not_replied`; `delay` is a duration like `"5 hours"` or `"4 days"`. Empty array when none. | | `list_address` | string | null | No | The `List-Unsubscribe` mailbox for this campaign, or `null` to use the account default. | | `unsubscribe_policy` | string | No | How unsubscribes are scoped: `account` (default), `domain`, or `ignore`. | ```json { "object": "campaign", "id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", "name": "June newsletter", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "segment_id": null, "topic_id": null, "from": "Acme ", "subject": "What's new in June", "reply_to": null, "preview_text": "Check out what shipped this month", "html": "

Hi {{FIRST_NAME}}!

", "text": "Hi {{FIRST_NAME}}!", "status": "sent", "scheduled_at": null, "sent_at": "2026-06-23T10:20:00.000Z", "created_at": "2026-06-23T10:00:00.000Z", "ab_test": { "enabled": false }, "recurrence": null, "parent_campaign_id": null, "statistics": { "total": 1240, "delivered": 1216, "opened": 498, "clicked": 96, "replied": 12, "bounced": 18, "complained": 1, "rates": { "delivery": 98.1, "open": 41, "click": 7.9, "reply": 1, "bounce": 1.5, "complaint": 0.1 } } } ``` > **Note:** Errors: `not_found` if the campaign does not exist or is not yours. --- # List campaigns > GET /campaigns — list your campaigns, newest first. `GET /campaigns` Returns your campaigns ordered by creation time (newest first), wrapped in a list object. The `limit` parameter is optional — if you omit it, up to 1,000 campaigns are returned in one response, with `has_more` set to `true` when more exist beyond that ceiling. Page through the remainder with `after`. **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of campaigns to retrieve. Minimum `1`, maximum `100`. | | `after` | string | No | The ID after which to retrieve more campaigns (pagination). The ID itself is excluded. Cannot be combined with `before`. | | `before` | string | No | The ID before which to retrieve more campaigns (pagination). The ID itself is excluded. Cannot be combined with `after`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.list(); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.list ``` **PHP** ```php campaigns->list(); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.list() ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") campaigns, err := client.Campaigns.List(nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _campaigns = mb.campaigns.list(None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.campaigns().list(); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignListAsync(); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/campaigns' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart campaigns list ``` ### Response Returns a list object. `has_more` indicates whether further pages exist beyond the returned set. ```json { "object": "list", "has_more": false, "data": [ { "id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", "name": "June newsletter", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "segment_id": null, "status": "sent", "ab_test": { "enabled": false }, "scheduled_at": null, "sent_at": "2026-06-23T10:20:00.000Z", "created_at": "2026-06-23T10:00:00.000Z" } ] } ``` --- # Update campaign > PATCH /campaigns/:id — edit a draft campaign. `PATCH /campaigns/:id` Partially updates a campaign. Only a **draft** can be edited — any other status (`scheduled`, `queued`, `paused`, `recurring`, `canceled`, `sent` or `failed`) returns a `validation_error`. Send only the fields you want to change. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The ID of the campaign you want to update. | **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `domain` | string | No | Re-point the campaign at another sending domain’s contacts (draft only). Must be one of your domains. Changing the domain automatically clears `segment_id` and `topic_id` unless new values are provided in the same request. Passing `audience_id` is no longer accepted. | | `from` | string | No | Sender address on a verified domain. | | `subject` | string | No | Subject line. | | `reply_to` | string | string[] | No | Reply-To address. For multiple addresses, send an array of strings. | | `html` | string | No | HTML body. | | `text` | string | No | Plain-text body. If omitted, a plain-text version is generated from the HTML; set it to an empty string to opt out. | | `name` | string | No | The friendly name of the campaign. Only used for internal reference. | | `preview_text` | string | null | No | Inbox preview text shown after the subject line (max **150 characters**; supports merge tags). Pass `null` to clear. | | `segment_id` | string | null | No | Re-target a segment. Pass `null` to remove the segment filter. The segment must belong to the same domain. | | `topic_id` | string | null | No | Re-target a topic gate. Pass `null` to remove it. | | `schedule_timezone` | string | null | No | IANA timezone name (e.g. `America/New_York`) the campaign’s `scheduled_at` wall-clock time is interpreted in — also the zone daily batches roll over in. A `scheduled_at` that already carries a UTC offset (e.g. a trailing `Z`) is used as-is. Pass `null` to clear (batch rollover then falls back to your account timezone; an offset-less `scheduled_at` is read as UTC). | | `daily_batch_size` | number | null | No | Send to at most this many recipients per day — an integer between `1` and `100000`. Delivery continues the next day at the same local time until every contact is reached. Pass `null` to send to everyone at once. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.update('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90', { "subject": "Updated subject" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.update("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", { "subject": "Updated subject" }) ``` **PHP** ```php campaigns->update('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90', [ 'subject' => "Updated subject" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.update("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", { "subject": "Updated subject" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") updated, err := client.Campaigns.Update("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", &senddart.UpdateCampaignRequest{ Subject: "Updated subject", }) ``` **Rust** ```rust use senddart::{SendDart, UpdateCampaignOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateCampaignOptions::new().with_subject("Updated subject"); let _updated = mb.campaigns.update("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.UpdateCampaignRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.campaigns().update( "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", UpdateCampaignRequest.builder().subject("Updated subject").build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignUpdateAsync( "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", new CampaignUpdateOptions { Subject = "Updated subject" }); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/campaigns/8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "subject": "Updated subject" }' ``` **CLI** ```bash senddart campaigns update 8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90 \ --subject 'Updated subject' ``` ### Response ```json { "id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90" } ``` > **Note:** Errors: `not_found` if the campaign is not yours; `validation_error` if it is not a draft, `domain` does not reference one of your domains, or `audience_id` is passed (no longer accepted). --- # Send campaign > POST /campaigns/:id/send — send a draft now or schedule it. `POST /campaigns/:id/send` Sends a draft campaign. With no body it begins sending immediately (status → `queued`). Pass a future `scheduled_at` to schedule it (status → `scheduled`). A campaign that has a `recurrence` becomes a template instead (status → `recurring`) and each occurrence is sent as its own child campaign. The campaign must be a draft with a `from`, a `subject`, a body, and a verified from-domain. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The campaign ID. | **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `scheduled_at` | string | No | Optional. Schedule the send for later. Accepts an ISO 8601 timestamp (e.g. `2026-07-01T09:00:00Z`) or natural language (e.g. `in 1 min`, `in 1 hour`). If in the future, the campaign is scheduled rather than sent now. Cannot be more than 30 days in the future. | | `schedule_timezone` | string | No | Optional. IANA timezone name (e.g. `America/New_York`) the `scheduled_at` wall-clock time is interpreted in — also the zone daily batches roll over in. A `scheduled_at` that already carries a UTC offset (e.g. a trailing `Z`) is used as-is. Defaults to your account timezone for batch rollover; while it is unset, an offset-less `scheduled_at` is read as UTC. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.send('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90', { "scheduled_at": "2026-07-01T09:00:00Z" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.send("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", { "scheduled_at": "2026-07-01T09:00:00Z" }) ``` **PHP** ```php campaigns->send('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90', [ 'scheduled_at' => "2026-07-01T09:00:00Z" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.send("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", { "scheduled_at": "2026-07-01T09:00:00Z" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Campaigns.Send("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", &senddart.SendCampaignRequest{ ScheduledAt: "2026-07-01T09:00:00Z", }) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _sent = mb.campaigns.send("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", Some("2026-07-01T09:00:00Z")).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.campaigns().send( "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", "2026-07-01T09:00:00Z"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignSendAsync( "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", "2026-07-01T09:00:00Z"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/campaigns/8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90/send' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "scheduled_at": "2026-07-01T09:00:00Z" }' ``` **CLI** ```bash senddart campaigns send 8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90 \ --scheduled-at '2026-07-01T09:00:00Z' ``` ### Response ```json { "id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90" } ``` > **Note:** Errors: `not_found` if the campaign is not yours; `validation_error` if it is already queued/scheduled/sent, is missing a `from`/`subject`/body, has an unverified from-domain, or `scheduled_at` is not a valid timestamp. --- # Cancel campaign > POST /campaigns/:id/cancel — return a scheduled campaign to draft, or terminally stop one that is already sending. `POST /campaigns/:id/cancel` Cancels a campaign that still has pending work. A `scheduled`, `recurring` or reputation-`paused` campaign has its pending job dropped and returns to the `draft` status, so you can edit it and send or schedule it again. A campaign that is already sending (reported as `queued`) is **stopped** instead: all remaining work is cancelled and it becomes the terminal status `canceled`, which cannot be resumed or re-sent. Returns the updated campaign object. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The campaign ID. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.cancel('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.cancel("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **PHP** ```php campaigns->cancel('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.cancel("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") campaign, err := client.Campaigns.Cancel("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _campaign = mb.campaigns.cancel("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.campaigns().cancel("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignCancelAsync("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/campaigns/8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90/cancel' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart campaigns cancel 8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90 ``` ### Response ```json { "object": "campaign", "id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", "name": "June newsletter", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "segment_id": null, "topic_id": null, "from": "Acme ", "subject": "What's new in June", "html": "

Hi {{FIRST_NAME}}!

", "text": "Hi {{FIRST_NAME}}!", "reply_to": null, "preview_text": null, "status": "draft", "scheduled_at": null, "sent_at": null, "created_at": "2026-06-23T10:00:00.000Z", "ab_test": { "enabled": false }, "recurrence": null, "parent_campaign_id": null } ``` > **Note:** Errors: `not_found` if the campaign does not exist or is not yours; `validation_error` if it is not in one of the four cancelable states (`scheduled`, `recurring`, `paused`, or `queued`). --- # Delete campaign > DELETE /campaigns/:id — permanently delete a campaign. `DELETE /campaigns/:id` Permanently deletes a campaign. This cannot be undone. You can delete campaigns in `draft`, `scheduled`, `recurring`, `sent`, `failed`, or `canceled` status. Pending sends and follow-ups are canceled. Sent emails and delivery events remain in Emails; the campaign and its statistics page are removed. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The campaign ID. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.remove('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.delete("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **PHP** ```php campaigns->remove('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.remove("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Campaigns.Remove("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _removed = mb.campaigns.remove("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.campaigns().remove("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignDeleteAsync("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/campaigns/8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart campaigns delete 8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90 ``` ### Response ```json { "object": "campaign", "id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", "deleted": true } ``` > **Note:** Errors: `not_found` if the campaign does not exist or is not yours; `validation_error` (422) if the campaign is queued or paused, or a background job is still running. Stop the campaign or its follow-ups and wait for running work to finish before retrying. --- # Get Campaign A/B Result > GET /campaigns/:id/ab — retrieve the A/B winner evaluation for a campaign. `GET /campaigns/:id/ab` Returns the A/B winner evaluation for a campaign that has A/B testing enabled. SendDart runs a **two-proportion z-test** over the per-variant open, click, or reply outcomes recorded in the tracking tables, and returns which variant won, how confident the result is, and detailed per-variant metrics. The `metric` field reflects the `ab_metric` set on the campaign (`open`, `click`, or `reply`). The `confidence` field is `low` when the sample is too small to trust, `medium` when the winner leads but it is not conclusive, and `high` when the result is statistically significant (p < 0.05 with at least 20 sends per arm). If the variants are tied or one arm has no sends, the winner defaults to `A` and `fallback` is `true`. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The campaign ID. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.ab('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.ab("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **PHP** ```php campaigns->ab('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.ab("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") result, err := client.Campaigns.Ab("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _result = mb.campaigns.ab("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.campaigns().ab("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignRetrieveAbResultAsync("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/campaigns/8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90/ab' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart campaigns ab 8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90 ``` ### Response ```json { "object": "campaign_ab", "campaign_id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", "metric": "open", "a": { "variant": "A", "sent": 120, "conversions": 36, "rate": 0.3 }, "b": { "variant": "B", "sent": 118, "conversions": 47, "rate": 0.3983050847457627 }, "winner": "B", "fallback": false, "lift": 0.3276785714285714, "zScore": 2.14, "pValue": 0.0162, "confidence": "high", "reason": "variant B wins on open (p=0.016)" } ``` > **Note:** Errors: `not_found` if the campaign does not exist or is not yours; `validation_error` if the campaign does not have A/B testing enabled. --- # Get Campaign Engagement > GET /campaigns/:id/engagement — list the individual recipients who opened, clicked, or replied. `GET /campaigns/:id/engagement` Returns the **per-recipient** engagement for a campaign: who opened it, who clicked a link, and who replied. Where the campaign object carries roll-up counts, this endpoint names the individual contacts behind them, so you can sync engaged recipients into a segment or your own CRM. Each list is ordered newest engagement first and is capped at **500 rows**. There are no pagination parameters — `limit`, `after`, and `before` are ignored — so a campaign with more than 500 openers returns only the 500 most recent. Reply text is clipped to 300 characters; fetch the full body with [GET /emails/receiving/:id](https://www.senddart.com/docs/api/emails-received-get) using `received_email_id`. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The campaign ID. | ### Response fields | Name | Type | Required | Description | | --- | --- | --- | --- | | `object` | string | No | Always `campaign_engagement`. | | `campaign_id` | string | No | The campaign this engagement belongs to. | | `opened` | array | No | Recipients who opened, each with `email`, `contact_id` (nullable), `opened_at`, and `open_count`. | | `clicked` | array | No | Recipients who clicked a tracked link, each with `email`, `contact_id` (nullable), `clicked_at`, and `click_count`. | | `replied` | array | No | Replies received, each with `email`, `contact_id` (nullable), `replied_at` (nullable), `received_email_id`, `subject`, `preview`, `category` (the AI reply intent — `interested`, `neutral`, `not_interested`, or `null` when not yet classified), and `received_at`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.engagement('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.engagement("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **PHP** ```php campaigns->engagement('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.engagement("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") engagement, err := client.Campaigns.Engagement("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _engagement = mb.campaigns.engagement("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.campaigns().engagement("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignRetrieveEngagementAsync("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/campaigns/8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90/engagement' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` ### Response ```json { "object": "campaign_engagement", "campaign_id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", "opened": [ { "email": "ada@example.com", "contact_id": "3c1f7b90-52ad-4e6b-9f01-8d4c2b6e7a13", "opened_at": "2026-06-23T22:41:08.113Z", "open_count": 3 } ], "clicked": [ { "email": "ada@example.com", "contact_id": "3c1f7b90-52ad-4e6b-9f01-8d4c2b6e7a13", "clicked_at": "2026-06-23T22:42:55.007Z", "click_count": 1 } ], "replied": [ { "email": "grace@example.com", "contact_id": null, "replied_at": "2026-06-24T08:12:00.412Z", "received_email_id": "b41d9e77-1c05-4f2a-8ab3-6e9d0f5c1274", "subject": "Re: Launch week", "preview": "Looks great — can you send me the pricing sheet?", "category": "interested", "received_at": "2026-06-24T08:12:00.412Z" } ] } ``` > **Note:** Requires a full-access key (read scope). Errors: `not_found` if the campaign does not exist or is not yours. --- # Create API key > POST /api-keys — dashboard-only. Keys are generated in the dashboard; an API key cannot mint a key. `POST /api-keys` > **Warning:** **Dashboard-only.** API keys are generated on the website. A request authenticated with an API key is refused with `403 dashboard_only` — "API keys can only be created, edited and revoked from the SendDart dashboard, not with an API key." — no matter what permission that key holds. Create keys from the dashboard under **API Keys**. > **Note:** This is a **breaking change**. Automation that used to mint keys with a `full_access` key now receives `403 dashboard_only` and must be replaced by a person creating the key in the dashboard and storing it in your secret manager. The official SDKs deliberately expose no method for this endpoint. Creates a new API key and returns the full `mb_...` token **once**. Only the hash and prefix are stored, so copy the token immediately. The reference below describes the request the dashboard makes on your behalf with a signed-in session — it is not callable with an API key. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | Yes | A label for the key. Maximum 50 characters. | | `permission` | full_access | sending_access | No | The access level. `full_access` (default) can create, delete, get, and update any resource; `sending_access` can only send emails. | | `domain_ids` | string[] | No | Restrict the key to send only from these domains — enforced on every send surface (`POST /emails`, batch, campaign sends, and receiving reply/forward). Only valid with `sending_access` — full-access keys always work across all your domains. Omit (or send an empty array) to allow all domains. | | `domain_id` | string | No | Legacy single-domain form of `domain_ids`. Provide one or the other, not both. | ### Response For the dashboard session, the created key is returned with its one-time `token`: ```json { "id": "1042", "object": "api_key", "token": "mb_AbC123dEf456GhI789jKl012mNoPqRs", "domain_id": null, "domain_ids": null } ``` ### Response to an API-key caller ```json { "statusCode": 403, "name": "dashboard_only", "message": "API keys can only be created, edited and revoked from the SendDart dashboard, not with an API key." } ``` > **Warning:** The `token` is shown exactly once. Errors: `dashboard_only` (403) for **every** API-key caller — this check runs before any validation; `missing_required_field` if `name` is absent; `validation_error` if `permission` is not `full_access` or `sending_access`, if both `domain_id` and `domain_ids` are provided, if a domain restriction is combined with `full_access`, if `domain_ids` references a domain that is not yours, or if `domain_ids` contains more than 50 domains. Two 429s guard key sprawl: `rate_limit_exceeded` — "Max 5 keys per hour. Try again later." — once you have created 5 keys in the last hour, and `max_active_keys` — "Max 20 active keys. Revoke unused keys first." — once 20 unrevoked keys already exist on the account. --- # List API keys > GET /api-keys — list your API keys (metadata only). `GET /api-keys` Lists your API keys. Each entry includes a non-secret token **prefix** (`token`) for display — the full secret is stored only as a hash and is shown once, at creation, never again. The `limit` parameter is optional — if you omit it, up to 1,000 keys are returned in one response, with `has_more` set to `true` when more exist beyond that ceiling. Page through the remainder with `after`. > **Note:** Unlike creating, updating and revoking keys — which are [dashboard-only](https://www.senddart.com/docs/api/api-keys-create) — listing is unchanged and **is** callable with an API key. It is read-only: it returns metadata, never a secret. **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of API keys to retrieve. Minimum `1`, maximum `100`. | | `after` | string | No | The ID after which to retrieve more keys (pagination). The ID itself is excluded. Cannot be combined with `before`. | | `before` | string | No | The ID before which to retrieve more keys (pagination). The ID itself is excluded. Cannot be combined with `after`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.apiKeys.list(); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::ApiKeys.list ``` **PHP** ```php apiKeys->list(); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.ApiKeys.list() ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") keys, err := client.ApiKeys.List(nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _keys = mb.api_keys.list(None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.apiKeys().list(); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.ApiKeyListAsync(); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/api-keys' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart api-keys list ``` ### Response Each entry carries the key `name`, a non-secret `token` prefix, its `permission` (`full_access` or `sending_access`), the `domain_ids` it is restricted to (`null` for account-wide keys; `domain_id` is the legacy single-domain field, set only when exactly one domain), `created_at`, and a `last_used_at` timestamp (`null` if the key has never been used). `has_more` indicates whether further pages exist. ```json { "object": "list", "has_more": false, "data": [ { "id": "1042", "name": "Production server", "token": "mb_AbC12", "permission": "full_access", "domain_id": null, "domain_ids": null, "created_at": "2026-06-23T10:00:00.000Z", "last_used_at": "2026-06-25T17:09:51.813Z" } ] } ``` --- # Update API key > PATCH /api-keys/:id — dashboard-only. Key permissions are changed in the dashboard; an API key cannot re-scope a key. `PATCH /api-keys/:id` > **Warning:** **Dashboard-only.** A key's permissions are changed on the website. A request authenticated with an API key is refused with `403 dashboard_only` — "API keys can only be created, edited and revoked from the SendDart dashboard, not with an API key." — no matter what permission that key holds. Edit a key from the dashboard under **API Keys**. > **Note:** This is a **breaking change**. Automation that used to re-scope keys with a `full_access` key now receives `403 dashboard_only`; a key could otherwise widen its own permissions. The official SDKs deliberately expose no method for this endpoint. Updates an API key in place — no need to mint a new token to change what an existing key may do. Omitted fields stay unchanged. The secret token itself is immutable and never re-shown: to rotate credentials, create a new key and revoke this one. The reference below describes the request the dashboard makes on your behalf with a signed-in session — it is not callable with an API key. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The API key ID as returned by [`GET /api-keys`](https://www.senddart.com/docs/api/api-keys-list) — a numeric string (e.g. `1042`), not a UUID. A non-numeric id returns `not_found` (404). | **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | No | A new label for the key. | | `permission` | full_access | sending_access | No | The new access level. Setting `full_access` also clears any domain restriction — full-access keys always work across all your domains. | | `domain_ids` | string[] | null | No | Replace the key’s domain restriction. Only valid with `sending_access`. Send `null` (or an empty array) to allow all domains. Omit the field to leave the current restriction unchanged. | | `domain_id` | string | No | Legacy single-domain form of `domain_ids`. Provide one or the other, not both. | ### Response For the dashboard session, the updated key is returned (the secret is never re-shown — `token` is the non-secret prefix): ```json { "id": "1042", "object": "api_key", "name": "Production server", "token": "mb_AbC12", "permission": "sending_access", "domain_id": "b8f9c2aa-4c11-4f24-9d55-1f7a2b3c4d5e", "domain_ids": ["b8f9c2aa-4c11-4f24-9d55-1f7a2b3c4d5e"], "created_at": "2026-06-23T10:00:00.000Z", "last_used_at": "2026-06-25T17:09:51.813Z" } ``` ### Response to an API-key caller ```json { "statusCode": 403, "name": "dashboard_only", "message": "API keys can only be created, edited and revoked from the SendDart dashboard, not with an API key." } ``` > **Note:** Errors: `dashboard_only` (403) for **every** API-key caller — this check runs before any validation; `not_found` if the key does not exist, is revoked, or is not yours; `validation_error` if no updatable field is provided, `name` is empty, `permission` is invalid, both `domain_id` and `domain_ids` are provided, a domain restriction is combined with `full_access`, or `domain_ids` references a domain that is not yours. --- # Delete API key > DELETE /api-keys/:id — dashboard-only. Keys are revoked in the dashboard; an API key cannot revoke a key. `DELETE /api-keys/:id` > **Warning:** **Dashboard-only.** Keys are revoked on the website. A request authenticated with an API key is refused with `403 dashboard_only` — "API keys can only be created, edited and revoked from the SendDart dashboard, not with an API key." — no matter what permission that key holds. Revoke a key from the dashboard under **API Keys**; revocation there is still immediate. > **Note:** This is a **breaking change**. Automation that used to revoke keys with a `full_access` key now receives `403 dashboard_only`. If you suspect a key is compromised, sign in and delete it from the **API Keys** screen — that is the fastest path, and it takes effect on the key's next use. The official SDKs deliberately expose no method for this endpoint. Revokes an API key immediately. The key stops working on its next use. The reference below describes the request the dashboard makes on your behalf with a signed-in session — it is not callable with an API key. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The API key ID as returned by [`GET /api-keys`](https://www.senddart.com/docs/api/api-keys-list) — a numeric string (e.g. `1042`), not a UUID. A non-numeric id returns `not_found` (404). | ### Response ```json { "object": "api_key", "id": "1042", "deleted": true } ``` ### Response to an API-key caller ```json { "statusCode": 403, "name": "dashboard_only", "message": "API keys can only be created, edited and revoked from the SendDart dashboard, not with an API key." } ``` > **Note:** Errors: `dashboard_only` (403) for **every** API-key caller — this check runs before the key is looked up; `not_found` if the key does not exist or is not yours. --- # Create segment > POST /segments — save a reusable filter over a sending domain’s contacts. `POST /segments` Creates a segment against one of your sending domains. Returns the segment object. Segment names are unique within a domain (a duplicate name returns `409`) but freely reusable across domains — and every domain already carries an auto-created **General** segment matching all of its contacts. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | Yes | A name for the segment. Unique within the domain; the same name can be reused on other domains. | | `domain` | string | Yes | The sending domain whose contacts this segment filters (one of your domains). Passing `audience_id` is no longer accepted — pass `domain`. | | `filter.status` | string | No | `all` (default), `subscribed`, `unsubscribed`, or `members_only` (matches nobody by filter — the segment resolves to its explicitly added contacts only). | | `filter.email_contains` | string | No | Optional case-insensitive email substring match. | | `filter.property_filters` | array | No | Optional list of custom-property predicates. Each entry: `{ key, operator, value? }`. Operators: `eq`, `contains`, `exists`. Keys must be registered via `POST /contact-properties`. | | `filter.engagement` | object | null | No | Object or `null`. An engagement predicate: `{ event, campaign_id }`, where `event` is one of `clicked`, `not_clicked`, `opened`, `not_opened` and `campaign_id` is required whenever `engagement` is set. Pass `null` to clear it. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.segments.create({ "domain": "yourdomain.com", "name": "Gmail subscribers", "filter": { "status": "subscribed", "email_contains": "@gmail.com" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Segments.create({ "domain": "yourdomain.com", "name": "Gmail subscribers", "filter": { "status": "subscribed", "email_contains": "@gmail.com" } }) ``` **PHP** ```php segments->create([ 'domain' => "yourdomain.com", 'name' => "Gmail subscribers", 'filter' => [ 'status' => "subscribed", 'email_contains' => "@gmail.com" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Segments.create({ "domain": "yourdomain.com", "name": "Gmail subscribers", "filter": { "status": "subscribed", "email_contains": "@gmail.com" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") segment, err := client.Segments.Create(&senddart.CreateSegmentRequest{ Domain: "yourdomain.com", Name: "Gmail subscribers", Filter: &senddart.SegmentFilterInput{ Status: "subscribed", EmailContains: "@gmail.com", }, }) ``` **Rust** ```rust use senddart::{CreateSegmentOptions, SegmentFilterOptions, SegmentStatus, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateSegmentOptions::new("yourdomain.com", "Gmail subscribers") .with_filter(SegmentFilterOptions::new() .with_status(SegmentStatus::Subscribed) .with_email_contains("@gmail.com")); let _segment = mb.segments.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateSegmentRequest; import com.senddart.requests.SegmentFilter; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateSegmentRequest request = CreateSegmentRequest.builder() .domain("yourdomain.com") .name("Gmail subscribers") .filter(SegmentFilter.builder() .status("subscribed") .emailContains("@gmail.com") .build()) .build(); SendDartResponse response = senddart.segments().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.SegmentCreateAsync(new SegmentCreateOptions { Domain = "yourdomain.com", Name = "Gmail subscribers", Filter = new SegmentFilterOptions { Status = "subscribed", EmailContains = "@gmail.com", }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/segments' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "domain": "yourdomain.com", "name": "Gmail subscribers", "filter": { "status": "subscribed", "email_contains": "@gmail.com" } }' ``` **CLI** ```bash senddart segments create \ --domain 'yourdomain.com' \ --name 'Gmail subscribers' \ --filter '{"status":"subscribed","email_contains":"@gmail.com"}' ``` ### Response ```json { "object": "segment", "id": "4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Gmail subscribers", "filter": { "status": "subscribed", "email_contains": "@gmail.com", "property_filters": [], "engagement": null }, "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:00:00.000Z" } ``` > **Note:** Errors (all `422` unless noted): `missing_required_field` if `name` is absent; `validation_error` if `domain` is absent or is not one of your domains, if `audience_id` is passed instead of `domain`, if `filter.status` is not one of the allowed values, if a `property_filters` entry references an unknown or invalid property, or if `filter.engagement` is malformed (a bad `event`, or a missing `campaign_id`); `409` if a segment with the same name already exists on that domain. --- # List segments > GET /segments — list a sending domain’s segments. `GET /segments` Lists the segments on one sending domain. The `domain` query parameter is required, and the result always includes the domain’s auto-created **General** segment (all contacts). **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `domain` | string | Yes | The sending domain whose segments to list. | | `limit` | number | No | Number of segments to retrieve. An integer between `1` and `100`. Optional; if omitted, every segment on the domain is returned in a single response up to a ceiling of **1,000**, and `has_more` is `true` when that ceiling truncated the page — keep walking with `after`. | | `after` | string | No | The segment ID *after* which to retrieve more segments (for pagination). The ID is not included in the result. Cannot be combined with `before`. | | `before` | string | No | The segment ID *before* which to retrieve more segments (for pagination). The ID is not included in the result. Cannot be combined with `after`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.segments.list({ domain: 'yourdomain.com' }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Segments.list({ "domain": "yourdomain.com" }) ``` **PHP** ```php segments->list([ 'domain' => "yourdomain.com" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Segments.list({ "domain": "yourdomain.com" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") segments, err := client.Segments.List(&senddart.ListSegmentsRequest{ Domain: "yourdomain.com", }) ``` **Rust** ```rust use senddart::{ListSegmentsParams, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let _segments = mb.segments.list(ListSegmentsParams::new("yourdomain.com")).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.segments().list("yourdomain.com"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.SegmentListAsync("yourdomain.com"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/segments?domain=yourdomain.com' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart segments list \ --domain yourdomain.com ``` ### Response ```json { "object": "list", "has_more": false, "data": [ { "object": "segment", "id": "4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Gmail subscribers", "filter": { "status": "subscribed", "email_contains": "@gmail.com", "property_filters": [], "engagement": null }, "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:00:00.000Z" } ] } ``` --- # Retrieve segment > GET /segments/:id — fetch a single segment. `GET /segments/:id` **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `segment_id` | string | Yes | The segment ID. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.segments.get('4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Segments.get("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93") ``` **PHP** ```php segments->get('4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Segments.get("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") segment, err := client.Segments.Get("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _segment = mb.segments.get("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.segments().get("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.SegmentRetrieveAsync("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/segments/4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart segments get 4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93 ``` ### Response ```json { "object": "segment", "id": "4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Gmail subscribers", "filter": { "status": "subscribed", "email_contains": "@gmail.com", "property_filters": [], "engagement": null }, "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:00:00.000Z" } ``` --- # List segment contacts > GET /segments/:id/contacts — the contacts that match a segment. `GET /segments/:id/contacts` Returns the contacts in the segment’s audience that match its filter — a live preview of who a campaign to this segment would reach. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `segment_id` | string | Yes | The segment ID. | **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of contacts to retrieve. An integer between `1` and `100`. Optional; if omitted, all matching contacts are returned in a single response up to a ceiling of **1,000** — a segment matching 5,000 contacts returns the first 1,000 with `has_more: true`, so keep walking with `after`. | | `after` | string | No | The contact ID *after* which to retrieve more contacts (for pagination). The ID is not included in the result. Cannot be combined with `before`. | | `before` | string | No | The contact ID *before* which to retrieve more contacts (for pagination). The ID is not included in the result. Cannot be combined with `after`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.segments.contacts('4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Segments.contacts("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93") ``` **PHP** ```php segments->contacts('4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Segments.contacts("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") contacts, err := client.Segments.Contacts("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _contacts = mb.segments.contacts("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.segments().contacts("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.SegmentListContactsAsync("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/segments/4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93/contacts' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart segments contacts 4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93 ``` ### Response ```json { "object": "list", "has_more": false, "data": [ { "id": "479e3145-dd0e-4f64-bf48-1d4b6d4cd8f6", "email": "ada@gmail.com", "first_name": "Ada", "last_name": null, "unsubscribed": false, "created_at": "2026-06-23T10:00:00.000Z" } ] } ``` --- # Update segment > PATCH /segments/:id — edit a segment’s name or filter. `PATCH /segments/:id` **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | No | New name. | | `filter.status` | string | No | New status filter: `all`, `subscribed`, `unsubscribed`, or `members_only` (matches nobody by filter — the segment resolves to its explicitly added contacts only). | | `filter.email_contains` | string | null | No | New email substring (pass `null` to clear). | | `filter.property_filters` | array | null | No | Replace the property-filter list (pass `null` or `[]` to clear). Each entry: `{ key, operator, value? }`. Keys must be registered via `POST /contact-properties`. | | `filter.engagement` | object | null | No | Object or `null`. An engagement predicate: `{ event, campaign_id }`, where `event` is one of `clicked`, `not_clicked`, `opened`, `not_opened` and `campaign_id` is required whenever `engagement` is set. Pass `null` to clear it. | > **Note:** A segment’s domain cannot be changed — passing `domain` (or `audience_id`) here returns `422 validation_error`. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.segments.update('4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93', { "filter": { "status": "all" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Segments.update("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", { "filter": { "status": "all" } }) ``` **PHP** ```php segments->update('4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93', [ 'filter' => [ 'status' => "all" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Segments.update("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", { "filter": { "status": "all" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") segment, err := client.Segments.Update("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", &senddart.UpdateSegmentRequest{ Filter: &senddart.SegmentFilterInput{Status: "all"}, }) ``` **Rust** ```rust use senddart::{SegmentFilterOptions, SegmentStatus, SendDart, UpdateSegmentOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateSegmentOptions::new() .with_filter(SegmentFilterOptions::new().with_status(SegmentStatus::All)); let _segment = mb.segments.update("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SegmentFilter; import com.senddart.requests.UpdateSegmentRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); UpdateSegmentRequest request = UpdateSegmentRequest.builder() .filter(SegmentFilter.builder().status("all").build()) .build(); SendDartResponse response = senddart.segments().update( "4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.SegmentUpdateAsync("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", new SegmentUpdateOptions { Filter = new SegmentFilterOptions { Status = "all" }, }); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/segments/4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "filter": { "status": "all" } }' ``` **CLI** ```bash senddart segments update 4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93 \ --filter '{"status":"all"}' ``` ### Response Returns the full updated segment object — the same shape as [Create segment](https://www.senddart.com/docs/api/segments-create). ```json { "object": "segment", "id": "4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Gmail subscribers", "filter": { "status": "all", "email_contains": "@gmail.com", "property_filters": [], "engagement": null }, "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-24T08:15:02.000Z" } ``` An unknown segment id (or one you do not own) returns `404 not_found`. A `filter.status` outside `all`, `subscribed`, `unsubscribed`, `members_only`, an unknown `property_filters` key, or a malformed `filter.engagement` returns `422 validation_error`. See [Errors](https://www.senddart.com/docs/api/errors). --- # Delete segment > DELETE /segments/:id — remove a segment. `DELETE /segments/:id` **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `segment_id` | string | Yes | The segment ID. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.segments.remove('4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Segments.delete("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93") ``` **PHP** ```php segments->remove('4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Segments.remove("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Segments.Remove("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _removed = mb.segments.remove("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.segments().remove("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.SegmentDeleteAsync("4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/segments/4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart segments delete 4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93 ``` ### Response ```json { "object": "segment", "id": "4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93", "deleted": true } ``` --- # Create topic > POST /topics — create a subscription topic within a sending domain. `POST /topics` **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | Yes | Display name (max 255 chars). | | `default_subscription` | string | Yes | The default subscription preference for new contacts: `opt_in` (every contact receives the topic unless they explicitly unsubscribe from it) or `opt_out` (no contact receives the topic unless they explicitly subscribe). **This value cannot be changed later.** | | `visibility` | string | No | Visibility of the topic on the preference page: `public` (all contacts can see and toggle it) or `private` (only contacts already opted in can see it). Defaults to `private`. | | `description` | string | No | Optional description shown on the preference page (max 200 chars). | | `domain` | string | Yes | The sending domain this topic belongs to (one of your domains). Topic names are unique within a domain but freely reusable across domains. Passing `audience_id` is no longer accepted — pass `domain`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.topics.create({ "domain": "yourdomain.com", "name": "Product updates", "default_subscription": "opt_in" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Topics.create({ "domain": "yourdomain.com", "name": "Product updates", "default_subscription": "opt_in" }) ``` **PHP** ```php topics->create([ 'domain' => "yourdomain.com", 'name' => "Product updates", 'default_subscription' => "opt_in" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Topics.create({ "domain": "yourdomain.com", "name": "Product updates", "default_subscription": "opt_in" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") topic, err := client.Topics.Create(&senddart.CreateTopicRequest{ Domain: "yourdomain.com", Name: "Product updates", DefaultSubscription: "opt_in", }) ``` **Rust** ```rust use senddart::{CreateTopicOptions, SendDart, SubscriptionState}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateTopicOptions::new( "yourdomain.com", "Product updates", SubscriptionState::OptIn, ); let _topic = mb.topics.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateTopicRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateTopicRequest request = CreateTopicRequest.builder() .domain("yourdomain.com") .name("Product updates") .defaultSubscription("opt_in") .build(); SendDartResponse response = senddart.topics().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TopicCreateAsync(new TopicCreateOptions { Domain = "yourdomain.com", Name = "Product updates", DefaultSubscription = "opt_in", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/topics' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "domain": "yourdomain.com", "name": "Product updates", "default_subscription": "opt_in" }' ``` **CLI** ```bash senddart topics create \ --domain 'yourdomain.com' \ --name 'Product updates' \ --default-subscription 'opt_in' ``` ```json { "object": "topic", "id": "topic_9a2f...", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Product updates", "description": null, "default_subscription": "opt_in", "visibility": "private", "created_at": "2026-06-25T10:00:00.000Z" } ``` --- # List topics > GET /topics — list the topics on a sending domain. `GET /topics` Pass `?domain=` to pick the sending domain whose topics to list — the parameter is required. **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `domain` | string | Yes | The sending domain whose topics to list. | | `limit` | number | No | Number of topics to retrieve. Optional; omit it and up to 1,000 topics come back in one response — `has_more` is `true` if that cap truncated the list, so keep paging with `after`. Minimum `1`, maximum `100`. | | `after` | string | No | The topic ID *after* which to retrieve more topics (for pagination). The ID is not included in the result. Cannot be combined with `before`. | | `before` | string | No | The topic ID *before* which to retrieve more topics (for pagination). The ID is not included in the result. Cannot be combined with `after`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.topics.list({ domain: 'yourdomain.com' }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Topics.list({ "domain": "yourdomain.com" }) ``` **PHP** ```php topics->list([ 'domain' => "yourdomain.com" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Topics.list({ "domain": "yourdomain.com" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") topics, err := client.Topics.List(&senddart.ListTopicsRequest{ Domain: "yourdomain.com", }) ``` **Rust** ```rust use senddart::{ListTopicsParams, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let _topics = mb.topics.list(ListTopicsParams::new("yourdomain.com")).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.topics().list("yourdomain.com"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TopicListAsync("yourdomain.com"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/topics?domain=yourdomain.com' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart topics list \ --domain yourdomain.com ``` ### Response ```json { "object": "list", "has_more": false, "data": [ { "id": "topic_9a2f...", "name": "Product updates", "description": null, "default_subscription": "opt_in", "visibility": "private", "created_at": "2026-06-25T10:00:00.000Z" } ] } ``` --- # Retrieve topic > GET /topics/:id — retrieve a single topic. `GET /topics/:id` **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `topic_id` | string | Yes | The topic ID. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.topics.get('topic_9a2f...'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Topics.get("topic_9a2f...") ``` **PHP** ```php topics->get('topic_9a2f...'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Topics.get("topic_9a2f...") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") topic, err := client.Topics.Get("topic_9a2f...") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _topic = mb.topics.get("topic_9a2f...").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.topics().get("topic_9a2f..."); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TopicRetrieveAsync("topic_9a2f..."); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/topics/topic_9a2f...' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart topics get topic_9a2f... ``` ### Response ```json { "object": "topic", "id": "topic_9a2f...", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "name": "Product updates", "description": "Subscribe for product news", "default_subscription": "opt_in", "visibility": "public", "created_at": "2026-06-25T10:00:00.000Z" } ``` --- # Update topic > PATCH /topics/:id — rename a topic or change its description. `PATCH /topics/:id` **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `topic_id` | string | Yes | The topic ID. | **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | No | New display name (max 255 chars). | | `description` | string | No | New description shown on the preference page. | | `visibility` | string | No | New visibility on the preference page: `public` or `private`. | > **Warning:** The `default_subscription` (opt-in vs opt-out) is fixed at creation and **cannot be updated**. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.topics.update('topic_9a2f...', { "name": "Newsletter" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Topics.update("topic_9a2f...", { "name": "Newsletter" }) ``` **PHP** ```php topics->update('topic_9a2f...', [ 'name' => "Newsletter" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Topics.update("topic_9a2f...", { "name": "Newsletter" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") topic, err := client.Topics.Update("topic_9a2f...", &senddart.UpdateTopicRequest{ Name: "Newsletter", }) ``` **Rust** ```rust use senddart::{SendDart, UpdateTopicOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateTopicOptions::new().with_name("Newsletter"); let _topic = mb.topics.update("topic_9a2f...", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.UpdateTopicRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.topics().update( "topic_9a2f...", UpdateTopicRequest.builder().name("Newsletter").build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TopicUpdateAsync( "topic_9a2f...", new TopicUpdateOptions { Name = "Newsletter" }); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/topics/topic_9a2f...' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Newsletter" }' ``` **CLI** ```bash senddart topics update topic_9a2f... \ --name 'Newsletter' ``` --- # Delete topic > DELETE /topics/:id — delete a topic and all per-contact subscription state for it. `DELETE /topics/:id` **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `topic_id` | string | Yes | The topic ID. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.topics.remove('topic_9a2f...'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Topics.delete("topic_9a2f...") ``` **PHP** ```php topics->remove('topic_9a2f...'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Topics.remove("topic_9a2f...") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Topics.Remove("topic_9a2f...") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _removed = mb.topics.remove("topic_9a2f...").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.topics().remove("topic_9a2f..."); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TopicDeleteAsync("topic_9a2f..."); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/topics/topic_9a2f...' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart topics delete topic_9a2f... ``` ### Response ```json { "object": "topic", "id": "topic_9a2f...", "deleted": true } ``` --- # Create Automation > POST /automations — create an entire automation flow in a single request. `POST /automations` Creates an automation. The [trigger](https://www.senddart.com/docs/automations/trigger) is defined as the first item in the `steps` array with `type: "trigger"` (its `config.event_name` is the event that starts a run); a top-level `trigger` string is also accepted. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | Yes | The name of the automation. | | `status` | string | No | The status of the automation. One of `enabled` or `disabled`. Defaults to `disabled`. Creating with `enabled` requires at least one step besides the trigger. | | `domain` | string | Yes | The sending domain this automation belongs to (one of your domains, e.g. `yourdomain.com`). Only [events](https://www.senddart.com/docs/api/events-send) sent with the same `domain` trigger it. | | `steps` | array | No | The [steps](https://www.senddart.com/docs/automations/steps) that compose the automation graph. Each step is `{ key, type, config }`; the first item with `type: "trigger"` defines the trigger. | | `connections` | array | No | The [connections between steps](https://www.senddart.com/docs/automations/connections). Each is `{ from, to, type }`, where `from`/`to` are step keys and `type` is one of `default`, `condition_met`, `condition_not_met`, `event_received`, or `timeout`. Cyclic graphs are rejected. | | `trigger` | string | No | Optional alternative to a trigger step — the event name that starts the automation, as a plain string. Custom event names cannot start with the reserved `senddart:` prefix; the built-in `senddart:schedule` scheduled trigger is the one exception. **Defaults to `contact.created`** (the built-in "contact added to audience" trigger) when you supply neither a top-level `trigger` nor a `type: "trigger"` step — so an automation created without a trigger is not inert: once enabled it enrolls every contact added to the domain pool. | | `trigger_config` | object | No | Required when the trigger is `senddart:schedule` — the built-in scheduled trigger that runs the automation **once** for every contact in the domain’s audience at a set time. An object `{ at, timezone }`: `at` is an ISO 8601 instant that must be in the future and at most 366 days ahead; `timezone` is the IANA timezone name it was picked in (e.g. `America/New_York`). | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }) ``` **PHP** ```php automations->create([ 'name' => "Welcome series", 'domain' => "yourdomain.com", 'steps' => [ [ 'key' => "start", 'type' => "trigger", 'config' => [ 'event_name' => "user.created" ] ], [ 'key' => "welcome", 'type' => "send_email", 'config' => [ 'template' => [ 'id' => "34a080c9-b17d-4187-ad80-5af20266e535" ] ] ] ], 'connections' => [ [ 'from' => "start", 'to' => "welcome" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.create({ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Create(&senddart.CreateAutomationRequest{ Name: "Welcome series", Domain: "yourdomain.com", Steps: []senddart.AutomationStepInput{ { Key: "start", Type: "trigger", Config: map[string]any{"event_name": "user.created"}, }, { Key: "welcome", Type: "send_email", Config: map[string]any{ "template": map[string]any{"id": "34a080c9-b17d-4187-ad80-5af20266e535"}, }, }, }, Connections: []senddart.AutomationConnectionInput{{From: "start", To: "welcome"}}, }) ``` **Rust** ```rust use senddart::{AutomationStepInput, ConnectionInput, CreateAutomationOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateAutomationOptions::new("Welcome series", "yourdomain.com") .with_step(AutomationStepInput::new("trigger") .with_key("start") .with_config(serde_json::json!({"event_name":"user.created"}))) .with_step(AutomationStepInput::new("send_email") .with_key("welcome") .with_config(serde_json::json!({ "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } }))) .with_connection(ConnectionInput::new("start", "welcome")); let _automation = mb.automations.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationConnection; import com.senddart.requests.AutomationStep; import com.senddart.requests.CreateAutomationRequest; import java.util.Map; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateAutomationRequest request = CreateAutomationRequest.builder() .name("Welcome series") .domain("yourdomain.com") .step(AutomationStep.builder() .key("start") .type("trigger") .config("event_name", "user.created") .build()) .step(AutomationStep.builder() .key("welcome") .type("send_email") .config("template", Map.of("id", "34a080c9-b17d-4187-ad80-5af20266e535")) .build()) .connection(AutomationConnection.of("start", "welcome")) .build(); SendDartResponse response = senddart.automations().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationCreateAsync(new AutomationCreateOptions { Name = "Welcome series", Domain = "yourdomain.com", Steps = new List { new() { Key = "start", Type = "trigger", Config = new Dictionary { ["event_name"] = "user.created", }, }, new() { Key = "welcome", Type = "send_email", Config = new Dictionary { ["template"] = new Dictionary { ["id"] = "34a080c9-b17d-4187-ad80-5af20266e535", }, }, }, }, Connections = new List { new() { From = "start", To = "welcome" }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Welcome series", "domain": "yourdomain.com", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created" } }, { "key": "welcome", "type": "send_email", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome" } ] }' ``` ### Response Returns the full automation object (HTTP 201). For compatibility, a `senddart:schedule` request is returned as the stored legacy `mailblastr:schedule` trigger. Both names are accepted on input. The first entry in `steps` is the trigger step (with its `key` preserved) and its `config` also carries the automation `domain`, followed by the executable steps. Every automation response also carries `trigger_key` (the `key` of the `type: "trigger"` step in your request, and `null` when the automation was created from a top-level `trigger` event name with no trigger step in `steps`) and `trigger_config` (`null` unless the trigger is a scheduled trigger, in which case it holds `{ at, timezone }` and those fields are merged into the trigger step config too). ```json { "object": "automation", "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "domain": "yourdomain.com", "name": "Welcome series", "trigger": "user.created", "status": "disabled", "trigger_config": null, "trigger_key": "start", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created", "domain": "yourdomain.com" } }, { "id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "key": "welcome", "type": "send_email", "position": 0, "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome", "type": "default" } ], "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:00:00.000Z" } ``` --- # Add Automation Step > POST /automations/:id/steps — append a step to a disabled automation. `POST /automations/:id/steps` Appends a step to an automation. The automation must be **disabled** — [stop](https://www.senddart.com/docs/api/automations-stop) or disable it first. Returns the created step. Supported step types (see the [Steps](https://www.senddart.com/docs/automations/steps) page for full config shapes): - **[send_email](https://www.senddart.com/docs/automations/send-email)** — send a published template; `config.template.id` is required, with optional `variables`, `from`, `subject`, and `reply_to`. - **[delay](https://www.senddart.com/docs/automations/delay)** — pause for a natural-language `duration` (e.g. `"1 day"`). Maximum 30 days. - **[wait_for_event](https://www.senddart.com/docs/automations/wait-for-event)** — pause until `event_name` is received, with an optional `timeout` and `filter_rule`. - **[condition](https://www.senddart.com/docs/automations/condition)** — branch on a `rule` (or an `and`/`or` group of rules) evaluated against `event.*` / `contact.*` data. - **[contact_update](https://www.senddart.com/docs/automations/contact-update)** — update the contact's `first_name`, `last_name`, `unsubscribed`, or `properties`. - **[contact_delete](https://www.senddart.com/docs/automations/contact-delete)** — delete the contact; `config` is an empty object `{}`. - **[add_to_segment](https://www.senddart.com/docs/automations/add-to-segment)** — add the contact to a segment; requires `config.segment_id`. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.addStep('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', { "type": "delay", "config": { "duration": "1 day" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.add_step("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", { "type": "delay", "config": { "duration": "1 day" } }) ``` **PHP** ```php automations->addStep('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', [ 'type' => "delay", 'config' => [ 'duration' => "1 day" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.add_step("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", { "type": "delay", "config": { "duration": "1 day" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") step, err := client.Automations.AddStep("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", &senddart.AddAutomationStepRequest{ Type: "delay", Config: map[string]any{"duration": "1 day"}, }) ``` **Rust** ```rust use senddart::{AddAutomationStepOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = AddAutomationStepOptions::new("delay") .with_config(serde_json::json!({"duration":"1 day"})); let _step = mb.automations.add_step("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationStep; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().addStep( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", AutomationStep.builder().type("delay").config("duration", "1 day").build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationAddStepAsync("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", new AutomationAddStepOptions { Type = "delay", Config = new Dictionary { ["duration"] = "1 day" }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/steps' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "type": "delay", "config": { "duration": "1 day" } }' ``` **CLI** ```bash senddart automations add-step c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd \ --type 'delay' \ --config '{"duration":"1 day"}' ``` **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.addStep('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', { "type": "send_email", "key": "welcome", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.add_step("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", { "type": "send_email", "key": "welcome", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } }) ``` **PHP** ```php automations->addStep('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', [ 'type' => "send_email", 'key' => "welcome", 'config' => [ 'template' => [ 'id' => "34a080c9-b17d-4187-ad80-5af20266e535" ] ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.add_step("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", { "type": "send_email", "key": "welcome", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") step, err := client.Automations.AddStep("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", &senddart.AddAutomationStepRequest{ Type: "send_email", Key: "welcome", Config: map[string]any{ "template": map[string]any{"id": "34a080c9-b17d-4187-ad80-5af20266e535"}, }, }) ``` **Rust** ```rust use senddart::{AddAutomationStepOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = AddAutomationStepOptions::new("send_email") .with_key("welcome") .with_config(serde_json::json!({"template":{"id":"34a080c9-b17d-4187-ad80-5af20266e535"}})); let _step = mb.automations.add_step("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.AutomationStep; import java.util.Map; SendDart senddart = new SendDart("mb_xxxxxxxxx"); AutomationStep request = AutomationStep.builder() .type("send_email") .key("welcome") .config("template", Map.of("id", "34a080c9-b17d-4187-ad80-5af20266e535")) .build(); SendDartResponse response = senddart.automations().addStep( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationAddStepAsync("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", new AutomationAddStepOptions { Type = "send_email", Key = "welcome", Config = new Dictionary { ["template"] = new Dictionary { ["id"] = "34a080c9-b17d-4187-ad80-5af20266e535", }, }, }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/steps' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "type": "send_email", "key": "welcome", "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } }' ``` **CLI** ```bash senddart automations add-step c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd \ --type 'send_email' \ --key 'welcome' \ --config '{"template":{"id":"34a080c9-b17d-4187-ad80-5af20266e535"}}' ``` ### Response The step routes return the **stored** step row rather than the documented graph shape, so the response uses the internal step vocabulary: `send_email` is stored as `send` and `wait_for_event` as `wait`, and a `send_email` config is flattened to `{ from, subject, html, text, template_id, variables?, reply_to? }` (so `template.id` comes back as `template_id`). The documented `send_email` / `template` shape is what the automation-level [create](https://www.senddart.com/docs/api/automations-create), [retrieve](https://www.senddart.com/docs/api/automations-get) and [update](https://www.senddart.com/docs/api/automations-update) responses return. ```json { "id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "key": "welcome", "type": "send", "position": 0, "config": { "template_id": "34a080c9-b17d-4187-ad80-5af20266e535" } } ``` --- # Update Automation Step > PATCH /automations/:id/steps/:stepId — edit a step in place (type/config) on a disabled automation. `PATCH /automations/:id/steps/:stepId` Updates a step's `type` and/or `config` in place. The step's **graph key stays stable**, so any [connections](https://www.senddart.com/docs/automations/connections) pointing at it keep working — unlike delete-and-re-add, which drops the key and its edges. The automation must be **disabled** ([stop](https://www.senddart.com/docs/api/automations-stop) or disable it first). Returns the updated step. The body is the same shape as [Add Step](https://www.senddart.com/docs/api/automations-add-step): `type` (required) plus the type-specific `config`. See the [Steps](https://www.senddart.com/docs/automations/steps) page for each type's config shape. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The automation id. | | `stepId` | string | Yes | The id of the step to update. | **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | Yes | The step type (e.g. `send_email`, `delay`, `condition`). | | `config` | object | No | The type-specific configuration that replaces the step's current config. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.updateStep('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', '9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d', { "type": "delay", "config": { "duration": "2 days" } }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.update_step("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", { "type": "delay", "config": { "duration": "2 days" } }) ``` **PHP** ```php automations->updateStep('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', '9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d', [ 'type' => "delay", 'config' => [ 'duration' => "2 days" ] ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.update_step("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", { "type": "delay", "config": { "duration": "2 days" } }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") step, err := client.Automations.UpdateStep("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", &senddart.UpdateAutomationStepRequest{ Type: "delay", Config: map[string]any{"duration": "2 days"}, }) ``` **Rust** ```rust use senddart::{SendDart, UpdateAutomationStepOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateAutomationStepOptions::new("delay") .with_config(serde_json::json!({"duration":"2 days"})); let _step = mb.automations.update_step("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.UpdateAutomationStepRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); UpdateAutomationStepRequest request = UpdateAutomationStepRequest.builder() .type("delay") .config("duration", "2 days") .build(); SendDartResponse response = senddart.automations().updateStep( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationUpdateStepAsync("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", new AutomationUpdateStepOptions { Type = "delay", Config = new Dictionary { ["duration"] = "2 days" }, }); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/steps/9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "type": "delay", "config": { "duration": "2 days" } }' ``` **CLI** ```bash senddart automations update-step c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd 9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d \ --type 'delay' \ --config '{"duration":"2 days"}' ``` ### Response ```json { "id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "key": "welcome", "type": "delay", "position": 0, "config": { "duration": "2 days" } } ``` As with [Add Step](https://www.senddart.com/docs/api/automations-add-step), the response is the stored step row: `delay`, `add_to_segment`, `contact_update` and `contact_delete` are stored exactly as documented, while `send_email` comes back as `type: "send"` with `config.template_id`, and `wait_for_event` comes back as `type: "wait"` with `config: { event, timeout_hours, poll_minutes, timeout?, filter_rule? }` (the natural-language `timeout` is echoed back only when you sent it that way). A `condition` config is normalized on write: the documented single `{ type: "rule", field, operator, value }` is stored as `{ rules: [{ field, operator, value }], match: "all", skip_steps }`, and an `and` / `or` group is flattened to the same shape with `match: "all"` / `match: "any"` — so the response shows `rules` and `match`, not the `type` envelope you sent. Returns `not_found` (404) if the automation or step does not exist, and `validation_error` (422) if the automation is enabled (disable it first) or the step body is invalid. See [Errors](https://www.senddart.com/docs/api/errors). --- # Update Automation > PATCH /automations/:id — rename, enable or disable, re-point the domain or trigger, or replace the connection graph. `PATCH /automations/:id` Updates an automation. Set `status` to `enabled` to start creating runs for matching events, or `disabled` to stop new runs. You can also rename via `name`, re-point the sending `domain` or the `trigger` event, and replace the connection graph via `connections`. Returns the full updated automation object, including steps and connections. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | No | A new name for the automation. | | `status` | string | No | One of `enabled` or `disabled`. Enabling requires at least one step besides the trigger. | | `domain` | string | No | Re-point the automation at another of your sending domains. Only allowed while the automation is `disabled`. Re-pointing also moves the contact pool to the new domain's. | | `trigger` | string | No | Re-point the trigger at a different event name. Only allowed while the automation is `disabled`. Custom event names must not start with the reserved `senddart:` prefix; the built-in `senddart:schedule` scheduled trigger is the one exception. | | `trigger_config` | object | No | The `senddart:schedule` trigger’s schedule — an object `{ at, timezone }` that runs the automation **once** for every contact in the domain’s audience at that time. `at` is an ISO 8601 instant that must be in the future and at most 366 days ahead; `timezone` is the IANA timezone name it was picked in (e.g. `America/New_York`). | | `trigger_key` | string | No | Optional key for the trigger step in the graph (used by the canvas editor). Only meaningful alongside `trigger`; defaults to the existing key, or `trigger`. | | `connections` | array | No | Replaces the [connections](https://www.senddart.com/docs/automations/connections) between steps. Only allowed while the automation is `disabled`. Cyclic graphs are rejected. | > **Note:** Structural edits — steps, connections, `trigger`, and `domain` — require the automation to be **disabled**. Disable it first, make your changes, then re-enable it. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.update('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', { "status": "enabled" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.update("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", { "status": "enabled" }) ``` **PHP** ```php automations->update('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', [ 'status' => "enabled" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.update("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", { "status": "enabled" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Update("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", &senddart.UpdateAutomationRequest{ Status: "enabled", }) ``` **Rust** ```rust use senddart::{SendDart, UpdateAutomationOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateAutomationOptions::new().with_status("enabled"); let _automation = mb.automations.update("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.UpdateAutomationRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().update( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", UpdateAutomationRequest.builder().status("enabled").build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationUpdateAsync( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", new AutomationUpdateOptions { Status = "enabled" }); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "status": "enabled" }' ``` **CLI** ```bash senddart automations update c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd \ --status 'enabled' ``` ### Response ```json { "object": "automation", "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "domain": "yourdomain.com", "name": "Welcome series", "trigger": "user.created", "status": "enabled", "trigger_config": null, "trigger_key": "start", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created", "domain": "yourdomain.com" } }, { "id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "key": "welcome", "type": "send_email", "position": 0, "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome", "type": "default" } ], "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:01:00.000Z" } ``` --- # List Automations > GET /automations — list your automations, newest first. `GET /automations` Lists your automations, newest first. The list returns automation objects **without** `steps`, `connections`, or `enrollments` — [retrieve a single automation](https://www.senddart.com/docs/api/automations-get) for the full object. See [Pagination](https://www.senddart.com/docs/api/pagination) for navigating with `limit`, `after`, and `before`. **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of automations to retrieve per page. Default `20`, maximum `100`, minimum `1`. | | `after` | string | No | The automation `id` **after** which more automations are retrieved (the next page). Cannot be combined with `before`. | | `before` | string | No | The automation `id` **before** which more automations are retrieved (the previous page). Cannot be combined with `after`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.list({ limit: 20 }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.list({ "limit": 20 }) ``` **PHP** ```php automations->list([ 'limit' => 20 ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.list({ "limit": 20 }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automations, err := client.Automations.List(&senddart.ListParams{Limit: 20}) ``` **Rust** ```rust use senddart::{PaginationParams, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let _automations = mb.automations.list(Some(PaginationParams::new().with_limit(20))).await?; ``` **Java** ```java import com.senddart.ListParams; import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().list(ListParams.builder().limit(20).build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationListAsync(new PaginationOptions { Limit = 20 }); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/automations?limit=20' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart automations list \ --limit 20 ``` ### Response ```json { "object": "list", "has_more": false, "data": [ { "object": "automation", "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "domain": "yourdomain.com", "name": "Welcome series", "trigger": "user.created", "status": "enabled", "trigger_config": null, "trigger_key": "start", "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:00:00.000Z" } ] } ``` Returns `validation_error` if `limit` is outside 1–100, if a cursor is malformed, or if both `before` and `after` are supplied. See [Errors](https://www.senddart.com/docs/api/errors). --- # Retrieve Automation > GET /automations/:id — retrieve one automation with its steps, connections, and enrollment counts. `GET /automations/:id` Retrieves a single automation. Unlike the [list](https://www.senddart.com/docs/api/automations-list), this returns the full object — `steps` (the trigger step first, then the executable steps), `connections`, and `enrollments` (an object with `active` and `completed` counts). **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The ID of the automation to retrieve. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.get('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.get("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **PHP** ```php automations->get('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.get("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Get("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _automation = mb.automations.get("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().get("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationRetrieveAsync("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart automations get c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd ``` ### Response ```json { "object": "automation", "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "domain": "yourdomain.com", "name": "Welcome series", "trigger": "user.created", "status": "enabled", "trigger_config": null, "trigger_key": "start", "steps": [ { "key": "start", "type": "trigger", "config": { "event_name": "user.created", "domain": "yourdomain.com" } }, { "id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "key": "welcome", "type": "send_email", "position": 0, "config": { "template": { "id": "34a080c9-b17d-4187-ad80-5af20266e535" } } } ], "connections": [ { "from": "start", "to": "welcome", "type": "default" } ], "enrollments": { "active": 12, "completed": 48 }, "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:00:00.000Z" } ``` An unknown id returns `404 not_found`. See [Errors](https://www.senddart.com/docs/api/errors). --- # Stop Automation > POST /automations/:id/stop — stop an automation from creating new runs. `POST /automations/:id/stop` Stops an automation by setting its status to `disabled`. This prevents new [runs](https://www.senddart.com/docs/automations/runs) from being created; existing in-progress runs continue to completion. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The ID of the automation to stop. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.stop('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **PHP** ```php automations->stop('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") automation, err := client.Automations.Stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _automation = mb.automations.stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().stop("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationStopAsync("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/stop' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart automations stop c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd ``` ### Response Returns the updated automation object with `status` set to `disabled`. ```json { "object": "automation", "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf", "domain": "yourdomain.com", "name": "Welcome series", "trigger": "user.created", "status": "disabled", "trigger_config": null, "trigger_key": "start", "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:02:00.000Z" } ``` > **Note:** Stopping an automation prevents new runs from being created. Existing in-progress runs continue to completion. --- # List Automation Runs > GET /automations/:id/runs — list the runs of an automation, with optional status filtering. `GET /automations/:id/runs` Lists the [runs](https://www.senddart.com/docs/automations/runs) of an automation, newest first. Filter by one or more statuses with a comma-separated `status` query parameter. The list is **paginated** — at most 20 runs come back unless you raise `limit`, and `has_more` tells you whether to keep walking with `after`. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The ID of the automation. | **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `status` | string | No | Filter to one or more run statuses, comma-separated (e.g. `status=running,completed`). Possible values: `running`, `completed`, `failed`, `skipped`. | | `limit` | integer | No | How many runs to return. An integer between 1 and 100, defaulting to **20** — this endpoint always applies the limit, so an automation with 500 runs returns 20 with `has_more: true`. | | `after` | string | No | Cursor: return the runs that follow this run id. See [Pagination](https://www.senddart.com/docs/api/pagination). | | `before` | string | No | Cursor: return the runs that precede this run id. Cannot be combined with `after`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.runs('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **PHP** ```php automations->runs('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") runs, err := client.Automations.Runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _runs = mb.automations.runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationListRunsAsync("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/runs' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart automations runs c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd ``` **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.runs('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', { status: 'running,completed' }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", { "status": "running,completed" }) ``` **PHP** ```php automations->runs('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', [ 'status' => "running,completed" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.runs("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", { "status": "running,completed" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") runs, err := client.Automations.RunsFiltered("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", &senddart.ListAutomationRunsRequest{ Status: []string{"running", "completed"}, }) ``` **Rust** ```rust use senddart::{ListAutomationRunsParams, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = Some(ListAutomationRunsParams::new().with_status(["running", "completed"])); let _runs = mb.automations.runs_filtered("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.ListAutomationRunsParams; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().runs( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", ListAutomationRunsParams.builder().status("running", "completed").build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationListRunsAsync("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", new AutomationRunListOptions { Status = new[] { "running", "completed" }, }); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/runs?status=running,completed' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart automations runs c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd \ --status 'running,completed' ``` A `limit` outside 1-100 (or a non-integer), or `after` and `before` together, returns `422 validation_error`. An unknown cursor returns an empty page rather than an error. See [Pagination](https://www.senddart.com/docs/api/pagination) and [Errors](https://www.senddart.com/docs/api/errors). ### Response ```json { "object": "list", "has_more": false, "data": [ { "object": "automation_run", "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "contact_id": "26e2b838-bf6d-4515-b6a7-17525b12b05a", "contact_email": "jordan@acme.com", "status": "completed", "started_at": "2026-10-01T12:00:00.000Z", "completed_at": "2026-10-01T12:05:00.000Z", "created_at": "2026-10-01T12:00:00.000Z" } ] } ``` --- # Retrieve Automation Run > GET /automations/:id/runs/:runId — retrieve one run including its step-by-step trace. `GET /automations/:id/runs/:runId` Retrieves the full details of a single [run](https://www.senddart.com/docs/automations/runs), including the `steps` array — the execution trace of every step in the run. The first entry is the trigger step. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The ID of the automation. | | `runId` | string | Yes | The ID of the run to retrieve. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.getRun('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.get_run("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890") ``` **PHP** ```php automations->getRun('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.get_run("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") run, err := client.Automations.GetRun("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _run = mb.automations.get_run("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().getRun( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationRetrieveRunAsync( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "a1b2c3d4-e5f6-7890-abcd-ef1234567890"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/runs/a1b2c3d4-e5f6-7890-abcd-ef1234567890' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart automations run c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd a1b2c3d4-e5f6-7890-abcd-ef1234567890 ``` ### Response ```json { "object": "automation_run", "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "automation_id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "contact_id": "26e2b838-bf6d-4515-b6a7-17525b12b05a", "contact_email": "jordan@acme.com", "status": "completed", "error": null, "started_at": "2026-10-01T12:00:00.000Z", "completed_at": "2026-10-01T12:05:00.000Z", "created_at": "2026-10-01T12:00:00.000Z", "steps": [ { "key": "start", "type": "trigger", "status": "completed", "started_at": "2026-10-01T12:00:00.000Z", "completed_at": "2026-10-01T12:00:01.000Z", "output": null, "error": null }, { "key": "welcome", "type": "send_email", "status": "completed", "started_at": "2026-10-01T12:00:01.000Z", "completed_at": "2026-10-01T12:00:02.000Z", "output": { "to": "user@example.com", "email_id": "6278820d-2421-42d0-85f0-80e9e28c1c69", "template": { "id": "caa9851e-e7bf-4a50-a408-56024edc19c0", "variables": null } }, "error": null } ] } ``` Each step in the response includes: | Field | Description | | --- | --- | | `key` | The unique key of the step in the automation graph. | | `type` | The step type (e.g. `trigger`, `send_email`, `delay`). | | `status` | The step's execution status: `completed`, `failed`, or `skipped`. | | `started_at` | When the step started executing. | | `completed_at` | When the step finished. | | `output` | Output data from the step (if any). | | `error` | Error details if the step failed. | --- # Delete Automation > DELETE /automations/:id — permanently delete an automation and everything attached to it. `DELETE /automations/:id` Permanently deletes an automation along with all of its steps, connections, enrollments, and runs. This action cannot be undone. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The ID of the automation to delete. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.remove('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.delete("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **PHP** ```php automations->remove('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.remove("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Automations.Remove("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _removed = mb.automations.remove("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().remove("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationDeleteAsync("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart automations delete c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd ``` ### Response ```json { "object": "automation", "id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "deleted": true } ``` --- # Delete Automation Step > DELETE /automations/:id/steps/:stepId — remove a step from a disabled automation. `DELETE /automations/:id/steps/:stepId` Removes a single step from an automation. The automation must be **disabled** — deleting steps from an enabled automation is not allowed because it would change the graph for in-flight runs. [Stop](https://www.senddart.com/docs/api/automations-stop) or disable the automation first, then delete the step. **Path parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | Yes | The ID of the automation that owns the step. | | `stepId` | string | Yes | The ID of the step to delete. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.automations.deleteStep('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', '9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Automations.delete_step("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d") ``` **PHP** ```php automations->deleteStep('c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd', '9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Automations.delete_step("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Automations.DeleteStep("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _removed = mb.automations.delete_step("c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.automations().deleteStep( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.AutomationDeleteStepAsync( "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd", "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/steps/9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart automations delete-step c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd 9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d ``` ### Response ```json { "id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "deleted": true } ``` --- # Create template > POST /templates — save a reusable template. `POST /templates` Creates a template with `status: "draft"`. Provide a `name` and at least one of `html` or `text`. Returns `{ object: "template", id }`. A draft cannot be sent yet — call [`POST /templates/:id/publish`](https://www.senddart.com/docs/api/templates-publish) before referencing it as a `template_id`, or the send fails with `validation_error`. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | Yes | A name for the template (shown in the dashboard). | | `alias` | string | No | A unique, human-readable handle. Pass `alias` instead of `id` wherever a template id is accepted (e.g. `template_id` on sends, `GET /templates/:id`). Must be unique across your templates. | | `subject` | string | No | Default subject line. Supports `{{ variables }}`. Can be overridden when sending. | | `html` | string | No | HTML body. Required if `text` is omitted. Supports `{{ variables }}`. | | `text` | string | No | Plain-text body. Required if `html` is omitted. Supports `{{ variables }}`. If omitted, a plain-text version is generated from the HTML; set it to an empty string to opt out. | | `from` | string | No | Default sender address. Use `"Your Name "` for a friendly name. Can be overridden when sending. | | `reply_to` | string | string[] | No | Default Reply-To address, or an array of addresses. An array is stored — and returned by `GET /templates/:id` — as a single comma-separated string. Can be overridden when sending. | | `variables` | array | No | The variables used in the template (up to 50). Each is an object with `key`, `type`, and an optional `fallback_value` — see below. | **variables[] object** | Name | Type | Required | Description | | --- | --- | --- | --- | | `key` | string | Yes | The variable key. We recommend capitalizing it (e.g. `PRODUCT_NAME`). Reserved names that cannot be used: `FIRST_NAME`, `LAST_NAME`, `EMAIL`, `UNSUBSCRIBE_URL`, `contact`, `this`. Keys must start with a letter or underscore and contain only letters, digits, underscores, or dots. | | `type` | 'string' | 'number' | No | The type of the variable. Defaults to `string` when omitted. | | `fallback_value` | string | number | null | No | The value used when none is supplied at send time. Must match `type`. If omitted, a value for this variable is required when sending. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.templates.create({ "name": "Welcome email", "subject": "Welcome, {{first_name}}!", "html": "

Hi {{first_name}}

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Templates.create({ "name": "Welcome email", "subject": "Welcome, {{first_name}}!", "html": "

Hi {{first_name}}

" }) ``` **PHP** ```php templates->create([ 'name' => "Welcome email", 'subject' => "Welcome, {{first_name}}!", 'html' => "

Hi {{first_name}}

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Templates.create({ "name": "Welcome email", "subject": "Welcome, {{first_name}}!", "html": "

Hi {{first_name}}

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") template, err := client.Templates.Create(&senddart.CreateTemplateRequest{ Name: "Welcome email", Subject: "Welcome, {{first_name}}!", Html: "

Hi {{first_name}}

", }) ``` **Rust** ```rust use senddart::{CreateTemplateOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateTemplateOptions::new("Welcome email") .with_subject("Welcome, {{first_name}}!") .with_html("

Hi {{first_name}}

"); let _template = mb.templates.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateTemplateRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateTemplateRequest request = CreateTemplateRequest.builder() .name("Welcome email") .subject("Welcome, {{first_name}}!") .html("

Hi {{first_name}}

") .build(); SendDartResponse response = senddart.templates().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TemplateCreateAsync(new TemplateCreateOptions { Name = "Welcome email", Subject = "Welcome, {{first_name}}!", HtmlBody = "

Hi {{first_name}}

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/templates' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Welcome email", "subject": "Welcome, {{first_name}}!", "html": "

Hi {{first_name}}

" }' ``` **CLI** ```bash senddart templates create \ --name 'Welcome email' \ --subject 'Welcome, {{first_name}}!' \ --html '

Hi {{first_name}}

' ``` ### Field limits These caps are enforced at the API boundary. Exceeding one returns a `validation_error` naming the field, e.g. *`subject` must be 998 characters or fewer.* | Field | Maximum length | | --- | --- | | `name` | 255 | | `subject` | 998 | | `from` | 320 | | `reply_to` | 320 | | `alias` | 255 | ### Response Returns `{ object: "template", id }` — a slim acknowledgement. Fetch the full object with `GET /templates/:id`. ```json { "object": "template", "id": "43f68331-0622-4e15-8202-246a0388854b" } ``` > **Note:** Errors: `missing_required_field` if `name` is absent; `validation_error` if neither `html` nor `text` is provided, if any field above exceeds its maximum length, if the `alias` is already used by another of your templates, if `variables` is not an array or holds more than 50 entries, or if a variable uses a reserved key, a duplicate key, an invalid key, an unknown `type`, or a `fallback_value` that does not match its `type`. See [Errors](https://www.senddart.com/docs/api/errors). --- # List templates > GET /templates — list your templates. `GET /templates` Returns your templates, newest first, as a paginated list. This endpoint is always paginated: `limit` defaults to `20` even when you do not send it, so an account with more templates than that gets one page plus `has_more: true`. Page through the rest with `after`. **Query parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `limit` | number | No | Number of templates to retrieve. Minimum `1`, maximum `100`, default `20`. | | `after` | string | No | The template `id` after which to retrieve more templates (the next page). Not included in the result. Cannot be combined with `before`. | | `before` | string | No | The template `id` before which to retrieve more templates (the previous page). Not included in the result. Cannot be combined with `after`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.templates.list(); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Templates.list ``` **PHP** ```php templates->list(); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Templates.list() ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") templates, err := client.Templates.List(nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _templates = mb.templates.list(None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.templates().list(); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TemplateListAsync(); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/templates' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart templates list ``` ### Response ```json { "object": "list", "has_more": false, "data": [ { "id": "43f68331-0622-4e15-8202-246a0388854b", "name": "Welcome email", "subject": "Welcome, {{first_name}}!", "html": "

Hi {{first_name}}

", "status": "draft", "published_at": null, "alias": null, "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:00:00.000Z" } ] } ``` Returns `validation_error` if `limit` is outside 1–100 or if both `after` and `before` are supplied. See [Errors](https://www.senddart.com/docs/api/errors) and [Pagination](https://www.senddart.com/docs/api/pagination). --- # Retrieve template > GET /templates/:id — fetch a single template. `GET /templates/:id` The `id` path parameter also accepts an `alias`. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.templates.get('43f68331-0622-4e15-8202-246a0388854b'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Templates.get("43f68331-0622-4e15-8202-246a0388854b") ``` **PHP** ```php templates->get('43f68331-0622-4e15-8202-246a0388854b'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Templates.get("43f68331-0622-4e15-8202-246a0388854b") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") template, err := client.Templates.Get("43f68331-0622-4e15-8202-246a0388854b") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _template = mb.templates.get("43f68331-0622-4e15-8202-246a0388854b").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.templates().get("43f68331-0622-4e15-8202-246a0388854b"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TemplateRetrieveAsync("43f68331-0622-4e15-8202-246a0388854b"); ``` **cURL** ```bash curl -X GET 'https://www.senddart.com/api/templates/43f68331-0622-4e15-8202-246a0388854b' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart templates get 43f68331-0622-4e15-8202-246a0388854b ``` ### Response ```json { "object": "template", "id": "43f68331-0622-4e15-8202-246a0388854b", "current_version_id": "7c1e9b02-5a3f-4d68-9c14-8b2e0f5a6d37", "alias": null, "name": "Welcome email", "status": "published", "published_at": "2026-06-23T10:05:00.000Z", "has_unpublished_versions": false, "from": "Acme ", "subject": "Welcome, {{first_name}}!", "reply_to": null, "html": "

Hi {{first_name}}

", "text": null, "variables": [ { "id": "var_9e2b4a1f8c3d6e7b0f5a2c8d", "key": "first_name", "type": "string", "fallback_value": "there", "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:00:00.000Z" } ], "created_at": "2026-06-23T10:00:00.000Z", "updated_at": "2026-06-23T10:05:00.000Z" } ``` > **Note:** Returns `not_found` if no template with that id (or alias) belongs to you. --- # Update template > PATCH /templates/:id — edit a template's name, subject, or body. `PATCH /templates/:id` Updates only the fields you provide; omitted fields are left unchanged. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | No | New name. | | `alias` | string | null | No | New alias. Pass `null` to clear. Must be unique across your templates. | | `subject` | string | null | No | New default subject. Pass `null` to clear. | | `html` | string | null | No | New HTML body. Pass `null` to clear. | | `text` | string | null | No | New plain-text body. Pass `null` to clear. | | `from` | string | null | No | New default sender address. Use `"Your Name "` for a friendly name. Pass `null` to clear. | | `reply_to` | string | string[] | null | No | New default Reply-To address, or an array of addresses (an array is stored and returned as a single comma-separated string). Pass `null` to clear. | | `variables` | array | No | Replaces the template's variables (up to 50). Each is an object with `key`, `type`, and optional `fallback_value` — same shape as on create. | **variables[] object** | Name | Type | Required | Description | | --- | --- | --- | --- | | `key` | string | Yes | The variable key. Reserved names that cannot be used: `FIRST_NAME`, `LAST_NAME`, `EMAIL`, `UNSUBSCRIBE_URL`, `contact`, `this`. Keys must start with a letter or underscore and contain only letters, digits, underscores, or dots. | | `type` | 'string' | 'number' | No | The type of the variable. Defaults to `string` when omitted. | | `fallback_value` | string | number | null | No | The value used when none is supplied at send time. Must match `type`. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.templates.update('43f68331-0622-4e15-8202-246a0388854b', { "subject": "Welcome aboard, {{first_name}}!" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Templates.update("43f68331-0622-4e15-8202-246a0388854b", { "subject": "Welcome aboard, {{first_name}}!" }) ``` **PHP** ```php templates->update('43f68331-0622-4e15-8202-246a0388854b', [ 'subject' => "Welcome aboard, {{first_name}}!" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Templates.update("43f68331-0622-4e15-8202-246a0388854b", { "subject": "Welcome aboard, {{first_name}}!" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") updated, err := client.Templates.Update("43f68331-0622-4e15-8202-246a0388854b", &senddart.UpdateTemplateRequest{ Subject: senddart.Set("Welcome aboard, {{first_name}}!"), }) ``` **Rust** ```rust use senddart::{SendDart, UpdateTemplateOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = UpdateTemplateOptions::new().with_subject("Welcome aboard, {{first_name}}!"); let _updated = mb.templates.update("43f68331-0622-4e15-8202-246a0388854b", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.UpdateTemplateRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); UpdateTemplateRequest request = UpdateTemplateRequest.builder() .subject("Welcome aboard, {{first_name}}!") .build(); SendDartResponse response = senddart.templates().update( "43f68331-0622-4e15-8202-246a0388854b", request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TemplateUpdateAsync("43f68331-0622-4e15-8202-246a0388854b", new TemplateUpdateOptions { Subject = "Welcome aboard, {{first_name}}!", }); ``` **cURL** ```bash curl -X PATCH 'https://www.senddart.com/api/templates/43f68331-0622-4e15-8202-246a0388854b' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "subject": "Welcome aboard, {{first_name}}!" }' ``` **CLI** ```bash senddart templates update 43f68331-0622-4e15-8202-246a0388854b \ --subject 'Welcome aboard, {{first_name}}!' ``` Also edits a draft (does not auto-publish). Returns `{ object: "template", id }`. A published template keeps serving its last published snapshot until you [publish](https://www.senddart.com/docs/api/templates-publish) again. ### Field limits These caps are enforced at the API boundary. Exceeding one returns a `validation_error` naming the field, e.g. *`subject` must be 998 characters or fewer.* | Field | Maximum length | | --- | --- | | `name` | 255 | | `subject` | 998 | | `from` | 320 | | `reply_to` | 320 | | `alias` | 255 | > **Note:** Errors: `not_found` if no template with that id (or alias) belongs to you; `validation_error` if a field exceeds its maximum length, if the new `alias` is already used by another of your templates, or if `variables` is invalid (not an array, more than 50 entries, reserved/duplicate/invalid key, unknown `type`, or a `fallback_value` that does not match its `type`). See [Errors](https://www.senddart.com/docs/api/errors). --- # Publish template > POST /templates/:id/publish — snapshot the draft and make it live. `POST /templates/:id/publish` Publishes the current draft: copies the working `subject`/`html`/`text` into the published snapshot, sets `status` to `"published"`, stamps `published_at`, and records a new entry in the version history (`current_version_id` is updated). **Every** send that references the template — [`POST /emails`](https://www.senddart.com/docs/api/emails-send), batch, campaigns and automations — reads the published snapshot, so an unpublished template cannot be sent at all and later draft edits stay invisible until you publish again. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.templates.publish('43f68331-0622-4e15-8202-246a0388854b'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Templates.publish("43f68331-0622-4e15-8202-246a0388854b") ``` **PHP** ```php templates->publish('43f68331-0622-4e15-8202-246a0388854b'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Templates.publish("43f68331-0622-4e15-8202-246a0388854b") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") published, err := client.Templates.Publish("43f68331-0622-4e15-8202-246a0388854b") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _published = mb.templates.publish("43f68331-0622-4e15-8202-246a0388854b").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.templates().publish("43f68331-0622-4e15-8202-246a0388854b"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TemplatePublishAsync("43f68331-0622-4e15-8202-246a0388854b"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/templates/43f68331-0622-4e15-8202-246a0388854b/publish' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart templates publish 43f68331-0622-4e15-8202-246a0388854b ``` ### Response ```json { "object": "template", "id": "43f68331-0622-4e15-8202-246a0388854b" } ``` > **Note:** Returns `not_found` if no template with that id belongs to you. --- # Duplicate template > POST /templates/:id/duplicate — copy a template into a new draft. `POST /templates/:id/duplicate` Creates a new template that is an exact copy of the source (`subject`, `html`, `text`, `from`, `reply_to`, `variables`). The copy starts as a fresh `draft` — new `id`, no published snapshot, no version history. The source's `alias` is dropped because aliases must be unique; supply a new one in the request body if you want one. **Body parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | No | Name for the copy. Defaults to `" (copy)"` when omitted. | | `alias` | string | No | Alias for the copy. Must be unique across your templates. Omit to create the copy without an alias. | **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.templates.duplicate('43f68331-0622-4e15-8202-246a0388854b', { "name": "Welcome email v2" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Templates.duplicate("43f68331-0622-4e15-8202-246a0388854b", { "name": "Welcome email v2" }) ``` **PHP** ```php templates->duplicate('43f68331-0622-4e15-8202-246a0388854b', [ 'name' => "Welcome email v2" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Templates.duplicate("43f68331-0622-4e15-8202-246a0388854b", { "name": "Welcome email v2" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") duplicated, err := client.Templates.Duplicate("43f68331-0622-4e15-8202-246a0388854b", &senddart.DuplicateTemplateRequest{ Name: "Welcome email v2", }) ``` **Rust** ```rust use senddart::{DuplicateTemplateOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = Some(DuplicateTemplateOptions::new().with_name("Welcome email v2")); let _duplicated = mb.templates.duplicate("43f68331-0622-4e15-8202-246a0388854b", params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.DuplicateTemplateRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.templates().duplicate( "43f68331-0622-4e15-8202-246a0388854b", DuplicateTemplateRequest.builder().name("Welcome email v2").build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TemplateDuplicateAsync( "43f68331-0622-4e15-8202-246a0388854b", new TemplateDuplicateOptions { Name = "Welcome email v2" }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/templates/43f68331-0622-4e15-8202-246a0388854b/duplicate' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "Welcome email v2" }' ``` **CLI** ```bash senddart templates duplicate 43f68331-0622-4e15-8202-246a0388854b \ --name 'Welcome email v2' ``` ### Response ```json { "object": "template", "id": "b8d4f21c-3e07-4a95-bf62-1d9c5e08a743" } ``` > **Note:** Returns `not_found` if no template with that id belongs to you. --- # Delete template > DELETE /templates/:id — remove a template. `DELETE /templates/:id` Permanently deletes the template. Emails already sent are unaffected. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.templates.remove('43f68331-0622-4e15-8202-246a0388854b'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Templates.delete("43f68331-0622-4e15-8202-246a0388854b") ``` **PHP** ```php templates->remove('43f68331-0622-4e15-8202-246a0388854b'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Templates.remove("43f68331-0622-4e15-8202-246a0388854b") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") removed, err := client.Templates.Remove("43f68331-0622-4e15-8202-246a0388854b") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _removed = mb.templates.remove("43f68331-0622-4e15-8202-246a0388854b").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.templates().remove("43f68331-0622-4e15-8202-246a0388854b"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.TemplateDeleteAsync("43f68331-0622-4e15-8202-246a0388854b"); ``` **cURL** ```bash curl -X DELETE 'https://www.senddart.com/api/templates/43f68331-0622-4e15-8202-246a0388854b' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart templates delete 43f68331-0622-4e15-8202-246a0388854b ``` ### Response ```json { "object": "template", "id": "43f68331-0622-4e15-8202-246a0388854b", "deleted": true } ``` > **Note:** Returns `not_found` if no template with that id (or alias) belongs to you. See [Errors](https://www.senddart.com/docs/api/errors). --- # Which sending feature should I use? > Transactional emails (POST /emails) are for one-to-one app email; campaigns are for one-to-many marketing to a sending domain’s contacts. How to choose. SendDart has two ways to send mail, built for two different jobs. Use **transactional sends** (`POST /emails`) for messages you trigger for a single person from your application — and **campaigns** for one campaign sent to many contacts at once. Both send from a verified domain; they differ in how you address recipients and how unsubscribes are handled. ## At a glance | | Transactional | Campaign | | --- | --- | --- | | Endpoint | `POST /emails` | `POST /campaigns/:id/send` | | Shape | One-to-one (or a few `to`/`cc`/`bcc`) | One-to-many to a domain’s contacts | | Recipients | Addresses you pass in the request (`to`, 1–50) | Every subscribed contact on the linked `domain` | | Typical use | Receipts, password resets, magic links, alerts, OTPs | Newsletters, product announcements, marketing campaigns | | Triggered by | Your app, per event, in real time | You, once, when the campaign is ready | | Unsubscribe | Not applicable (1:1 app mail) | Per-contact one-click unsubscribe, added automatically | | Permission needed | `sending_access` or `full_access` | `full_access` to create/edit; send needs `sending_access` | | Scheduling | `scheduled_at` on the send | `scheduled_at` on `/send` | | Idempotency | `Idempotency-Key` header | Drafts are sent once (already-`sent` is rejected) | ## Use transactional (POST /emails) when… - The email is **for one person** and triggered by something they did — a signup, a purchase, a password reset request. - You already know the recipient address at send time and want to pass it directly. - You need a programmatic, low-latency send straight from your backend. - Examples: order receipts, password resets, email verification, magic links, security alerts, one-off notifications. A transactional send takes the recipients inline and returns an email `id` immediately: **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["customer@example.com"], "subject": "Your receipt", "html": "

Thanks for your order!

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "customer@example.com" ], "subject": "Your receipt", "html": "

Thanks for your order!

" }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "customer@example.com" ], 'subject' => "Your receipt", 'html' => "

Thanks for your order!

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "customer@example.com" ], "subject": "Your receipt", "html": "

Thanks for your order!

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"customer@example.com"}, Subject: "Your receipt", Html: "

Thanks for your order!

", }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["customer@example.com"], "Your receipt", ) .with_html("

Thanks for your order!

"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("customer@example.com") .subject("Your receipt") .html("

Thanks for your order!

") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "customer@example.com", Subject = "Your receipt", HtmlBody = "

Thanks for your order!

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["customer@example.com"], "subject": "Your receipt", "html": "

Thanks for your order!

" }' ``` **CLI** ```bash senddart emails send \ --from 'Acme ' \ --to 'customer@example.com' \ --subject 'Your receipt' \ --html '

Thanks for your order!

' ``` ## Use a campaign when… - The email goes to **many people at once** — everyone on a list, not one triggered recipient. - It is **marketing or newsletter** content where recipients must be able to unsubscribe. - You want SendDart to fan the message out across a sending domain’s [contacts](https://www.senddart.com/docs/audiences/overview) and track per-campaign performance. - Examples: monthly newsletters, launch announcements, promotions, re-engagement campaigns. A campaign targets a sending `domain` — its contact pool — instead of inline recipients. You create the draft, then send it — SendDart delivers to every subscribed contact and appends a one-click unsubscribe footer. **1. Create the campaign (draft):** **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.create({ "domain": "yourdomain.com", "from": "Acme ", "subject": "March newsletter", "html": "

What we shipped this month…

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.create({ "domain": "yourdomain.com", "from": "Acme ", "subject": "March newsletter", "html": "

What we shipped this month…

" }) ``` **PHP** ```php campaigns->create([ 'domain' => "yourdomain.com", 'from' => "Acme ", 'subject' => "March newsletter", 'html' => "

What we shipped this month…

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.create({ "domain": "yourdomain.com", "from": "Acme ", "subject": "March newsletter", "html": "

What we shipped this month…

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") campaign, err := client.Campaigns.Create(&senddart.CreateCampaignRequest{ Domain: "yourdomain.com", From: "Acme ", Subject: "March newsletter", Html: "

What we shipped this month…

", }) ``` **Rust** ```rust use senddart::{CreateCampaignOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = CreateCampaignOptions::new( "yourdomain.com", "Acme ", "March newsletter", ) .with_html("

What we shipped this month…

"); let _campaign = mb.campaigns.create(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateCampaignRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); CreateCampaignRequest request = CreateCampaignRequest.builder() .domain("yourdomain.com") .from("Acme ") .subject("March newsletter") .html("

What we shipped this month…

") .build(); SendDartResponse response = senddart.campaigns().create(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignCreateAsync(new CampaignCreateOptions { Domain = "yourdomain.com", From = "Acme ", Subject = "March newsletter", HtmlBody = "

What we shipped this month…

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/campaigns' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "domain": "yourdomain.com", "from": "Acme ", "subject": "March newsletter", "html": "

What we shipped this month…

" }' ``` **CLI** ```bash senddart campaigns create \ --domain 'yourdomain.com' \ --from 'Acme ' \ --subject 'March newsletter' \ --html '

What we shipped this month…

' ``` **2. Send it** (optionally pass `scheduled_at`), using the `id` returned from the create call: **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.campaigns.send('CAMPAIGN_ID'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Campaigns.send("CAMPAIGN_ID") ``` **PHP** ```php campaigns->send('CAMPAIGN_ID'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Campaigns.send("CAMPAIGN_ID") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Campaigns.Send("CAMPAIGN_ID", nil) ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _sent = mb.campaigns.send("CAMPAIGN_ID", None).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.campaigns().send("CAMPAIGN_ID"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.CampaignSendAsync("CAMPAIGN_ID"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/campaigns/CAMPAIGN_ID/send' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart campaigns send CAMPAIGN_ID ``` ## Transactional vs. marketing: the compliance line The endpoint split mirrors a legal one. A **transactional** email is triggered by a user action or required for compliance — order confirmations, password resets, account notices — and recipients **cannot unsubscribe** from it; it’s an essential, expected message. That’s why `POST /emails` carries no unsubscribe footer unless you set a `topic_id`. A **marketing** email is anything that isn’t transactional: promotions, newsletters, product updates. These are regulated by laws such as **CAN-SPAM** (US) and **CASL** (Canada), and recipients **must** be able to unsubscribe. That’s why campaigns append a one-click unsubscribe automatically — and why a `POST /emails` send that sets a [`topic_id`](https://www.senddart.com/docs/topics/overview) does too: `topic_id` declares the message subscription mail, and the resulting opt-out is scoped to that topic. | Message | Recipient | Send as | | --- | --- | --- | | Order / signup confirmation | Single | Transactional | | Password reset | Single | Transactional | | Abandoned-cart reminder | Single | Campaign / marketing (unsubscribable) | | Newsletter | Many | Campaign | | Promotional offer | Many | Campaign | > **Warning:** The deciding factor is the *nature* of the message, not the recipient count. A one-to-one **promotional** message (e.g. an abandoned-cart nudge) is still marketing and must be unsubscribable — don’t send it as a no-unsubscribe transactional email. > **Note:** Rule of thumb: if you would send the same content to one person because of something they did, it is **transactional**. If you would send it to a list because you decided to, it is a **campaign**. > **Warning:** Do not loop `POST /emails` over a contact list to send marketing — that bypasses audience unsubscribe handling and risks complaints. Use a campaign for one-to-many mail. See the full [emails API](https://www.senddart.com/docs/api/emails-send), [campaigns](https://www.senddart.com/docs/campaigns/managing), and [audiences](https://www.senddart.com/docs/audiences/overview) references. --- # What addresses can I use for testing? > Use the mailbox simulator addresses to deterministically trigger delivered, bounce, and complaint events without harming your reputation. SendDart provides a **mailbox simulator** — a set of reserved addresses that always produce a specific outcome. Send to them to test that your delivery, bounce, and complaint handling works end to end, without mailing real people and without affecting your sender reputation. ## Simulator addresses | Address | Result | | --- | --- | | `delivered@test.senddart.com` | Accepted and **delivered** — produces a delivery event. | | `bounced@test.senddart.com` | A **hard bounce** — the recipient is added to your suppression list. | | `complained@test.senddart.com` | A **complaint** (marked as spam) — the recipient is suppressed. | | `suppressed@test.senddart.com` | A **suppression** outcome — simulates sending to an already-suppressed address (the send is treated as a hard bounce against the suppression list). | Send to one of these exactly like any other recipient. The `from` address must still be on one of your [verified domains](https://www.senddart.com/docs/domains/managing). ## Why not @example.com or @test.com? Reaching for `@example.com` or `@test.com` is a common mistake. Those domains are not built to receive mail and routinely **reject** messages, which shows up as bounces — and a high bounce rate erodes your sender reputation and future deliverability. Use the simulator addresses above instead, which produce the outcome you want **without** a real-world bounce against your reputation. ## Labeling with a + suffix The simulator addresses support **plus-addressing**, so you can send to the same outcome address many ways and still tell the resulting events apart. Add a label after a `+` and before the `@`: ```text delivered+user1@test.senddart.com bounced+signup@test.senddart.com complained+newsletter@test.senddart.com ``` Each still triggers the same delivered / bounce / complaint behavior, but the label rides along on the event — handy for matching a [webhook](https://www.senddart.com/docs/webhooks/overview) or a `GET /emails/:id` result back to the exact test scenario (signup flow vs. newsletter flow, etc.) that produced it. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Delivery test", "html": "

This should be delivered.

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Delivery test", "html": "

This should be delivered.

" }) ``` **PHP** ```php emails->send([ 'from' => "Acme ", 'to' => [ "delivered@test.senddart.com" ], 'subject' => "Delivery test", 'html' => "

This should be delivered.

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme ", "to": [ "delivered@test.senddart.com" ], "subject": "Delivery test", "html": "

This should be delivered.

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme ", To: []string{"delivered@test.senddart.com"}, Subject: "Delivery test", Html: "

This should be delivered.

", }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme ", ["delivered@test.senddart.com"], "Delivery test", ) .with_html("

This should be delivered.

"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme ") .to("delivered@test.senddart.com") .subject("Delivery test") .html("

This should be delivered.

") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme ", To = "delivered@test.senddart.com", Subject = "Delivery test", HtmlBody = "

This should be delivered.

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme ", "to": ["delivered@test.senddart.com"], "subject": "Delivery test", "html": "

This should be delivered.

" }' ``` **CLI** ```bash senddart emails send \ --from 'Acme ' \ --to 'delivered@test.senddart.com' \ --subject 'Delivery test' \ --html '

This should be delivered.

' ``` ## Why use the simulator - **Deterministic** — `bounced@` always bounces, `complained@` always complains. No need to find or fake real bouncing mailboxes. - **Reputation-safe** — simulator traffic does **not** count against your bounce or complaint rates, so testing failure paths can never hurt deliverability. - **Real event flow** — events are generated the same way they are for real recipients, so your [webhook](https://www.senddart.com/docs/webhooks/overview) and per-email log handling get a true rehearsal. > **Warning:** After a `bounced@` or `complained@` test, that exact simulator address is added to your **suppression list** and future sends to it are skipped — this is expected, because SendDart drops suppressed recipients before sending. The event is still recorded on the first send. > **Note:** Simulator mail still counts toward your [daily sending quota](https://www.senddart.com/docs/api/limits). Keep automated test volume modest. For an automated workflow built on these addresses, see [Setting up E2E testing](https://www.senddart.com/docs/kb/e2e-testing). --- # How do I create a sender / from address? > You do not pre-create senders in SendDart — any address on a verified domain works as a from. Use the Name format. There is **no separate "sender" object** to create in SendDart. Unlike platforms that make you register and verify each individual from address, SendDart verifies at the **domain** level. Once a domain is verified, **any address on it** can be used as the `from` of an email or campaign — no extra setup per address. ## How it works 1. **Verify your domain once** — Add your domain under Domains and publish its SPF/DKIM/DMARC records. See [Managing domains](https://www.senddart.com/docs/domains/managing). 2. **Pick any address on it** — After the domain is verified, `hello@`, `receipts@`, `news@`, `support@`, or any other mailbox on that domain is a valid `from`. You do not create them anywhere first. 3. **Send** — Put the address in the `from` field. SendDart checks the domain part is one of your verified domains and sends. ## The from format The `from` field accepts either a bare address or a friendly **display name** with the address in angle brackets: ```text Acme ← display name + address (recommended) hello@yourdomain.com ← bare address ``` SendDart extracts the address from inside the `<…>` and checks that its **domain** (`yourdomain.com`) is verified for your account. A subdomain of a verified domain also works. **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.emails.send({ "from": "Acme Support ", "to": ["customer@example.com"], "subject": "We got your message", "html": "

Our team will reply shortly.

" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Emails.send({ "from": "Acme Support ", "to": [ "customer@example.com" ], "subject": "We got your message", "html": "

Our team will reply shortly.

" }) ``` **PHP** ```php emails->send([ 'from' => "Acme Support ", 'to' => [ "customer@example.com" ], 'subject' => "We got your message", 'html' => "

Our team will reply shortly.

" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Emails.send({ "from": "Acme Support ", "to": [ "customer@example.com" ], "subject": "We got your message", "html": "

Our team will reply shortly.

" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") sent, err := client.Emails.Send(&senddart.SendEmailRequest{ From: "Acme Support ", To: []string{"customer@example.com"}, Subject: "We got your message", Html: "

Our team will reply shortly.

", }) ``` **Rust** ```rust use senddart::{SendDart, SendEmailOptions}; let mb = SendDart::new("mb_xxxxxxxxx"); let params = SendEmailOptions::new( "Acme Support ", ["customer@example.com"], "We got your message", ) .with_html("

Our team will reply shortly.

"); let _sent = mb.emails.send(params).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.SendEmailRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendEmailRequest request = SendEmailRequest.builder() .from("Acme Support ") .to("customer@example.com") .subject("We got your message") .html("

Our team will reply shortly.

") .build(); SendDartResponse response = senddart.emails().send(request); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.EmailSendAsync(new EmailMessage { From = "Acme Support ", To = "customer@example.com", Subject = "We got your message", HtmlBody = "

Our team will reply shortly.

", }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "from": "Acme Support ", "to": ["customer@example.com"], "subject": "We got your message", "html": "

Our team will reply shortly.

" }' ``` **CLI** ```bash senddart emails send \ --from 'Acme Support ' \ --to 'customer@example.com' \ --subject 'We got your message' \ --html '

Our team will reply shortly.

' ``` > **Warning:** If the `from` domain is not verified you get a `validation_error`: "The domain (…) is not verified." Finish [domain verification](https://www.senddart.com/docs/domains/managing) before sending — there is nothing to create on the sender side. > **Note:** The `from` address does **not** need to be a real, provisioned mailbox in another system — SendDart only checks that its domain is verified. That said, we recommend using an address that can actually **receive replies** (or setting `reply_to`) so recipients aren’t writing into a void. > **Note:** Want replies to go somewhere other than the `from`? Set `reply_to` (a `Reply-To` header). The `from` still controls which verified domain the mail is sent from. --- # How do I set up automated (E2E) testing? > Build an end-to-end test: use a sending_access API key, send to the mailbox simulator addresses, then assert on the returned email id and the webhook events. You can verify your whole sending integration automatically — request, response, and event delivery — without mailing real people. The recipe: send to the [mailbox simulator addresses](https://www.senddart.com/docs/kb/test-addresses) with a scoped key, assert on the returned email `id`, then assert on the [webhook events](https://www.senddart.com/docs/webhooks/overview) SendDart fires for that email. ## What to set up 1. **Use a sending_access key** — Create a dedicated `sending_access` API key for tests in the dashboard (see [Create an API key](https://www.senddart.com/docs/create-an-api-key)). It can send but cannot delete domains — and no key can create or revoke keys — so a leaked CI secret is far less dangerous. Store it as a CI secret, never in the repo. 2. **Send to simulator addresses** — Send to `delivered@`, `bounced@`, and `complained@test.senddart.com` to exercise the delivered, bounce, and complaint paths deterministically — from your verified domain. 3. **Assert on the response** — A successful `POST /emails` returns `{ "id": "…" }` with HTTP 200. Capture that `id`; everything downstream keys off it. 4. **Assert on events** — Confirm the expected event arrives — either by receiving a [webhook](https://www.senddart.com/docs/webhooks/overview) for that `id`, or by polling `GET /emails/:id`, whose response includes an `events` array. ## Example test Send to the delivered simulator, then poll the email until a `delivered` event shows up. The same pattern works for `bounced@` (expect a `bounced` event) and `complained@` (expect a `complained` event). **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_TEST_KEY); // a sending_access key, from CI secrets async function send(to) { const { data, error } = await mb.emails.send({ from: 'Acme ', to: [to], subject: 'E2E delivery test', html: '

ping

', }); if (error) throw new Error(`send failed: ${JSON.stringify(error)}`); return data.id; // assert: id is a non-empty string } async function waitForEvent(id, type, { tries = 20, delayMs = 3000 } = {}) { for (let i = 0; i < tries; i++) { const { data: email } = await mb.emails.get(id); if ((email?.events || []).some((e) => e.type === type)) return email; await new Promise((r) => setTimeout(r, delayMs)); } throw new Error(`timed out waiting for ${type} on ${id}`); } // Delivered path const id = await send('delivered@test.senddart.com'); await waitForEvent(id, 'delivered'); console.log('delivered ✓'); ``` **Python** ```python import os, time, requests API = "https://www.senddart.com/api" KEY = os.environ["SENDDART_TEST_KEY"] # a sending_access key, from CI secrets HEAD = {"Authorization": f"Bearer {KEY}"} def send(to): res = requests.post( f"{API}/emails", headers=HEAD, json={ "from": "Acme ", "to": [to], "subject": "E2E delivery test", "html": "

ping

", }, ) res.raise_for_status() return res.json()["id"] # assert: non-empty string def wait_for_event(email_id, type_, tries=20, delay=3.0): for _ in range(tries): email = requests.get(f"{API}/emails/{email_id}", headers=HEAD).json() if any(e.get("type") == type_ for e in email.get("events", [])): return email time.sleep(delay) raise AssertionError(f"timed out waiting for {type_} on {email_id}") email_id = send("delivered@test.senddart.com") wait_for_event(email_id, "delivered") print("delivered ✓") ``` ## A CI flow 1. Store the `sending_access` key as an encrypted CI secret (e.g. `SENDDART_TEST_KEY`). 2. On each run, send one email per path: `delivered@`, `bounced@`, `complained@test.senddart.com`. 3. Assert each `POST /emails` returns `200` with a string `id`. 4. Wait for the matching event — `delivered`, `bounced`, `complained` — via your webhook receiver or by polling `GET /emails/:id`. 5. Fail the build if any expected event does not arrive within the timeout. > **Note:** Prefer webhooks over polling when you can: stand up a test webhook endpoint, capture events keyed by email `id`, and let your test wait on that. Polling `GET /emails/:id` is the simplest fallback when a receiver is hard to expose from CI. ## Browser E2E with Playwright If you drive a real browser flow (e.g. a Next.js app with a route that sends), [Playwright](https://playwright.dev/docs/intro) is a natural fit. Expose an endpoint that triggers a send to a simulator address, then exercise it from a test. There are two approaches, and you’ll typically want both: - **Call the real API** — drives the full path including SendDart’s response, so it catches integration regressions. It does consume your [daily quota](https://www.senddart.com/docs/api/limits), so keep these few. - **Mock the response** — intercept the request with `page.route(...)` and fulfill it with a canned `{ "id": "…" }` body. This tests *your* app’s flow without hitting the API or spending quota. **Real API** ```ts // e2e/app.spec.ts import { test, expect } from '@playwright/test'; test('calls the real SendDart API', async ({ page }) => { await page.goto('http://localhost:3000/api/send'); // The route returns the email id on success await expect(page.getByText('id')).toBeVisible(); }); ``` **Mocked** ```ts // e2e/app.spec.ts import { test, expect } from '@playwright/test'; test('mocks the response, no API call', async ({ page }) => { const body = JSON.stringify({ id: '621f3ecf-f4d2-453a-9f82-21332409b4d2' }); // Intercept the send before navigating await page.route('*/**/api/send', async (route) => { await route.fulfill({ body, contentType: 'application/json', status: 200 }); }); await page.goto('http://localhost:3000'); // ...assert on your app's UI after the (mocked) send }); ``` **Route handler** ```ts // app/api/send/route.ts — a GET that sends to a simulator address import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_TEST_KEY); export async function GET() { const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@test.senddart.com'], subject: 'Hello world', html: '

Hello world

', }); if (error) return Response.json({ error }, { status: 500 }); return Response.json(data); } ``` A minimal `playwright.config.ts` mainly needs `testDir` (where your specs live), `outputDir` (where results go), a `webServer` block so Playwright boots your app before the run, and a `projects` array for the browsers to test: **playwright.config.ts** ```ts import { defineConfig, devices } from '@playwright/test'; import path from 'path'; const baseURL = 'http://localhost:3000'; export default defineConfig({ timeout: 30 * 1000, testDir: path.join(__dirname, 'e2e'), outputDir: 'test-results/', retries: 2, webServer: { command: 'npm run dev', url: baseURL, timeout: 120 * 1000, reuseExistingServer: !process.env.CI, }, use: { baseURL, trace: 'retry-with-trace' }, projects: [ { name: 'Desktop Chrome', use: { ...devices['Desktop Chrome'] } }, { name: 'Desktop Firefox', use: { ...devices['Desktop Firefox'] } }, { name: 'Mobile Safari', use: devices['iPhone 12'] }, ], }); ``` Then install the browsers and run the suite: ```bash npx playwright install npx playwright test ``` > **Note:** Whichever approach you use, always test against a **simulator address** (e.g. `delivered@test.senddart.com`) rather than a real inbox, so the run never harms your deliverability. > **Warning:** Simulator sends still count toward your [daily quota](https://www.senddart.com/docs/api/limits). Keep E2E volume small (a few emails per run) and avoid running the suite in a tight loop. --- # Knowledge Base > A collection of answers to frequently asked questions and step-by-step guides for getting the most out of SendDart. Welcome to the SendDart Knowledge Base — a collection of answers to frequently asked questions and task-oriented guides. Where the [API reference](https://www.senddart.com/docs/api/emails-send) tells you exactly what each endpoint accepts and returns, the Knowledge Base walks you through **how to get something done**: receiving and forwarding mail, authoring templates, wiring SendDart into your stack, and handling your account. ## Sending & testing Pick the right feature, send test mail safely, and automate your integration. - [Which sending feature should I use?](https://www.senddart.com/docs/kb/which-sending-feature) — transactional sends vs. campaigns. - [What addresses can I use for testing?](https://www.senddart.com/docs/kb/test-addresses) — the mailbox simulator. - [How do I set up automated (E2E) testing?](https://www.senddart.com/docs/kb/e2e-testing) — assert on responses and events. ## Receiving & forwarding - [Can I receive emails with SendDart?](https://www.senddart.com/docs/kb/receive-emails) — inbound via webhooks. - [Forward emails with SendDart Inbound](https://www.senddart.com/docs/kb/forward-inbound) — a Next.js walkthrough. ## Templates & editors - [Template emails with React Email](https://www.senddart.com/docs/kb/react-email-templates) — author templates as components. - [Embed the React Email editor](https://www.senddart.com/docs/kb/embed-react-email-editor) — a visual editor in your own app. ## Integrations - [Get started with SendDart and Supabase](https://www.senddart.com/docs/kb/supabase-getting-started) — auth emails and Edge Functions. - [Setting up SendDart for multi-tenant apps](https://www.senddart.com/docs/kb/multi-tenant) — single account vs. BYOK. - [Send emails with n8n and SendDart](https://www.senddart.com/docs/kb/n8n) — no-code workflow automation. ## Account & security - [Where can I find documents like DPA or W-9?](https://www.senddart.com/docs/kb/downloading-documents) — compliance and tax docs. - [How to handle API keys securely](https://www.senddart.com/docs/kb/handling-api-keys) — keep `mb_` keys safe. > **Note:** Looking for the endpoint-level reference instead? Start with the [emails API](https://www.senddart.com/docs/api/emails-send), [domains](https://www.senddart.com/docs/domains/managing), and [webhooks](https://www.senddart.com/docs/webhooks/overview). --- # Can I receive emails with SendDart? > Yes — SendDart supports receiving inbound email via webhooks. Get notified on email.received, then retrieve full content and attachments through the Receiving API. Yes. SendDart supports **receiving** email (inbound) via webhooks. When mail arrives at a domain you have enabled for receiving, SendDart stores it and notifies your application so you can read, process, forward, or reply to it. ## What you can do with Receiving - Receive incoming emails and get notified with the `email.received` [webhook event](https://www.senddart.com/docs/webhooks/emails/received). - Retrieve full email content — HTML, text, and headers — using the [Receiving API](https://www.senddart.com/docs/receiving/get-email-content). - Process attachments using attachment metadata and temporary download URLs (see [Attachments](https://www.senddart.com/docs/receiving/attachments)). ## Where you can receive mail - On **your own custom domain** by adding the required `MX` record — see [Custom domains](https://www.senddart.com/docs/receiving/custom-domains). - On a SendDart-managed receiving subdomain, with no `MX` change required on your root domain. > **Note:** Webhook payloads carry only metadata, not the message body. Call the [Receiving API](https://www.senddart.com/docs/receiving/get-email-content) to fetch HTML, text, headers, and attachments for an inbound email. See the full [Receiving introduction](https://www.senddart.com/docs/receiving/introduction) to enable inbound on a domain, then [Forward emails with SendDart Inbound](https://www.senddart.com/docs/kb/forward-inbound) for a worked example. --- # Forward emails with SendDart Inbound > Receive inbound email on a verified domain, get the email.received webhook, then fetch the content and attachments and forward the message on with POST /emails. Inbound lets you **receive** email with SendDart. This guide shows how to forward a received email to another address. It uses [Next.js](https://nextjs.org/) route handlers, but the same flow works in any framework — the only SendDart-specific parts are the webhook verification and the Receiving API calls. 1. **Verify a domain for receiving** — Add and verify a domain, then enable receiving on it. We strongly recommend verifying a subdomain (subdomain.example.com) rather than the root domain. See [Managing domains](https://www.senddart.com/docs/domains/managing) and [Custom domains](https://www.senddart.com/docs/receiving/custom-domains). 2. **Create a POST route** — SendDart sends a webhook to your endpoint every time an email is received. Add a POST route that reads the raw request body. 3. **Create a webhook** — In the dashboard add a webhook pointing at your public HTTPS URL and subscribe to the email.received event. For local development, tunnel your localhost with a tool like ngrok and use that URL. 4. **Verify the webhook signature** — Copy the webhook signing secret (it starts with whsec_) and verify every request against the svix-id, svix-timestamp, and svix-signature headers — using the raw body. See [Verifying webhooks](https://www.senddart.com/docs/webhooks/verify). 5. **Process and forward** — On an email.received event, fetch the email content and attachments from the Receiving API, then forward the message with POST /emails. > **Warning:** When you enable Inbound on a domain, SendDart receives **all mail** sent to that domain (subject to MX priority). Verify a subdomain rather than your root domain so you do not capture mail meant for existing mailboxes. ## The minimal POST route Start by reading the raw request text — you need it both to verify the signature and to inspect the payload: **app/api/inbound-webhook/route.ts** ```ts import type { NextRequest } from 'next/server'; import { NextResponse } from 'next/server'; export async function POST(req: NextRequest) { try { const payload = await req.text(); return NextResponse.json(JSON.parse(payload)); } catch (error) { console.error(error); return new NextResponse(`Error: ${error}`, { status: 500 }); } } ``` ## Verify, fetch, and forward The full handler verifies the Svix signature with your webhook secret, guards on the `email.received` event, fetches the email body and attachments from the [Receiving API](https://www.senddart.com/docs/receiving/get-email-content), base64-encodes each attachment, and forwards everything with the SDK. > **Note:** Webhooks do not include the body, headers, or attachments — only metadata. You must call the [Received email content](https://www.senddart.com/docs/receiving/get-email-content) and [Attachments](https://www.senddart.com/docs/receiving/attachments) endpoints to retrieve them. This keeps payloads small for serverless environments with limited request-body sizes. **app/api/inbound-webhook/route.ts** ```ts import type { NextRequest } from 'next/server'; import { NextResponse } from 'next/server'; import { Webhook } from 'svix'; import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY!); // a full_access key const SECRET = process.env.SENDDART_WEBHOOK_SECRET!; // starts with whsec_ export async function POST(req: NextRequest) { try { // 1. Verify the webhook — use the RAW body, never a re-stringified object. const payload = await req.text(); const headers = { 'svix-id': req.headers.get('svix-id') ?? '', 'svix-timestamp': req.headers.get('svix-timestamp') ?? '', 'svix-signature': req.headers.get('svix-signature') ?? '', }; const event = new Webhook(SECRET).verify(payload, headers) as any; // 2. Only act on inbound mail. if (event.type !== 'email.received') { return NextResponse.json({ message: 'ignored' }, { status: 200 }); } const emailId = event.data.email_id; // 3. Fetch the email content (HTML, text, headers). const { data: email } = await mb.emails.receiving.get(emailId); // 4. Fetch + base64-encode any attachments. const { data: list } = await mb.emails.receiving.listAttachments(emailId); const attachments = []; for (const a of list?.data ?? []) { const buf = Buffer.from( await fetch(a.download_url).then((r) => r.arrayBuffer()), ); attachments.push({ filename: a.filename, content: buf.toString('base64') }); } // 5. Forward the message. Replace from/to with your own addresses. const { data: forwarded } = await mb.emails.send({ from: 'forwarder@yourdomain.com', // an address on YOUR verified domain to: ['you@example.com'], // where to forward it subject: event.data.subject, html: email?.html, text: email?.text, attachments, }); return NextResponse.json({ forwarded }); } catch (error) { console.error(error); return new NextResponse(`Error: ${error}`, { status: 500 }); } } ``` > **Warning:** The forwarding `from` must be an address on a [verified domain](https://www.senddart.com/docs/domains/managing) of yours — you cannot forward "as" the original sender. Use a `reply_to` header if you want replies to reach the original sender. ## Test it 1. Send a normal email to the domain you enabled — e.g. if you verified `marketing.example.com`, mail `test@marketing.example.com`. 2. Try a plain HTML email, then one with one or more attachments. 3. Confirm the forwarded copy arrives, and check the inbound email and webhook delivery in the dashboard. When it works locally, deploy your app and add your **production** endpoint as a new webhook. See [Forward emails](https://www.senddart.com/docs/receiving/forward-emails) and [Reply to emails](https://www.senddart.com/docs/receiving/reply-to-emails) for related flows. --- # Embed the React Email editor > Add the open-source React Email visual editor to your own app: install it, mount the base editor, theme it, add the Inspector sidebar, and send the exported HTML with POST /emails. The [React Email editor](https://react.email/docs/editor/overview) is an open-source visual editor that lets your users author email templates inside your own product. It ships with bubble menus, slash commands, an Inspector sidebar, and extensible nodes, and it exports email-ready HTML you can hand straight to SendDart. This guide covers embedding it in a React app, theming it, customizing the Inspector, and sending the result. ## Prerequisites - A React 18+ application (Vite, Next.js, or Remix, for example). - A bundler with [package exports](https://nodejs.org/api/packages.html#exports) support (the default for the frameworks above). 1. **Install the editor** — Add @react-email/editor and import the bundled theme stylesheet once at your app root. 2. **Mount the base editor** — The standalone EmailEditor component comes with the default extensions, menus, and theming wired up. 3. **Style the editor** — Override the --re-* CSS variables on a wrapper class to match your brand; the default theme also follows prefers-color-scheme and a .dark ancestor class. 4. **Add the Inspector sidebar** — Pass Inspector.Root as a child of EmailEditor so it shares the editor context and swaps panels based on the selection. 5. **Send the result with SendDart** — Read the exported HTML via the editor ref, POST it to your own server, and forward it to SendDart. ## Install ```bash npm install @react-email/editor ``` **app/layout.tsx** ```tsx import '@react-email/editor/themes/default.css'; ``` ## Mount the base editor **app/components/Editor.tsx** ```tsx 'use client'; import { EmailEditor } from '@react-email/editor'; const initialContent = `

Welcome

Type "/" for a command, or select text to format it.

`; export function Editor() { return ; } ``` `content` accepts an HTML string or a TipTap JSON document. For full control over which extensions load, drop down to the lower-level setup with `EditorProvider`. ## Theme it to your brand The editor exposes two styling layers: the **chrome** (menus, palette, Inspector) driven by `--re-*` custom properties and `data-re-*` selectors, and the **content** area styled via TipTap’s `.tiptap` class. Override the variables on a wrapper class: **app/styles/editor.css** ```css .brand-editor { --re-bg: #fafaf9; --re-border: #d6d3d1; --re-text: #1c1917; --re-text-muted: #78716c; --re-hover: rgba(28, 25, 23, 0.04); --re-active: rgba(28, 25, 23, 0.08); --re-radius: 0.5rem; } [data-re-bubble-menu-item][data-active] { background: #2563eb; color: #fff; } .tiptap h1 { font-size: 1.75rem; letter-spacing: -0.025em; } ``` ## Add the Inspector sidebar The Inspector is a contextual sidebar that swaps panels based on the current selection — document defaults, node properties, or text formatting. Pass `Inspector.Root` as a child of `EmailEditor` so it shares the editor context: **app/components/Editor.tsx** ```tsx 'use client'; import { EmailEditor } from '@react-email/editor'; import { Inspector } from '@react-email/editor/ui'; export function Editor() { return (
); } ``` ## Send the exported HTML with SendDart The standalone editor exposes its output through ref methods. Read the HTML in a handler, POST it to **your** server, and forward it to SendDart with [POST /emails](https://www.senddart.com/docs/api/emails-send) — never call SendDart from the browser, where your key would be exposed. | Method | Returns | Description | | --- | --- | --- | | `getEmailHTML()` | `Promise` | Email-ready HTML | | `getEmailText()` | `Promise` | Plain-text version | | `getEmail()` | `Promise<{ html, text }>` | Both in one call | ```tsx import { EmailEditor, type EmailEditorRef } from '@react-email/editor'; import { useRef } from 'react'; export function MyEditor() { const ref = useRef(null); const handleExport = async () => { if (!ref.current) return; const html = await ref.current.getEmailHTML(); // Send via YOUR server-side endpoint — the key stays on the server. await fetch('/api/send-email', { method: 'POST', body: JSON.stringify({ html }), }); }; return (
); } ``` **app/api/send-email/route.ts (your server)** ```ts import { SendDart } from 'senddart'; const mb = new SendDart(process.env.SENDDART_API_KEY); export async function POST(req: Request) { const { html } = await req.json(); const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['customer@example.com'], subject: 'Your newsletter', html, }); if (error) return Response.json(error, { status: 422 }); return Response.json(data); } ``` > **Note:** Want to store reusable templates centrally instead of exporting raw HTML each time? See [Template emails with React Email](https://www.senddart.com/docs/kb/react-email-templates) and the [Templates overview](https://www.senddart.com/docs/templates/overview). --- # Template emails with React Email > Author email templates as React components with React Email — full TypeScript and Tailwind support and a live preview server — then render them to HTML and send with POST /emails. With [React Email](https://react.email), you write email templates as React components — with full TypeScript and [Tailwind support](https://react.email/docs/components/tailwind) and a local preview server. Preview in real time with hot reload, then render to email-friendly HTML or plain text and send it through SendDart with [POST /emails](https://www.senddart.com/docs/api/emails-send). 1. **Scaffold a project** — Use create-email to generate a starter project with example templates, a preview server, and the @react-email/components package. 2. **Write a template** — Author each email as a .tsx component, optionally with typed props that become variables at send time. 3. **Preview locally** — Run the preview server to see your email render with hot reload, plus linter, compatibility, and spam tooling. 4. **Render and send** — Render the component to HTML and POST it to SendDart. ## Set up a React Email project ```bash npx create-email@latest cd react-email-starter npm install ``` This creates a `react-email-starter` folder with an `emails/` directory and a few example templates. Already have a project? Follow the React Email manual setup and add an `emails/` directory wherever you prefer. ## Write your template Create `emails/welcome.tsx`. Components are imported from `react-email`; add props to use as variables when sending. **emails/welcome.tsx** ```tsx import { Body, Button, Container, Head, Heading, Html, Preview, Section, pixelBasedPreset, Tailwind, Text, } from 'react-email'; import * as React from 'react'; interface WelcomeEmailProps { firstName?: string; productName?: string; } export default function WelcomeEmail({ firstName = 'there', productName = 'Acme', }: WelcomeEmailProps) { return ( Welcome to {productName} Welcome, {firstName} Thanks for signing up for {productName}. Let's get you started.
); } ``` ## Preview locally Add an `email:dev` script and run the preview server. Open [localhost:3000](http://localhost:3000) and pick `welcome.tsx` from the sidebar. The preview offers desktop/mobile toggles, source HTML, and plain-text output, plus a **Linter**, a **Compatibility** check against caniemail, and a **Spam** checker. **package.json** ```json { "scripts": { "email:dev": "email dev" } } ``` ## Render and send with SendDart Render the component to an HTML string with `@react-email/render`, then send it with the SDK: **sendEmail.ts** ```ts import { render } from '@react-email/render'; import { SendDart } from 'senddart'; import WelcomeEmail from './emails/welcome'; const mb = new SendDart(process.env.SENDDART_API_KEY); const html = await render( WelcomeEmail({ firstName: 'Ada', productName: 'Acme' }), ); const { data, error } = await mb.emails.send({ from: 'Acme ', to: ['delivered@yourdomain.com'], subject: 'Welcome to Acme', html, }); const id = data?.id; ``` > **Note:** Prefer to store templates on SendDart and reference them by id — with variables substituted at send time? See the [Templates overview](https://www.senddart.com/docs/templates/overview), [variables](https://www.senddart.com/docs/templates/variables), and [sending with a template](https://www.senddart.com/docs/templates/sending). > **Note:** To let your users edit templates visually inside your own product, see [Embed the React Email editor](https://www.senddart.com/docs/kb/embed-react-email-editor). --- # Get started with SendDart and Supabase > Send Supabase Auth and Edge Function emails through SendDart: verify your domain and call the HTTPS Email API from a Deno Edge Function or Auth Hook. This guide gets you sending with SendDart from a Supabase project — first your **Auth emails** (password resets, confirmations), then arbitrary mail from **Edge Functions** (notifications, account activity). ## Set up SendDart Before sending you must verify a domain. In the dashboard, add your domain — we recommend a [subdomain](https://www.senddart.com/docs/domains/managing) like `updates.example.com` — publish the generated DNS records with your provider, and wait for verification (usually a few minutes). > **Note:** SendDart requires that you own the domain you send from (not a shared or public domain). Publishing the DNS records authorizes SendDart to send on your behalf and signals to inbox providers that you are a legitimate sender. See [Managing domains](https://www.senddart.com/docs/domains/managing). ## Send Auth emails through SendDart Supabase rate-limits its built-in auth mailer. Route Supabase Auth email through a Send Email Hook that calls the SendDart HTTPS API: - **Auth Hooks** — use a [Supabase Send Email Hook](https://supabase.com/docs/guides/auth/auth-hooks) to call SendDart yourself, giving you full control of the template (e.g. via [React Email](https://www.senddart.com/docs/kb/react-email-templates) or [SendDart Templates](https://www.senddart.com/docs/templates/overview)). > **Note:** Supabase’s default auth rate limit is low; once SendDart is your provider you can raise it in your project’s authentication settings. Higher SendDart volume may also need a [quota increase](https://www.senddart.com/docs/kb/quotas). ## Send email from a Supabase Edge Function For non-auth mail, call the SendDart API directly from an Edge Function with native `fetch`. First create the function with the Supabase CLI: ```bash supabase functions new senddart ``` Then paste the handler into `index.ts`. Read the API key from an [Edge Function secret](https://supabase.com/docs/guides/functions/secrets) rather than hard-coding it: **index.ts** ```ts import { serve } from 'https://deno.land/std@0.168.0/http/server.ts'; const SENDDART_API_KEY = Deno.env.get('SENDDART_API_KEY')!; serve(async (_req: Request): Promise => { const res = await fetch('https://www.senddart.com/api/emails', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${SENDDART_API_KEY}`, }, body: JSON.stringify({ from: 'Acme ', to: ['delivered@yourdomain.com'], subject: 'hello world', html: 'it works!', }), }); const data = await res.json(); return new Response(JSON.stringify(data), { status: res.status, headers: { 'Content-Type': 'application/json' }, }); }); ``` Set the secret, run the function locally, then deploy: ```bash # store the key as a secret (never commit it) supabase secrets set SENDDART_API_KEY=mb_xxxxxxxxx # run locally supabase functions serve senddart --no-verify-jwt # deploy supabase functions deploy senddart ``` > **Warning:** The `from` address must be on a [verified domain](https://www.senddart.com/docs/domains/managing). Keep your `mb_` key in a secret, not in source — see [Handling API keys securely](https://www.senddart.com/docs/kb/handling-api-keys). For the request and response shape, see the [emails API](https://www.senddart.com/docs/api/emails-send). --- # Setting up SendDart for multi-tenant apps > Two patterns for SaaS apps that send on behalf of tenants: a single SendDart account with domain-scoped keys, or separate accounts (BYOK). Trade-offs in isolation, billing, and deliverability. Many SaaS platforms need to send email on behalf of their tenants — transactional notifications, onboarding sequences, or campaigns from a tenant’s own domain. There are two main ways to configure SendDart for this. Neither is universally "right"; the best choice depends on how much control you want and what your tenants need. ## At a glance | Factor | Single account | Separate accounts / BYOK | | --- | --- | --- | | Setup complexity | Low — domains are API-driven; each tenant key is issued in the dashboard | Higher — manual account per tenant | | Sending isolation | Shared — one bad actor affects all | Full — each tenant isolated | | Billing | One plan covers all tenants | Each tenant manages their own plan | | Per-tenant analytics | Not native | Each tenant has its own dashboard | | Webhook routing | Via the `from` domain | Each account has its own webhooks | | Deliverability | Shared sender reputation | Independent sender reputation | | Rate limits | Aggregate — likely needs an increase | Each tenant uses their own limits | ## Option A: a single SendDart account You manage everything from one account: add each tenant’s domain, verify it, and issue a **domain-scoped API key** so each tenant can only send from their own domain. All sending, billing, and analytics flow through your account. Domain setup is API-driven; issuing the key itself is a dashboard step. When a tenant signs up, create and verify their domain. **1. Create the tenant's domain:** **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.domains.create({ "name": "tenant-domain.com" }); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Domains.create({ "name": "tenant-domain.com" }) ``` **PHP** ```php domains->create([ 'name' => "tenant-domain.com" ]); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Domains.create({ "name": "tenant-domain.com" }) ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") domain, err := client.Domains.Create(&senddart.CreateDomainRequest{ Name: "tenant-domain.com", }) ``` **Rust** ```rust use senddart::{CreateDomainOptions, SendDart}; let mb = SendDart::new("mb_xxxxxxxxx"); let _domain = mb.domains.create(CreateDomainOptions::new("tenant-domain.com")).await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; import com.senddart.requests.CreateDomainRequest; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.domains().create(CreateDomainRequest.builder().name("tenant-domain.com").build()); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.DomainCreateAsync(new DomainCreateOptions { Name = "tenant-domain.com" }); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/domains' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "name": "tenant-domain.com" }' ``` **CLI** ```bash senddart domains add tenant-domain.com ``` **2. After the tenant publishes the DNS records, trigger verification:** **Node.js** ```js import { SendDart } from 'senddart'; const mb = new SendDart('mb_xxxxxxxxx'); const { data, error } = await mb.domains.verify('DOMAIN_ID'); console.log({ data, error }); ``` **Ruby** ```ruby require "senddart" SendDart.api_key = "mb_xxxxxxxxx" SendDart::Domains.verify("DOMAIN_ID") ``` **PHP** ```php domains->verify('DOMAIN_ID'); ``` **Python** ```python import senddart senddart.api_key = "mb_xxxxxxxxx" senddart.Domains.verify("DOMAIN_ID") ``` **Go** ```go import "github.com/shekhu10/senddart-sdks/senddart-go" client := senddart.NewClient("mb_xxxxxxxxx") verified, err := client.Domains.Verify("DOMAIN_ID") ``` **Rust** ```rust use senddart::SendDart; let mb = SendDart::new("mb_xxxxxxxxx"); let _verified = mb.domains.verify("DOMAIN_ID").await?; ``` **Java** ```java import com.senddart.SendDart; import com.senddart.SendDartResponse; SendDart senddart = new SendDart("mb_xxxxxxxxx"); SendDartResponse response = senddart.domains().verify("DOMAIN_ID"); ``` **.NET** ```csharp using SendDart; ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx"); var resp = await senddart.DomainVerifyAsync("DOMAIN_ID"); ``` **cURL** ```bash curl -X POST 'https://www.senddart.com/api/domains/DOMAIN_ID/verify' \ -H 'Authorization: Bearer mb_xxxxxxxxx' ``` **CLI** ```bash senddart domains verify DOMAIN_ID ``` > **Note:** Verification is asynchronous — DNS must propagate first. Listen for the [`domain.verified` webhook](https://www.senddart.com/docs/webhooks/domains/updated) instead of polling. Once verified, create a `sending_access` key scoped to that domain so the tenant can only send from it. This step is **dashboard-only** — on the **API Keys** page, create the key, choose **Sending access**, and restrict it to the tenant’s verified domain. `POST /api-keys` is not available to API-key callers: it returns `403 dashboard_only` for every key, so a tenant key can never mint another tenant a key. See [Create an API key](https://www.senddart.com/docs/create-an-api-key). > **Warning:** The API key token is shown **only once** at creation. Copy it then and hand it to the tenant through a secure channel — you cannot retrieve it again. > **Note:** Because key issuance is manual, onboarding a tenant is not fully unattended: domain creation and verification automate cleanly, then someone signs in to issue that tenant’s key. If you onboard tenants at volume, plan an internal step for it. You can still audit keys programmatically — `GET /api-keys` lists them with `last_used_at`. - **Pros:** domain setup automates over the API; domain-scoped keys confine each tenant to their own domain; one account to manage. - **Cons:** no per-tenant analytics in the dashboard; tenants share your sender reputation; aggregate volume will likely need a [quota increase](https://www.senddart.com/docs/kb/quotas). > **Warning:** Shared reputation cuts both ways: if one tenant sends spam or runs up bounce/complaint rates, deliverability degrades for **every** tenant on your account — and in severe cases the whole account can be suspended. ## Option B: separate accounts (BYOK) In the Bring-Your-Own-Key model, each tenant creates their own SendDart account, adds their domain, and gives you their API key. Your app stores each tenant’s key and uses it when sending for them: ```ts import { SendDart } from 'senddart'; // Look up the calling tenant's own SendDart key, then send with it. const tenantApiKey = await getTenantKey(tenantId); const mb = new SendDart(tenantApiKey); await mb.emails.send({ from: 'notifications@tenant-domain.com', to: ['user@example.com'], subject: 'Your order has shipped', html: '

Your order #1234 is on its way.

', }); ``` - **Pros:** full isolation — each tenant’s reputation and deliverability are independent; no liability for tenant behavior on your account; each tenant has their own dashboard and rate limits. - **Cons:** each tenant must create and manage their own account and plan, which adds onboarding friction for those unfamiliar with email infrastructure. ## Webhook routing With **Option A**, route on the sending domain. Every [webhook](https://www.senddart.com/docs/webhooks/overview) payload carries `data.from`, and each tenant sends from their own verified domain — so mapping that domain back to a tenant id resolves every event unambiguously. With **Option B**, each tenant configures their own webhooks, so events are naturally isolated — no routing logic needed. ## Deliverability & migration Sender reputation is tied to the sending account and its domains. Under Option A all tenants share one reputation; under Option B each is independent. Either way, every new tenant domain should follow a warm-up schedule and ideally send from a [subdomain](https://www.senddart.com/docs/domains/managing) to protect the tenant’s root domain. > **Warning:** Moving a domain between accounts requires deleting it from the original account before re-verifying it in the second — plan for a sending interruption during DNS propagation. See [Create domain](https://www.senddart.com/docs/domains/managing) and [Webhooks](https://www.senddart.com/docs/webhooks/overview) for the underlying endpoints, and [Create an API key](https://www.senddart.com/docs/create-an-api-key) for the dashboard key step. --- # Send emails with n8n and SendDart > Use the SendDart HTTP Request node in n8n to send email, plus a webhook trigger node to start workflows on delivery, bounce, and other email events. [n8n](https://n8n.io) is a workflow automation platform that connects apps and builds automations with little or no code. You can call SendDart from n8n with its built-in **HTTP Request** node to send email, and start workflows from SendDart [webhook events](https://www.senddart.com/docs/webhooks/overview) with a **Webhook** trigger node — delivered, opened, bounced, and more. ## Before you start - [Create an API key](https://www.senddart.com/docs/create-an-api-key) in the dashboard and copy it — a `sending_access` key is enough to send. - Verify a [domain](https://www.senddart.com/docs/domains/managing) so you can send to addresses other than your own. ## Send an email from a workflow Add an **HTTP Request** node and configure it to call `POST ${BASE}/emails`: 1. **Add an HTTP Request node** — On the canvas, add an HTTP Request node after your trigger. 2. **Set method and URL** — Method POST, URL https://www.senddart.com/api/emails. 3. **Add authentication** — Add a header Authorization with value Bearer mb_xxxxxxxxx (store the key in an n8n credential rather than inline). 4. **Send JSON body** — Set the body to JSON with from, to, subject, and html fields. Map values from earlier nodes with n8n expressions. 5. **Execute** — Run the node; a 200 response with an email id means it was accepted. A minimal body for the node: ```json { "from": "Acme ", "to": ["customer@example.com"], "subject": "Hello from n8n", "html": "

Sent from an n8n workflow.

" } ``` > **Note:** Store the API key as an n8n **Header Auth** credential (header `Authorization`, value `Bearer mb_xxxxxxxxx`) and reference it from the node, so the key is not saved in the workflow JSON. ## Trigger a workflow on email events To start a workflow when something happens to your mail, add a **Webhook** trigger node, copy its URL, and register that URL as a [webhook endpoint](https://www.senddart.com/docs/webhooks/overview) in SendDart — subscribing to the events you care about. Verify the [signature](https://www.senddart.com/docs/webhooks/verify) (the `svix-*` headers and your `whsec_` secret) before acting on a payload. Events you can trigger on include: | Event | Fires when | | --- | --- | | `email.sent` | The email was accepted and sent. | | `email.delivered` | The email was delivered to the recipient. | | `email.bounced` | The email bounced. | | `email.complained` | A spam complaint was received. | | `email.opened` | The recipient opened the email. | | `email.clicked` | A link in the email was clicked. | | `email.received` | An inbound email was received (see [Receiving](https://www.senddart.com/docs/kb/receive-emails)). | | `contact.created` | A new contact was added. | ## Example: welcome email on new contact 1. **Webhook trigger** — listens for `contact.created`. 2. **HTTP Request** — sends a welcome email to the new contact, mapping the address from the trigger payload. The trigger-then-act pattern works for any event — notify Slack on a bounce, or log delivery events to a sheet. See the full [emails API](https://www.senddart.com/docs/api/emails-send) and [webhooks overview](https://www.senddart.com/docs/webhooks/overview). --- # Add SendDart DNS records on Cloudflare > Publish the SPF, DKIM, and DMARC records SendDart generates for your domain using the Cloudflare dashboard. This guide walks through adding the DNS records SendDart generates for a domain using the **Cloudflare** dashboard. Before you start, add your domain in SendDart to generate the records — see [Managing domains](https://www.senddart.com/docs/domains/managing) — and keep the [DNS records](https://www.senddart.com/docs/domains/dns) reference open, since the exact values (your DKIM record and your region) come from there. Cloudflare must be your domain’s **authoritative DNS** (your nameservers point at Cloudflare) for these records to take effect. If your domain only uses Cloudflare as a proxy in front of another DNS host, add the records at the authoritative host instead. ## Open the DNS records editor 1. **Select your domain** — Log in at **dash.cloudflare.com** and click the domain (zone) you want to send mail from. 2. **Go to DNS → Records** — In the left sidebar choose **DNS**, then **Records**. This lists every record on the zone and has the **Add record** button. 3. **Add each record** — Click **Add record** once per entry below. Choose the **Type**, fill in **Name** and the target, and save. Repeat for all records shown in your SendDart domain configuration. ## DKIM — TXT Add **one** TXT record holding your domain’s DKIM public key. In Cloudflare’s **Name** field you can enter the full host or just the part before your domain — Cloudflare appends the zone automatically and displays the full name. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | A single DKIM key record. | | `Name` | senddart._domainkey | No | Cloudflare auto-appends `.yourdomain.com`, giving `senddart._domainkey.yourdomain.com`. `senddart` is the fixed selector SendDart uses. | | `Content` | v=DKIM1; k=rsa; p= | No | The DKIM key record holding your domain’s public key. | | `TTL` | Auto | No | Leave at the Cloudflare default. | ## SPF — MX + TXT on send.yourdomain.com SendDart uses a custom MAIL FROM subdomain, `send.yourdomain.com`, which needs both an MX and a TXT record. In the **Name** field enter `send` — Cloudflare appends the zone. MX and TXT records cannot be proxied, so there is no cloud toggle on these rows. **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX | No | Routes bounce and complaint feedback for the MAIL FROM subdomain. | | `Name` | send | No | Resolves to `send.yourdomain.com`. | | `Mail server` | feedback-smtp.us-east-1.amazonses.com | No | Region-specific feedback host. Replace `us-east-1` with your domain’s region. | | `Priority` | 10 | No | MX priority. | | `TTL` | Auto | No | Cloudflare default. | **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | SPF policy for the MAIL FROM subdomain. | | `Name` | send | No | Same host as the MX — resolves to `send.yourdomain.com`. | | `Content` | v=spf1 include:amazonses.com ~all | No | Authorizes Amazon SES to send for the MAIL FROM subdomain. Paste exactly; Cloudflare quotes it for you. | | `TTL` | Auto | No | Cloudflare default. | ## DMARC — TXT on _dmarc.yourdomain.com **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | DMARC policy record. | | `Name` | _dmarc | No | Resolves to `_dmarc.yourdomain.com`. | | `Content` | v=DMARC1; p=none; | No | A monitoring policy to start with; tighten to `quarantine` or `reject` later. | | `TTL` | Auto | No | Cloudflare default. | > **Note:** Cloudflare-specific gotchas: do not append a trailing dot to CNAME/MX targets in the dashboard (Cloudflare handles it); and if you have an existing SPF TXT at the apex, leave it — SendDart’s SPF lives on the `send.` subdomain, not the root. Cloudflare’s edge DNS usually propagates within a minute or two. Once all records shown in your SendDart domain configuration are in, return to SendDart and [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). --- # Add SendDart DNS records on GoDaddy > Publish the SPF, DKIM, and DMARC records SendDart generates for your domain using the GoDaddy DNS Management page. This guide walks through adding the DNS records SendDart generates for a domain using **GoDaddy**’s DNS Management page. First add your domain in SendDart to generate the records — see [Managing domains](https://www.senddart.com/docs/domains/managing) — and keep the [DNS records](https://www.senddart.com/docs/domains/dns) reference open for your exact DKIM record and region. These steps assume GoDaddy is hosting your DNS (the default when you register with them). If you pointed the domain at custom nameservers, add the records wherever those nameservers are hosted instead. ## Open DNS Management 1. **Open your domain portfolio** — Sign in at **godaddy.com**, open the account menu, and choose **My Products**. Find your domain and click **DNS** (or **Manage DNS**). 2. **Find the Records section** — On the DNS Management page scroll to **Records**. This table lists existing records and has an **Add** (or **Add New Record**) button. 3. **Add each record** — Click **Add**, pick the **Type**, fill in the fields below, and **Save**. Repeat for all records shown in your SendDart domain configuration. > **Warning:** GoDaddy’s **Host / Name** field expects the subdomain part **without** your domain — GoDaddy appends the domain for you. Enter `senddart._domainkey`, `send`, and `_dmarc` (not the full `…yourdomain.com`). Entering the full hostname produces a doubled name like `send.yourdomain.com.yourdomain.com`. ## DKIM — TXT Add **one** TXT record holding your domain’s DKIM public key. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | A single DKIM key record. | | `Name (Host)` | senddart._domainkey | No | GoDaddy appends `.yourdomain.com`, giving `senddart._domainkey.yourdomain.com`. `senddart` is the fixed selector SendDart uses. | | `Value (Points to)` | v=DKIM1; k=rsa; p= | No | The DKIM key record holding your domain’s public key. | | `TTL` | 1 Hour | No | GoDaddy default is fine. | ## SPF — MX + TXT on the send subdomain SendDart uses the custom MAIL FROM subdomain `send.yourdomain.com`. On GoDaddy enter `send` in the Host/Name field for both the MX and the TXT. **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX | No | Receives bounce and complaint feedback for the MAIL FROM subdomain. | | `Name (Host)` | send | No | Resolves to `send.yourdomain.com`. | | `Value (Points to)` | feedback-smtp.us-east-1.amazonses.com | No | Region-specific feedback host. Replace `us-east-1` with your domain’s region. | | `Priority` | 10 | No | GoDaddy has a dedicated Priority field for MX records. | | `TTL` | 1 Hour | No | GoDaddy default. | **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | SPF policy for the MAIL FROM subdomain. | | `Name (Host)` | send | No | Same host as the MX — resolves to `send.yourdomain.com`. | | `Value` | v=spf1 include:amazonses.com ~all | No | Authorizes Amazon SES for the MAIL FROM subdomain. Paste without surrounding quotes. | | `TTL` | 1 Hour | No | GoDaddy default. | ## DMARC — TXT on _dmarc **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | DMARC policy record. | | `Name (Host)` | _dmarc | No | Resolves to `_dmarc.yourdomain.com`. | | `Value` | v=DMARC1; p=none; | No | A monitoring policy to start with. | | `TTL` | 1 Hour | No | GoDaddy default. | > **Note:** GoDaddy-specific gotchas: use the bare Host (`send`, `_dmarc`, `senddart._domainkey`) — never the full domain; do not add a trailing dot to CNAME/MX values; and if a default GoDaddy SPF record already exists at the apex, leave it alone — SendDart’s SPF belongs on the `send.` subdomain. GoDaddy DNS changes typically propagate within an hour. Once all records shown in your SendDart domain configuration are saved, return to SendDart and [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). --- # Add SendDart DNS records on Namecheap > Publish the SPF, DKIM, and DMARC records SendDart generates for your domain using Namecheap’s Advanced DNS tab. This guide walks through adding the DNS records SendDart generates for a domain using **Namecheap**’s Advanced DNS tab. Add your domain in SendDart first to generate the records — see [Managing domains](https://www.senddart.com/docs/domains/managing) — and keep the [DNS records](https://www.senddart.com/docs/domains/dns) reference open for your exact DKIM record and region. These steps require **Namecheap BasicDNS** (the default). If your domain uses Custom DNS / external nameservers, add the records at that provider instead. ## Open Advanced DNS 1. **Open Domain List** — Sign in at **namecheap.com**, go to **Domain List** in the left sidebar, and click **Manage** next to your domain. 2. **Go to the Advanced DNS tab** — Open the **Advanced DNS** tab. The **Host Records** section is where you add the records below. 3. **Add each record** — Click **Add New Record**, choose the **Type**, fill in **Host** and **Value**, and click the green check to save. Repeat for all records shown in your SendDart domain configuration. > **Warning:** Namecheap’s **Host** field takes the subdomain part **without** the apex — Namecheap appends your domain automatically. Use `@` only for the apex itself. For SendDart enter `senddart._domainkey`, `send`, and `_dmarc` — never the full `…yourdomain.com`. ## DKIM — TXT Add **one** TXT Record entry holding your domain’s DKIM public key. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT Record | No | A single DKIM key record. | | `Host` | senddart._domainkey | No | Namecheap appends `.yourdomain.com`, giving `senddart._domainkey.yourdomain.com`. `senddart` is the fixed selector SendDart uses. | | `Value` | v=DKIM1; k=rsa; p= | No | The DKIM key record holding your domain’s public key. | | `TTL` | Automatic | No | Namecheap default. | ## SPF — MX + TXT on the send subdomain SendDart uses the custom MAIL FROM subdomain `send.yourdomain.com`. Enter `send` in the Host field for both records. Namecheap’s MX entry is an **MX Record** type with a separate **Priority** column. **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX Record | No | Receives bounce and complaint feedback for the MAIL FROM subdomain. | | `Host` | send | No | Resolves to `send.yourdomain.com`. | | `Value` | feedback-smtp.us-east-1.amazonses.com | No | Region-specific feedback host. Replace `us-east-1` with your domain’s region. | | `Priority` | 10 | No | MX priority column. | | `TTL` | Automatic | No | Namecheap default. | **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT Record | No | SPF policy for the MAIL FROM subdomain. | | `Host` | send | No | Same host as the MX — resolves to `send.yourdomain.com`. | | `Value` | v=spf1 include:amazonses.com ~all | No | Authorizes Amazon SES for the MAIL FROM subdomain. | | `TTL` | Automatic | No | Namecheap default. | ## DMARC — TXT on _dmarc **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT Record | No | DMARC policy record. | | `Host` | _dmarc | No | Resolves to `_dmarc.yourdomain.com`. | | `Value` | v=DMARC1; p=none; | No | A monitoring policy to start with. | | `TTL` | Automatic | No | Namecheap default. | > **Note:** Namecheap-specific gotchas: the **Host** field uses `@` for the apex and the bare subdomain (e.g. `send`) for everything else — never the full domain; and remove or ignore Namecheap’s default “Parking Page” URL/CNAME records on the apex, which are unrelated to mail. Namecheap typically propagates within about 30 minutes. Once all records shown in your SendDart domain configuration are saved, return to SendDart and [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). --- # Add SendDart DNS records on AWS Route 53 > Publish the SPF, DKIM, and DMARC records SendDart generates for your domain in an AWS Route 53 hosted zone. This guide walks through adding the DNS records SendDart generates for a domain in an **AWS Route 53** hosted zone. Add your domain in SendDart first to generate the records — see [Managing domains](https://www.senddart.com/docs/domains/managing) — and keep the [DNS records](https://www.senddart.com/docs/domains/dns) reference open for your exact DKIM record and region. You need a Route 53 **public hosted zone** for your domain, with your registrar’s nameservers pointed at it. (SendDart’s sending region and your Route 53 hosted zone are independent — Route 53 is global DNS regardless of which region your mail goes through.) ## Open the hosted zone 1. **Open Route 53** — In the AWS Console go to **Route 53 → Hosted zones** and click the hosted zone for your domain. 2. **Create records** — Click **Create record**. Use **Quick create record** to add several records on one screen, or create them one at a time. 3. **Add each record** — For each entry below set **Record name**, **Record type**, and **Value**, then **Create records**. Repeat for all six. > **Warning:** In Route 53 the **Record name** is the subdomain portion; the console shows your domain as a fixed suffix beside the input. Enter `senddart._domainkey`, `send`, and `_dmarc` — do not retype `.yourdomain.com`. Leave the record name blank only for the apex (you won’t need that here). ## DKIM — TXT Add **one** TXT record holding your domain’s DKIM public key. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Record type` | TXT | No | A single DKIM key record. | | `Record name` | senddart._domainkey | No | Combined with the zone suffix this is `senddart._domainkey.yourdomain.com`. `senddart` is the fixed selector SendDart uses. | | `Value` | v=DKIM1; k=rsa; p= | No | The DKIM key record holding your domain’s public key. | | `TTL` | 300 | No | Route 53 default (seconds). | ## SPF — MX + TXT on send.yourdomain.com SendDart uses the custom MAIL FROM subdomain `send.yourdomain.com`. Set the **Record name** to `send` for both records. In Route 53 the MX **priority is part of the value** — enter it as `10 feedback-smtp..amazonses.com`. Wrap the TXT value in double quotes. **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Record type` | MX | No | Receives bounce and complaint feedback for the MAIL FROM subdomain. | | `Record name` | send | No | Resolves to `send.yourdomain.com`. | | `Value` | 10 feedback-smtp.us-east-1.amazonses.com | No | Priority and host on one line — `10` is the priority. Replace `us-east-1` with your domain’s region. | | `TTL` | 300 | No | Route 53 default. | **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Record type` | TXT | No | SPF policy for the MAIL FROM subdomain. | | `Record name` | send | No | Same host as the MX — resolves to `send.yourdomain.com`. | | `Value` | "v=spf1 include:amazonses.com ~all" | No | Authorizes Amazon SES for the MAIL FROM subdomain. Route 53 requires TXT values in double quotes. | | `TTL` | 300 | No | Route 53 default. | ## DMARC — TXT on _dmarc.yourdomain.com **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Record type` | TXT | No | DMARC policy record. | | `Record name` | _dmarc | No | Resolves to `_dmarc.yourdomain.com`. | | `Value` | "v=DMARC1; p=none;" | No | A monitoring policy to start with. Keep it in double quotes. | | `TTL` | 300 | No | Route 53 default. | > **Note:** Route 53-specific gotchas: TXT values **must be double-quoted**; the MX **priority goes inside the value** (`10 host`), not a separate field; and confirm your registrar’s nameservers actually point at this hosted zone (Route 53 → hosted zone NS records) or nothing you add here resolves publicly. Route 53 applies changes within a minute, though resolver caches honor the TTL. Once all records shown in your SendDart domain configuration exist, return to SendDart and [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). --- # Add SendDart DNS records on Vercel > Publish the SPF, DKIM, and DMARC records SendDart generates for your domain using Vercel’s Domains DNS records UI. This guide walks through adding the DNS records SendDart generates for a domain using **Vercel**. Add your domain in SendDart first to generate the records — see [Managing domains](https://www.senddart.com/docs/domains/managing) — and keep the [DNS records](https://www.senddart.com/docs/domains/dns) reference open for your exact DKIM record and region. This applies when Vercel manages your domain’s DNS — i.e. the domain’s nameservers point at Vercel (Vercel is your DNS provider), not just when a project is attached to the domain. ## Open the DNS Records editor 1. **Open Domains** — In the Vercel dashboard go to your **team/account → Settings → Domains** (or the project’s **Domains** tab) and select your domain. 2. **Find DNS Records** — Scroll to the **DNS Records** section, which lists current records and has an **Add** form. 3. **Add each record** — In the Add form choose the **Type**, set **Name**, fill in **Value**, and click **Add**. Repeat for all records shown in your SendDart domain configuration. > **Warning:** Vercel’s **Name** field is the subdomain relative to your domain — leave it blank or `@` for the apex, otherwise enter just the prefix. Use `senddart._domainkey`, `send`, and `_dmarc` (not the full hostname). Vercel appends your domain automatically. ## DKIM — TXT Add **one** TXT record holding your domain’s DKIM public key. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | A single DKIM key record. | | `Name` | senddart._domainkey | No | Vercel appends `.yourdomain.com`, giving `senddart._domainkey.yourdomain.com`. `senddart` is the fixed selector SendDart uses. | | `Value` | v=DKIM1; k=rsa; p= | No | The DKIM key record holding your domain’s public key. | | `TTL` | 60 | No | Vercel default (seconds); leave as-is. | ## SPF — MX + TXT on the send subdomain SendDart uses the custom MAIL FROM subdomain `send.yourdomain.com`. Set **Name** to `send` for both records. Vercel’s MX form has a dedicated **Priority** field. **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX | No | Receives bounce and complaint feedback for the MAIL FROM subdomain. | | `Name` | send | No | Resolves to `send.yourdomain.com`. | | `Value` | feedback-smtp.us-east-1.amazonses.com | No | Region-specific feedback host. Replace `us-east-1` with your domain’s region. | | `Priority` | 10 | No | Vercel’s separate MX priority field. | | `TTL` | 60 | No | Vercel default. | **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | SPF policy for the MAIL FROM subdomain. | | `Name` | send | No | Same host as the MX — resolves to `send.yourdomain.com`. | | `Value` | v=spf1 include:amazonses.com ~all | No | Authorizes Amazon SES for the MAIL FROM subdomain. Enter without surrounding quotes. | | `TTL` | 60 | No | Vercel default. | ## DMARC — TXT on _dmarc **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | DMARC policy record. | | `Name` | _dmarc | No | Resolves to `_dmarc.yourdomain.com`. | | `Value` | v=DMARC1; p=none; | No | A monitoring policy to start with. | | `TTL` | 60 | No | Vercel default. | > **Note:** Vercel-specific gotchas: only the **DNS Records** editor matters here — attaching the domain to a project does not publish these mail records; enter the **Name** as the bare prefix (`send`, `_dmarc`, `senddart._domainkey`), not the full domain; and do not add the SPF to the apex — it belongs on the `send.` subdomain. Vercel’s DNS propagates quickly given its low default TTL. Once all records shown in your SendDart domain configuration are added, return to SendDart and [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). --- # Add SendDart DNS records on Squarespace / Google Domains > Publish the SPF, DKIM, and DMARC records SendDart generates for your domain using Squarespace Domains (which now manages former Google Domains). This guide walks through adding the DNS records SendDart generates for a domain using **Squarespace Domains** — the service that now manages domains migrated from **Google Domains**. Add your domain in SendDart first to generate the records — see [Managing domains](https://www.senddart.com/docs/domains/managing) — and keep the [DNS records](https://www.senddart.com/docs/domains/dns) reference open for your exact DKIM record and region. If your domain was registered with Google Domains, it has been transferred to Squarespace and these steps apply. The DNS editor layout is the same custom-records table in both. ## Open the DNS settings 1. **Open your domain** — Sign in at **account.squarespace.com**, go to **Domains**, and click the domain you want to send mail from. 2. **Go to DNS Settings** — Open **DNS** (or **DNS Settings**) and scroll to the **Custom Records** section, which has an **Add Record** row. 3. **Add each record** — For each entry below pick the **Type**, fill in **Host** and **Data**, and **Add**/save. Repeat for all records shown in your SendDart domain configuration. > **Warning:** The **Host** field takes the subdomain part only — use `@` for the apex and the bare prefix otherwise. Enter `senddart._domainkey`, `send`, and `_dmarc` (Squarespace appends your domain). Do not type the full `…yourdomain.com`. ## DKIM — TXT Add **one** TXT record holding your domain’s DKIM public key. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | A single DKIM key record. | | `Host` | senddart._domainkey | No | Squarespace appends `.yourdomain.com`, giving `senddart._domainkey.yourdomain.com`. `senddart` is the fixed selector SendDart uses. | | `Data` | v=DKIM1; k=rsa; p= | No | The DKIM key record holding your domain’s public key. | | `TTL` | Default | No | Use the Squarespace default. | ## SPF — MX + TXT on the send subdomain SendDart uses the custom MAIL FROM subdomain `send.yourdomain.com`. Enter `send` in the Host field for both records. Squarespace’s MX record includes a **Priority** field. **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX | No | Receives bounce and complaint feedback for the MAIL FROM subdomain. | | `Host` | send | No | Resolves to `send.yourdomain.com`. | | `Data` | feedback-smtp.us-east-1.amazonses.com | No | Region-specific feedback host. Replace `us-east-1` with your domain’s region. | | `Priority` | 10 | No | MX priority field. | | `TTL` | Default | No | Squarespace default. | **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | SPF policy for the MAIL FROM subdomain. | | `Host` | send | No | Same host as the MX — resolves to `send.yourdomain.com`. | | `Data` | v=spf1 include:amazonses.com ~all | No | Authorizes Amazon SES for the MAIL FROM subdomain. | | `TTL` | Default | No | Squarespace default. | ## DMARC — TXT on _dmarc **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | DMARC policy record. | | `Host` | _dmarc | No | Resolves to `_dmarc.yourdomain.com`. | | `Data` | v=DMARC1; p=none; | No | A monitoring policy to start with. | | `TTL` | Default | No | Squarespace default. | > **Note:** Squarespace / Google Domains gotchas: edit DNS only when the domain uses **Squarespace nameservers** (a domain pointed elsewhere is managed at that provider); use `@`/bare prefixes in the **Host** field, never the full domain; and keep SendDart’s SPF on the `send.` subdomain rather than merging it into any apex SPF record. Squarespace DNS changes can take up to a couple of hours to propagate. Once all records shown in your SendDart domain configuration are saved, return to SendDart and [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). --- # What if my domain isn't verifying? > A step-by-step checklist for a domain stuck at pending or failed: confirm the records were added exactly, wait for propagation, clear conflicting records, and re-verify. A freshly added domain starts at `pending` and only flips to `verified` once SendDart can resolve the DNS records it generated for it. When the records are published correctly, a domain often verifies within about **15 minutes**. If it stays `pending` for a long time — or goes `failed` — it is almost always a DNS publishing issue, not a problem with your account. Work through the checklist below in order. After each change, give DNS time to propagate and then click **Verify** in the dashboard (or call [`POST /domains/:id/verify`](https://www.senddart.com/docs/api/domains-verify)) to re-check. ## Verification checklist 1. **Confirm every record was added exactly.** All three generated entries must be published: the **DKIM TXT** record and the **SPF MX** and **SPF TXT** on the `send.` subdomain. Compare each `Name` and `Value` character-for-character against the [DNS records](https://www.senddart.com/docs/domains/dns) shown in the dashboard (or the [`POST /domains`](https://www.senddart.com/docs/api/domains-create) response). A single transposed character will block verification. 2. **Wait for propagation.** DNS changes take anywhere from a few minutes to several hours to propagate, depending on your provider and the record TTLs. A domain sitting at `pending` shortly after you publish is normal — wait, then re-verify. 3. **Check for conflicting old records.** If you previously used another email provider, delete stale records that clash — an old `_dmarc` TXT, a pre-existing SPF TXT on the `send.` host, or an outdated DKIM TXT at `senddart._domainkey`. Two conflicting records for the same name will fail verification. 4. **Make sure the DKIM TXT value is intact.** The DKIM record is a single TXT at `senddart._domainkey.` holding a long public key (`v=DKIM1; k=rsa; p=...`). Some DNS UIs truncate, wrap, or split long TXT values — paste the value exactly as SendDart shows it, with no added quotes or line breaks, so the full key resolves. 5. **Avoid auto-appended domain suffixes.** Many DNS UIs append your domain to the `Name` automatically. If you paste `senddart._domainkey.yourdomain.com` into such a field you can end up with `senddart._domainkey.yourdomain.com.yourdomain.com`. Enter only the host portion when the UI adds the domain for you. 6. **Click Verify (or call the verify endpoint).** Verification is not automatic — after publishing or fixing records, trigger a fresh check. SendDart re-queries DNS and updates the domain and each record to `verified`, `failed`, or still `pending`. ## What each status means | Status | What to do | | --- | --- | | `pending` | SendDart has not yet confirmed the records. Wait for propagation, double-check the values, and re-verify. | | `failed` | DKIM verification failed — the record was not found or is incorrect. Fix the DNS (most often the DKIM TXT) and re-verify. | | `verified` | Done — the domain and its subdomains can send email. | > **Note:** Verification keys off **DKIM**: the `senddart._domainkey.` TXT record must resolve for the domain to flip to `verified`. The SPF records improve deliverability, and DMARC — which you publish yourself — improves it further, but the DKIM TXT is what SendDart checks for the identity. ## Records added at the wrong DNS provider If your domain’s DNS is managed in more than one place — for example the registrar where you bought it, plus a host like Vercel or Cloudflare you later pointed it at — it is easy to publish the records at a provider that is **not** the one actually answering DNS queries. SendDart then never sees them and the domain stays `pending`. Run a nameserver lookup for your domain (any public DNS-checker tool, or `nslookup -type=NS yourdomain.com`) to confirm which provider currently controls your DNS, then add the SendDart records **there**. ## Region-mismatch and multiple-regions errors The MAIL FROM `MX` value embeds your domain’s sending region — for example `feedback-smtp.us-east-1.amazonses.com`. If the region in the published record does not match the region your domain was created in, verification fails with a region error: | Error | Cause | Fix | | --- | --- | --- | | `region-mismatch` | The MAIL FROM `MX` points to a different region than the one your domain is configured for. | Update the `MX` value to the exact host shown in your dashboard’s [DNS records](https://www.senddart.com/docs/domains/dns) table. | | `multiple-regions` | More than one `MX` record on `send.yourdomain.com` points to different regions. | Remove every `MX` on that host except the one matching your domain’s region — all MX for the host must point to the same region. | > **Note:** The MAIL FROM region is also a common victim of the auto-appended-suffix problem: a value saved as `feedback-smtp.us-east-1.amazonses.com.yourdomain.com` will fail. Some DNS UIs fix this if you add a **trailing dot** (`feedback-smtp.us-east-1.amazonses.com.`), which marks the value as a fully-qualified name they must not modify. See [Choosing a region](https://www.senddart.com/docs/domains/region). ## Confirm the records are actually visible When values look right but the domain still won’t verify, check what the public DNS is really returning. Any browser-based DNS-checker tool works, or query directly from a terminal — you should see the same values SendDart shows you: ```bash # DKIM (the single public-key TXT record) nslookup -type=TXT senddart._domainkey.yourdomain.com # SPF TXT on the MAIL FROM subdomain nslookup -type=TXT send.yourdomain.com # MAIL FROM feedback MX nslookup -type=MX send.yourdomain.com # DMARC nslookup -type=TXT _dmarc.yourdomain.com ``` > **Warning:** DNS changes can take up to **72 hours** to propagate globally (often much faster). If verification still fails after about 24 hours and the records resolve publicly with the exact values shown, re-check for proxying/flattening and conflicting old records before assuming an account issue. > **Warning:** You can only send from a **verified** domain (or a subdomain of one). Sending from an unverified domain returns a `validation_error`. See [Managing domains](https://www.senddart.com/docs/domains/managing). --- # Should I send from a subdomain or the root domain? > Why sending from a dedicated subdomain like mail. or send. isolates sending reputation from your root domain — and how a verified root already covers its subdomains. You can verify and send from either your **root domain** (`yourdomain.com`) or a **subdomain** (`mail.yourdomain.com`). For most senders we recommend a dedicated subdomain. There are two goals a good subdomain setup achieves: **reputation isolation** and **sending-purpose transparency**. ## Reputation isolation Mailbox providers build a sending reputation around the domain you send from. If you send marketing or cold email straight from your root domain and run into spam complaints or bounces — say a signup page gets abused into blasting verification mail at burner addresses, or a cold campaign gets pegged as spam — that reputation hit can bleed into your corporate mail: password resets, invoices, and replies from your team. Sending from a subdomain lets you quarantine a compromised subdomain and keeps the root’s reputation clean, which matters because a damaged root reputation is a long road to recover. ## Sending-purpose transparency Not every message deserves the same inbox placement — a password reset should outrank a monthly product update. Inbox providers like Gmail and Outlook constantly triage incoming mail, pushing the important things to the focused inbox and the rest toward Promotions or Spam. Segmenting by subdomain (transactional on one, marketing on another) gives them a clear, consistent signal of how to place each kind of mail, which builds trust over time. ## Recommended pattern Pick a clear, dedicated subdomain for the kind of mail you send, and verify that as its own domain in SendDart: | Subdomain | Typical use | | --- | --- | | `mail.yourdomain.com` | General sending subdomain. | | `send.yourdomain.com` | Outbound / transactional sending. | | `news.yourdomain.com` | Marketing, newsletters, campaigns. | | `notifications.yourdomain.com` | App and product notifications. | Then send from an address on that subdomain, e.g. `hello@mail.yourdomain.com`. You can even isolate further by using one subdomain for transactional mail and another for marketing, so a reputation problem on one never touches the other. > **Note:** Whichever you verify, SendDart generates the same record set against that name — one DKIM TXT and an SPF MX + TXT on a `send.` MAIL FROM subdomain. (DMARC you publish yourself.) See [DNS records](https://www.senddart.com/docs/domains/dns). ## A verified root covers its subdomains A verified domain identity also **covers its subdomains**. If you verify `yourdomain.com`, SendDart will accept `from` addresses on `news.yourdomain.com`, `mail.yourdomain.com`, and any other subdomain — the verified identity for the parent signs and authorizes mail from its children, so you do not need to verify each subdomain separately. So the practical trade-off is: verify the **root** for the convenience of sending from any subdomain under it, or verify a **specific subdomain** when you want its reputation kept strictly separate from the rest of your domain. For dedicated marketing or cold-email sending, the isolated subdomain is the safer default. > **Warning:** A verified subdomain does **not** work in reverse: verifying `mail.yourdomain.com` only authorizes that subdomain (and anything under it), not the root or sibling subdomains. ## Avoid "lookalike" domains Always send from a subdomain of your real domain — never from a separate brand-adjacent domain that merely *looks* like yours, such as `getacme-mail.com` or `acme-alerts.com`. These lookalike domains read as suspicious to spam filters, which may flag them as phishing or spoofing, and they confuse recipients, who are more likely to ignore, delete, or report the mail. If you are launching a new project or sending for a new purpose, reach for a subdomain of your main domain rather than a fresh standalone domain. Consistent subdomains reinforce your brand identity and build trust with both inbox providers and recipients. --- # Do I need 2048-bit DKIM? > How DKIM key size is handled in SendDart — it generates a 2048-bit key pair for you and you publish one DKIM TXT record holding the public key, so there is no size to choose. Short answer: you do not need to think about DKIM key size at all — SendDart already uses a strong **2048-bit** key. SendDart generates an RSA key pair for your domain, uses the private key to sign your mail, and gives you **one DKIM TXT record** holding the public key to publish. The size is fixed at 2048 bits; there is no choice to make. This is the "BYO DKIM" model: the public key lives in a TXT record on your domain (`v=DKIM1; k=rsa; p=...`) rather than being delegated to the provider with CNAMEs. SendDart handles the key generation for you, so the only thing you do is paste the one TXT value. ## The DKIM record SendDart generates There is a single DKIM record: a TXT at a fixed selector hostname on your domain, holding the public half of the 2048-bit key pair SendDart generated. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | A single DKIM key record. | | `Name` | senddart._domainkey.yourdomain.com | No | The DKIM selector hostname. `senddart` is the fixed selector SendDart uses. | | `Value` | v=DKIM1; k=rsa; p= | No | The RFC 6376 DKIM key record holding your domain’s 2048-bit public key. | | `TTL` | Auto | No | Provider default; SendDart does not require a specific TTL. | ## Why a single TXT record - **Strong keys by default.** SendDart signs with a 2048-bit key — you inherit that strength without choosing or managing it. - **Nothing to generate.** SendDart creates the key pair and holds the private key; you only publish the public key in one TXT record. - **Paste it exactly.** The public key is a long base64 string, so copy the value verbatim — a truncated, wrapped, or re-quoted value will block verification. ## 1024-bit vs 2048-bit, if you’re wondering A frequent question is whether you need a **2048-bit** DKIM key. SendDart already uses 2048-bit, so you are covered — but the background, for completeness: **1024-bit is RFC-compliant.** [RFC 8301 §3.2](https://datatracker.ietf.org/doc/html/rfc8301#section-3.2) sets 1024 bits as the minimum verifiers must support and the recommended floor for signers. Gmail, Outlook, Yahoo, and Apple all accept 1024-bit DKIM signatures, and 1024-bit remains widely used for transactional and marketing mail. **It meets the bulk-sender requirements.** The 2024 Google / Yahoo / Microsoft requirements (for anyone sending more than 5,000 messages a day to their users) require DKIM alongside SPF and DMARC, but **none of them mandate a specific key length** — and 2048-bit comfortably satisfies them. | | 1024-bit | 2048-bit (SendDart default) | | --- | --- | --- | | Security | Meets current RFC recommendations for email signing. | Larger cryptographic margin / future-proofing. | | Performance | Faster signing and verification. | More resources per message; negligible at normal volumes. | | DNS compatibility | Fits comfortably in a single TXT record. | Longer public key — some DNS providers wrap the value; paste it exactly as shown. | | Deliverability | No penalty. | No downside — and you get the stronger key automatically. | > **Note:** The 2048-bit public key is a long value. If your DNS provider rejects or wraps long TXT records, paste the value exactly as SendDart shows it — do not add quotes or line breaks. See [What if my domain isn’t verifying?](https://www.senddart.com/docs/kb/domain-not-verifying). --- # How do I avoid conflicts with my MX records? > The MX record SendDart adds lives on the send. MAIL FROM subdomain and only routes bounce/complaint feedback — it is separate from your inbound MX. Never remove your real MX records. SendDart normally places its sending-feedback MX on `send.yourdomain.com`, separate from the root-domain MX used by your inbox provider. Check the exact hostname before making a change: that subdomain may already be in use. The key idea is that there are two completely separate MX records doing two unrelated jobs. > **Note:** An **MX (Mail Exchanger)** record tells the world where to deliver incoming mail for a host. Each MX has a **priority** (a.k.a. preference): the **lower the number, the higher the priority**, and `0` is the highest priority possible. MX records only affect the exact host they are set on — `send.yourdomain.com` and `yourdomain.com` are independent. ## Two different MX records | MX record | Host | Purpose | | --- | --- | --- | | **Your inbound MX** | `yourdomain.com` | Routes incoming mail to your inbox provider (Gmail, Microsoft 365, etc.). SendDart never touches this. | | **The MAIL FROM MX** | `send.yourdomain.com` | Routes bounce and complaint feedback for outbound mail. This is the only MX SendDart asks you to add. | Records on `send.yourdomain.com` and `yourdomain.com` belong to different DNS names. Preserve the root-domain MX and check who owns any existing records on the proposed `send.` host. **SPF — MX (the MAIL FROM subdomain only)** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX | No | Receives bounce and complaint feedback for the MAIL FROM subdomain. | | `Name` | send.yourdomain.com | No | The custom MAIL FROM subdomain — NOT your root domain. | | `Value` | feedback-smtp.us-east-1.amazonses.com | No | Region-specific feedback host (the region matches your domain’s sending region). | | `Priority` | 10 | No | MX priority. | | `TTL` | Auto | No | Provider default. | > **Warning:** Do **not** remove, replace, or re-point the MX records on your **root domain** — those are how you receive email. Add the `send.yourdomain.com` MX as a brand-new record alongside everything you already have. ## Things to watch for - **Add, don’t replace.** Create the `send.` MX as a new record. Some DNS UIs prompt to "replace existing records" — make sure you’re adding to the `send.` host, not editing your root MX. - **Don’t put an MX on the root for SendDart.** The MAIL FROM MX belongs only on `send.yourdomain.com`. There is no SendDart MX record on `yourdomain.com`. - **Keep the SPF TXT on the same `send.` host.** The `v=spf1 include:amazonses.com ~all` TXT and the MX share the `send.yourdomain.com` name — that’s expected, and separate from any SPF TXT on your root. ## Resolving an existing conflict If you do hit a clash, it is one of two kinds: - **An existing service uses the MAIL FROM host.** Identify that service before editing its records. If it must remain, use a separate sending domain or subdomain in SendDart and copy the records generated for that configuration. Do not delete an existing record merely to make verification pass. - **Multiple MX records on the MAIL FROM host.** [Amazon SES requires exactly one MX record for a custom MAIL FROM domain](https://docs.aws.amazon.com/ses/latest/dg/mail-from.html). Changing one priority does not resolve this requirement. Use the hostname, target and priority shown in your SendDart domain configuration after confirming that the host is dedicated to this purpose. > **Note:** For ordinary inbound mail, equal MX preferences are valid and can distribute delivery attempts across servers; lower numbers are preferred and other eligible servers may be tried on failure. See [SMTP routing in RFC 5321, section 5.1](https://www.rfc-editor.org/rfc/rfc5321#section-5.1). This does not remove the separate SES custom MAIL FROM restriction. ## The other MX case: receiving mail The discussion above is about **sending**, where the MAIL FROM MX only carries delivery feedback. If you also enable SendDart **inbound** (receiving mail), that uses a *separate* inbound MX, and here the conflict with your existing inbox provider is real — because an inbound MX on a host genuinely routes that host’s incoming mail. Plan receiving separately from the sending-feedback host: 1. **[Recommended] Receive on a subdomain.** Put the inbound MX on a dedicated host (e.g. `inbox.yourdomain.com`). Mail to `you@yourdomain.com` keeps flowing to Gmail / Microsoft 365, while mail to `you@inbox.yourdomain.com` is routed to SendDart. No conflict with your primary inbox. 2. **Migrate root-domain receiving deliberately.** If you intend to move your existing inbox routing, plan the full MX change with the administrators of both services. Keeping unrelated providers at different priorities is not a way to deliver a copy to each provider and can send fallback attempts somewhere unintended. > **Warning:** SendDart inbound is **off by default** and requires explicit setup (an inbound MX plus a configured store). Sending alone never adds a receiving MX to your root, so it can’t hijack your inbox. > **Note:** See [DNS records](https://www.senddart.com/docs/domains/dns) for the full record set and [Choosing a region](https://www.senddart.com/docs/domains/region) for why the MX value embeds the sending region. --- # DMARC explained: policy, alignment, and rollout > What DMARC is, why SendDart starts you at p=none, how to monitor and then tighten to quarantine or reject, and how alignment works through the SPF MAIL FROM and DKIM. **DMARC** (Domain-based Message Authentication, Reporting & Conformance) is the policy layer that ties **SPF** and **DKIM** together. It is a single TXT record at `_dmarc.yourdomain.com` that tells receiving mail servers two things: what to do with mail claiming to be from your domain that fails authentication, and where to send reports about it. SendDart generates a DMARC record for you starting at the safest setting — `p=none` — so you can publish it immediately without any risk of legitimate mail being blocked while you confirm everything is aligned. ## The record SendDart generates **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | DMARC policy record. | | `Name` | _dmarc.yourdomain.com | No | The standard DMARC hostname. | | `Value` | v=DMARC1; p=none; | No | A monitoring policy to start with. Tighten the `p=` value once you trust your alignment. | | `TTL` | Auto | No | Provider default. | ## How alignment works DMARC passes when a message is **authenticated and aligned** by SPF or DKIM (either one is enough): **DKIM alignment** — the message carries a valid DKIM signature (via the `senddart._domainkey.` TXT record holding your public key) and the signing domain matches your `from` domain. **SPF alignment** — SPF passes for the message’s MAIL FROM (envelope) domain, and that domain aligns with your `from` domain. SendDart’s custom MAIL FROM subdomain `send.yourdomain.com` exists precisely to give you this alignment: the SPF TXT `v=spf1 include:amazonses.com ~all` authorizes SendDart to send for that subdomain. > **Note:** Because a verified domain already publishes both DKIM (the public-key TXT) and SPF (the MAIL FROM MX + TXT), DMARC alignment is satisfied out of the box for mail you send through SendDart. See [DNS records](https://www.senddart.com/docs/domains/dns). ## Rolling out: none → quarantine → reject Tighten your policy in stages. Move up only once your reports show that legitimate mail is consistently passing DMARC. 1. **Start at p=none (monitor)** — Publish `v=DMARC1; p=none;` (what SendDart generates). Receivers take no action on failing mail, so nothing legitimate is affected. Add a `rua=mailto:dmarc@yourdomain.com` tag to collect aggregate reports and watch which sources pass and fail. 2. **Confirm DMARC is passing** — Before tightening, send a message from every application and service that uses your domain (not just SendDart) and inspect the received headers for `dmarc=pass`. Tools like Google Postmaster Tools and DMARC monitoring/aggregation services help you discover any other sources sending as your domain — catch the ones that mail on a weekly or monthly cadence, not just daily. 3. **Move to p=quarantine** — Once reports show your real mail (SendDart and any other legitimate senders) passing, raise the policy to `p=quarantine;` so failing mail is sent to spam rather than the inbox. Consider `pct=` to ramp gradually. 4. **Move to p=reject** — When you are confident everything legitimate is aligned, set `p=reject;` so receivers drop spoofed mail outright. This gives you the strongest protection against impersonation of your domain. ## Tag reference **DMARC tags** | Name | Type | Required | Description | | --- | --- | --- | --- | | `v` | required | No | Protocol version — always `v=DMARC1`. | | `p` | required | No | Policy for the organizational domain: `none` (monitor), `quarantine` (spam folder), or `reject` (block). | | `sp` | optional | No | Policy for **subdomains** of the domain (e.g. `sp=reject`). Lets you apply a different, often stricter, policy to subdomains than the root. | | `rua` | optional | No | Address that receives **aggregate** (daily-summary) XML reports — e.g. `rua=mailto:dmarc@yourdomain.com`. Essential during the `none` monitoring phase. May point to a different domain than the one being protected. | | `pct` | optional | No | Percentage of failing mail the policy applies to (e.g. `pct=20`), useful for a gradual ramp. | | `ruf` | optional | No | Address for **forensic** (per-message failure) reports — e.g. `ruf=mailto:authfail@yourdomain.com`. | | `adkim` | optional | No | DKIM alignment mode: `r` (relaxed, default) or `s` (strict, signing domain must match exactly). | | `aspf` | optional | No | SPF alignment mode: `r` (relaxed, default) or `s` (strict). | > **Warning:** Although `pct` and `ruf` are part of the DMARC spec, they are **not widely honored** by mailbox providers — don’t rely on either being respected. Use `p=`, `rua=`, and (for staged subdomain control) `sp=` as your primary levers. > **Warning:** Raise the policy at your DNS provider only after monitoring. Jumping straight to `p=reject` before confirming alignment can cause receivers to drop legitimate mail from sources you forgot about (e.g. a separate CRM or help-desk tool sending as your domain). Related: [DNS records](https://www.senddart.com/docs/domains/dns) for the SPF and DKIM records DMARC builds on, and [What if my domain isn’t verifying?](https://www.senddart.com/docs/kb/domain-not-verifying) if the underlying records are not resolving yet. --- # DreamHost > Publish the SPF, DKIM, and DMARC records SendDart generates for your domain using the DreamHost panel’s DNS editor. This guide walks through adding the DNS records SendDart generates for a domain using **DreamHost**. First add your domain in SendDart to generate the records — see [Managing domains](https://www.senddart.com/docs/domains/managing) — and keep the [DNS records](https://www.senddart.com/docs/domains/dns) reference open, since the exact values (your DKIM record and your region) come from there. It is best practice to use a [subdomain](https://www.senddart.com/docs/kb/subdomain-vs-root) (e.g. `updates.example.com`) instead of the root domain (`example.com`). A subdomain isolates sending reputation by purpose (marketing, transactional) and keeps it separate from your corporate mail. ## Log in to DreamHost 1. **Open your website** — Log in to the **DreamHost panel** at panel.dreamhost.com and go to **Websites → Manage Websites**. 2. **Manage the domain** — Click **Manage** on the domain you want to send mail from, then open the **DNS** tab. This is where you add the records below with **Add Record**. 3. **Add each record** — Add every entry below — the DKIM TXT record, the SPF MX and TXT, and the DMARC TXT. > **Warning:** DreamHost’s **Host** field expects only the subdomain part (e.g. `senddart._domainkey`, `send`, `_dmarc`) — do not include your full domain. Entering the full hostname produces a doubled name like `send.example.com.example.com`. ## DKIM — TXT Add **one** TXT record holding your domain’s DKIM public key. Enter only the host prefix in **Host** — DreamHost appends your domain. Copy the value from your domain configuration page in SendDart. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT Record | No | A single DKIM key record. | | `Host` | senddart._domainkey | No | DreamHost appends `.example.com`, giving `senddart._domainkey.example.com`. `senddart` is the fixed selector SendDart uses. | | `Points to` | v=DKIM1; k=rsa; p= | No | The DKIM key record holding your domain’s public key. | | `TTL` | Default | No | Use the DreamHost default. | ## SPF — MX on send.example.com SendDart uses the custom MAIL FROM subdomain `send.example.com`, which needs both an MX and a TXT record. On DreamHost the cleanest way to host an MX on a subdomain is to create the subdomain first (return to **Manage Websites → Add Website**, add `send.example.com`), then **Manage** it, choose **Add Record → MX → Manage Custom MX**, and paste the SendDart MX value. **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX Record | No | Routes bounce and complaint feedback for the MAIL FROM subdomain. | | `Host` | send | No | Resolves to `send.example.com`. | | `Points to` | feedback-smtp.us-east-1.amazonses.com | No | Region-specific feedback host. Replace `us-east-1` with your domain’s region. | | `Priority` | 10 | No | Copy the priority shown in SendDart. Check any existing MX on this host before editing. | | `TTL` | Default | No | DreamHost default. | ## SPF — TXT on send.example.com **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT Record | No | SPF policy for the MAIL FROM subdomain. | | `Host` | send | No | Same host as the MX — resolves to `send.example.com`. | | `TXT Value` | v=spf1 include:amazonses.com ~all | No | Authorizes Amazon SES to send for the MAIL FROM subdomain. | | `TTL` | Default | No | DreamHost default. | ## DMARC — TXT on _dmarc.example.com **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT Record | No | DMARC policy record. | | `Host` | _dmarc | No | Resolves to `_dmarc.example.com`. | | `TXT Value` | v=DMARC1; p=none; | No | A monitoring policy to start with; tighten to `quarantine` or `reject` later. See [Implementing DMARC](https://www.senddart.com/docs/kb/dmarc). | | `TTL` | Default | No | DreamHost default. | > **Note:** DreamHost gotchas: use only the **Host** prefix (`send`, `_dmarc`, `senddart._domainkey`), never the full domain; review [MX conflicts](https://www.senddart.com/docs/kb/mx-conflicts) if the target host is already in use; and DNS updates at DreamHost can take several hours to propagate. Once all records shown in your SendDart domain configuration are saved, return to SendDart and [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). If it stays pending, see [What if my domain isn’t verifying?](https://www.senddart.com/docs/kb/domain-not-verifying). --- # Gandi > Publish the SPF, DKIM, and DMARC records SendDart generates for your domain using Gandi’s DNS Records tab — including the required trailing dot on MX values. This guide walks through adding the DNS records SendDart generates for a domain using **Gandi**. Add your domain in SendDart first to generate the records — see [Managing domains](https://www.senddart.com/docs/domains/managing) — and keep the [DNS records](https://www.senddart.com/docs/domains/dns) reference open for your exact DKIM record and region. It is best practice to use a [subdomain](https://www.senddart.com/docs/kb/subdomain-vs-root) (e.g. `updates.example.com`) instead of the root domain for reputation segmentation. > **Warning:** Gandi requires the **MX value to end with a trailing dot** (`feedback-smtp.us-east-1.amazonses.com.`). Removing the dot will cause verification to fail. ## Log in to Gandi 1. **Open your domain** — Log in at admin.gandi.net, choose your domain from the **Domain** list. 2. **Open DNS Records** — Select the **DNS Records** tab to reach the page where you manage DNS records. 3. **Add each record** — Use **Add record** for every entry below — the DKIM TXT record, the SPF MX and TXT, and the DMARC TXT. ## DKIM — TXT Add **one** TXT record holding your domain’s DKIM public key. Enter only the host prefix in **Name**; Gandi appends your domain. Copy the value from your domain configuration page in SendDart. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | A single DKIM key record. | | `Name` | senddart._domainkey | No | Gandi appends `.example.com`, giving `senddart._domainkey.example.com`. `senddart` is the fixed selector SendDart uses. | | `Text value` | v=DKIM1; k=rsa; p= | No | The DKIM key record holding your domain’s public key. | | `TTL` | 10800 | No | Gandi default. | ## SPF — MX on the send subdomain SendDart uses the custom MAIL FROM subdomain `send.example.com`. Choose **MX**, set **Name** to `send`, and paste the SendDart MX value **with its trailing dot** into the **Hostname** field. **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX | No | Receives bounce and complaint feedback for the MAIL FROM subdomain. | | `Name` | send | No | Resolves to `send.example.com`. | | `Hostname` | feedback-smtp.us-east-1.amazonses.com. | No | Region-specific feedback host — keep the trailing dot. Replace `us-east-1` with your domain’s region. | | `Priority` | 10 | No | Copy the priority shown in SendDart. | | `TTL` | 10800 | No | Gandi default. | ## SPF — TXT on the send subdomain Add another record of type **TXT** with **Name** `send`. Paste the SPF value into the **Text value** field — enter only `send`, not `send.example.com`. **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | SPF policy for the MAIL FROM subdomain. | | `Name` | send | No | Same host as the MX — resolves to `send.example.com`. | | `Text value` | v=spf1 include:amazonses.com ~all | No | Authorizes Amazon SES for the MAIL FROM subdomain. | | `TTL` | 10800 | No | Gandi default. | ## DMARC — TXT on _dmarc **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | DMARC policy record. | | `Name` | _dmarc | No | Resolves to `_dmarc.example.com`. | | `Text value` | v=DMARC1; p=none; | No | A monitoring policy to start with. See [Implementing DMARC](https://www.senddart.com/docs/kb/dmarc). | | `TTL` | 10800 | No | Gandi default. | > **Note:** Gandi gotchas: keep the **trailing dot** on the MX value; enter only the bare host prefix in **Name** (omit your domain); and review [MX conflicts](https://www.senddart.com/docs/kb/mx-conflicts) before changing an occupied host. Once all records shown in your SendDart domain configuration are saved, return to SendDart and [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). If it stays pending, see [What if my domain isn’t verifying?](https://www.senddart.com/docs/kb/domain-not-verifying). --- # Hetzner > Publish the SPF, DKIM, and DMARC records SendDart generates for your domain using the Hetzner Console (or legacy Hetzner DNS Console). This guide walks through adding the DNS records SendDart generates for a domain using **Hetzner**. Add your domain in SendDart first to generate the records — see [Managing domains](https://www.senddart.com/docs/domains/managing) — and keep the [DNS records](https://www.senddart.com/docs/domains/dns) reference open for your exact DKIM record and region. Hetzner has two DNS interfaces: the newer **Hetzner Console** and the legacy **Hetzner DNS Console**. The record values are identical in both; only the navigation to the editor differs. > **Warning:** Hetzner requires the **MX value to end with a trailing dot** (`feedback-smtp.us-east-1.amazonses.com.`). Removing the dot will cause verification to fail. ## Open the DNS editor 1. **New Hetzner Console** — Log in at console.hetzner.com, choose your project, click **DNS** under **Networking**, then select your domain from the **DNS zones** list. 2. **Legacy DNS Console** — Alternatively log in at dns.hetzner.com, choose your domain from **Your Zones**, and open the **Records** tab. 3. **Add each record** — Use the **Add Record** form for every entry below — the DKIM TXT record, the SPF MX and TXT, and the DMARC TXT. ## DKIM — TXT Add **one** TXT record holding your domain’s DKIM public key. Enter only the host prefix in **Name** — Hetzner appends your zone. Copy the value from your domain configuration page in SendDart. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | A single DKIM key record. | | `Name` | senddart._domainkey | No | Combined with the zone this is `senddart._domainkey.example.com`. `senddart` is the fixed selector SendDart uses. | | `Value` | v=DKIM1; k=rsa; p= | No | The DKIM key record holding your domain’s public key. | | `TTL` | 1800 | No | Hetzner value used in these examples. | ## SPF — MX on the send subdomain SendDart uses the custom MAIL FROM subdomain `send.example.com`. Choose **MX**, set **Name** to `send`, set **Priority** to `10`, and paste the SendDart MX value (with trailing dot) into **Value**. **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX | No | Receives bounce and complaint feedback for the MAIL FROM subdomain. | | `Name` | send | No | Resolves to `send.example.com`. | | `Value` | feedback-smtp.us-east-1.amazonses.com. | No | Region-specific feedback host — keep the trailing dot. Replace `us-east-1` with your domain’s region. | | `Priority` | 10 | No | Use `20`/`30` if `10` is already taken on that host. | | `TTL` | 1800 | No | Hetzner value used in these examples. | ## SPF — TXT on the send subdomain **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | SPF policy for the MAIL FROM subdomain. | | `Name` | send | No | Same host as the MX — resolves to `send.example.com`. | | `Value` | v=spf1 include:amazonses.com ~all | No | Authorizes Amazon SES for the MAIL FROM subdomain. | | `TTL` | 1800 | No | Hetzner value used in these examples. | ## DMARC — TXT on _dmarc **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | DMARC policy record. | | `Name` | _dmarc | No | Resolves to `_dmarc.example.com`. | | `Value` | v=DMARC1; p=none; | No | A monitoring policy to start with. See [Implementing DMARC](https://www.senddart.com/docs/kb/dmarc). | | `TTL` | 1800 | No | Hetzner value used in these examples. | > **Note:** Hetzner gotchas: keep the **trailing dot** on the MX value; enter only the bare host prefix in **Name** (omit your domain); and review [MX conflicts](https://www.senddart.com/docs/kb/mx-conflicts) before changing an occupied host. Once all records shown in your SendDart domain configuration are saved, return to SendDart and [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). If it stays pending, see [What if my domain isn’t verifying?](https://www.senddart.com/docs/kb/domain-not-verifying). --- # Hostinger > Publish the SPF, DKIM, and DMARC records SendDart generates for your domain using Hostinger’s DNS / Nameservers manager. This guide walks through adding the DNS records SendDart generates for a domain using **Hostinger**. Add your domain in SendDart first to generate the records — see [Managing domains](https://www.senddart.com/docs/domains/managing) — and keep the [DNS records](https://www.senddart.com/docs/domains/dns) reference open for your exact DKIM record and region. It is best practice to use a [subdomain](https://www.senddart.com/docs/kb/subdomain-vs-root) (e.g. `updates.example.com`) instead of the root domain for reputation segmentation. ## Log in to Hostinger 1. **Open Domains** — Log in at auth.hostinger.com, select the **Domains** tab, and choose your domain from the **Domain portfolio** list. 2. **Open DNS / Nameservers** — Select **DNS / Nameservers** to reach the page where you manage DNS records. 3. **Add each record** — Use **Add Record** for every entry below — the DKIM TXT record, the SPF MX and TXT, and the DMARC TXT. > **Warning:** Hostinger’s **Name** field expects only the subdomain part — enter `senddart._domainkey`, `send`, and `_dmarc`, never the full `…example.com`. Hostinger appends your domain automatically. ## DKIM — TXT Add **one** TXT record holding your domain’s DKIM public key. Copy the value from your domain configuration page in SendDart. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | A single DKIM key record. | | `Name` | senddart._domainkey | No | Hostinger appends `.example.com`, giving `senddart._domainkey.example.com`. `senddart` is the fixed selector SendDart uses. | | `Target` | v=DKIM1; k=rsa; p= | No | The DKIM key record holding your domain’s public key. | | `TTL` | 3600 | No | Hostinger value used in these examples. | ## SPF — MX on the send subdomain SendDart uses the custom MAIL FROM subdomain `send.example.com`. Set **Type** to `MX`, **Name** to `send`, paste the SendDart MX value into **Mail Server**, and set **Priority** to `10`. **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX | No | Receives bounce and complaint feedback for the MAIL FROM subdomain. | | `Name` | send | No | Resolves to `send.example.com`. | | `Mail Server` | feedback-smtp.us-east-1.amazonses.com | No | Region-specific feedback host. Replace `us-east-1` with your domain’s region. | | `Priority` | 10 | No | Use `20`/`30` if `10` is already taken on that host. | | `TTL` | 3600 | No | Hostinger value used in these examples. | ## SPF — TXT on the send subdomain **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | SPF policy for the MAIL FROM subdomain. | | `Name` | send | No | Same host as the MX — resolves to `send.example.com`. | | `TXT value` | v=spf1 include:amazonses.com ~all | No | Authorizes Amazon SES for the MAIL FROM subdomain. | | `TTL` | 3600 | No | Hostinger value used in these examples. | ## DMARC — TXT on _dmarc **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | DMARC policy record. | | `Name` | _dmarc | No | Resolves to `_dmarc.example.com`. | | `TXT value` | v=DMARC1; p=none; | No | A monitoring policy to start with. See [Implementing DMARC](https://www.senddart.com/docs/kb/dmarc). | | `TTL` | 3600 | No | Hostinger value used in these examples. | > **Note:** Hostinger gotchas: enter only the bare **Name** prefix (`send`, `_dmarc`, `senddart._domainkey`), never the full domain; and review [MX conflicts](https://www.senddart.com/docs/kb/mx-conflicts) before changing an occupied host. Once all records shown in your SendDart domain configuration are saved, return to SendDart and [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). If it stays pending, see [What if my domain isn’t verifying?](https://www.senddart.com/docs/kb/domain-not-verifying). --- # IONOS > Publish the SPF, DKIM, and DMARC records SendDart generates for your domain using the IONOS DNS manager. This guide walks through adding the DNS records SendDart generates for a domain using **IONOS**. Add your domain in SendDart first to generate the records — see [Managing domains](https://www.senddart.com/docs/domains/managing) — and keep the [DNS records](https://www.senddart.com/docs/domains/dns) reference open for your exact DKIM record and region. It is best practice to use a [subdomain](https://www.senddart.com/docs/kb/subdomain-vs-root) (e.g. `updates.example.com`) instead of the root domain for reputation segmentation. ## Log in to IONOS 1. **Open your domain** — Log in at my.ionos.com/domains and choose your domain from the **Domain** list. 2. **Open the DNS tab** — Select the **DNS** tab to reach the page where you manage DNS records. 3. **Add each record** — Use **Add record** for every entry below — the DKIM TXT record, the SPF MX and TXT, and the DMARC TXT. > **Warning:** IONOS’s **Name / Host name** field expects only the subdomain part — enter `senddart._domainkey`, `send`, and `_dmarc`, never the full `…example.com`. ## DKIM — TXT Add **one** TXT record holding your domain’s DKIM public key. Copy the value from your domain configuration page in SendDart. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | A single DKIM key record. | | `Host name` | senddart._domainkey | No | IONOS appends `.example.com`, giving `senddart._domainkey.example.com`. `senddart` is the fixed selector SendDart uses. | | `Points to` | v=DKIM1; k=rsa; p= | No | The DKIM key record holding your domain’s public key. | | `TTL` | 1 hour | No | IONOS default. | ## SPF — MX on the send subdomain SendDart uses the custom MAIL FROM subdomain `send.example.com`. Select **MX**, set **Name** to `send`, and paste the SendDart MX value into **Points to**. **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX | No | Receives bounce and complaint feedback for the MAIL FROM subdomain. | | `Name` | send | No | Resolves to `send.example.com`. | | `Points to` | feedback-smtp.us-east-1.amazonses.com | No | Region-specific feedback host. Replace `us-east-1` with your domain’s region. | | `Priority` | 10 | No | IONOS default. Use `20`/`30` if `10` is already taken on that host. | | `TTL` | 1 hour | No | IONOS default. | ## SPF — TXT on the send subdomain **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | SPF policy for the MAIL FROM subdomain. | | `Host name` | send | No | Same host as the MX — resolves to `send.example.com`. | | `TXT value` | v=spf1 include:amazonses.com ~all | No | Authorizes Amazon SES for the MAIL FROM subdomain. | | `TTL` | 1 hour | No | IONOS default. | ## DMARC — TXT on _dmarc **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | DMARC policy record. | | `Host name` | _dmarc | No | Resolves to `_dmarc.example.com`. | | `TXT value` | v=DMARC1; p=none; | No | A monitoring policy to start with. See [Implementing DMARC](https://www.senddart.com/docs/kb/dmarc). | | `TTL` | 1 hour | No | IONOS default. | > **Note:** IONOS gotchas: enter only the bare **Name / Host name** prefix (`send`, `_dmarc`, `senddart._domainkey`), never the full domain; and review [MX conflicts](https://www.senddart.com/docs/kb/mx-conflicts) before changing an occupied host. Once all records shown in your SendDart domain configuration are saved, return to SendDart and [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). If it stays pending, see [What if my domain isn’t verifying?](https://www.senddart.com/docs/kb/domain-not-verifying). --- # Porkbun > Publish the SPF, DKIM, and DMARC records SendDart generates for your domain using Porkbun’s DNS editor. This guide walks through adding the DNS records SendDart generates for a domain using **Porkbun**. Add your domain in SendDart first to generate the records — see [Managing domains](https://www.senddart.com/docs/domains/managing) — and keep the [DNS records](https://www.senddart.com/docs/domains/dns) reference open for your exact DKIM record and region. It is best practice to use a [subdomain](https://www.senddart.com/docs/kb/subdomain-vs-root) (e.g. `updates.example.com`) instead of the root domain for reputation segmentation. ## Log in to Porkbun 1. **Open your domain** — Log in at porkbun.com/account/domainsSpeedy. 2. **Open DNS** — Select the **DNS** option under your domain to reach the page where you manage DNS records. 3. **Add each record** — Use **Add** / **Add Record** for every entry below — the DKIM TXT record, the SPF MX and TXT, and the DMARC TXT. > **Warning:** Porkbun’s **Host** field expects only the subdomain part — enter `senddart._domainkey`, `send`, and `_dmarc`, never the full `…example.com`. ## DKIM — TXT Add **one** TXT record holding your domain’s DKIM public key. Copy the value from your domain configuration page in SendDart. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | A single DKIM key record. | | `Host` | senddart._domainkey | No | Porkbun appends `.example.com`, giving `senddart._domainkey.example.com`. `senddart` is the fixed selector SendDart uses. | | `Answer / Value` | v=DKIM1; k=rsa; p= | No | The DKIM key record holding your domain’s public key. | | `TTL` | 600 | No | Porkbun default. | ## SPF — MX on the send subdomain SendDart uses the custom MAIL FROM subdomain `send.example.com`. Choose **MX**, set **Host** to `send`, paste the SendDart MX value into **Answer / Value**, and set **Priority** to `10`. **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX | No | Receives bounce and complaint feedback for the MAIL FROM subdomain. | | `Host` | send | No | Resolves to `send.example.com`. | | `Answer / Value` | feedback-smtp.us-east-1.amazonses.com | No | Region-specific feedback host. Replace `us-east-1` with your domain’s region. | | `Priority` | 10 | No | Use `20`/`30` if `10` is already taken on that host. | | `TTL` | 600 | No | Porkbun default. | ## SPF — TXT on the send subdomain **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | SPF policy for the MAIL FROM subdomain. | | `Host` | send | No | Same host as the MX — resolves to `send.example.com`. | | `Answer / Value` | v=spf1 include:amazonses.com ~all | No | Authorizes Amazon SES for the MAIL FROM subdomain. | | `TTL` | 600 | No | Porkbun default. | ## DMARC — TXT on _dmarc **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | DMARC policy record. | | `Host` | _dmarc | No | Resolves to `_dmarc.example.com`. | | `Answer / Value` | v=DMARC1; p=none; | No | A monitoring policy to start with. See [Implementing DMARC](https://www.senddart.com/docs/kb/dmarc). | | `TTL` | 600 | No | Porkbun default. | > **Note:** Porkbun gotchas: enter only the bare **Host** prefix (`send`, `_dmarc`, `senddart._domainkey`), never the full domain; and review [MX conflicts](https://www.senddart.com/docs/kb/mx-conflicts) before changing an occupied host. Once all records shown in your SendDart domain configuration are saved, return to SendDart and [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). If it stays pending, see [What if my domain isn’t verifying?](https://www.senddart.com/docs/kb/domain-not-verifying). --- # Strato > Publish the SPF, DKIM, and DMARC records SendDart generates for your domain on Strato — including creating the send subdomain to host the MX record. This guide walks through adding the DNS records SendDart generates for a domain using **Strato**. Add your domain in SendDart first to generate the records — see [Managing domains](https://www.senddart.com/docs/domains/managing) — and keep the [DNS records](https://www.senddart.com/docs/domains/dns) reference open for your exact DKIM record and region. It is best practice to use a [subdomain](https://www.senddart.com/docs/kb/subdomain-vs-root) (e.g. `updates.example.com`) instead of the root domain for reputation segmentation. > **Warning:** By default Strato domains use the Strato mail server (the `mail` send path). To host SendDart’s MAIL FROM MX you must **create a `send` subdomain** and set the MX record there, bypassing the default. ## Log in to Strato 1. **Open Domain Manager** — Log in to your Strato account and, in the left-hand navigation, go to **Domains → Manage Domain**. 2. **Open settings** — Click the **gear icon** on the domain to open its Settings, where the DNS records live. 3. **Add each record** — Add every entry below — the DKIM TXT record, the SPF MX (on a `send` subdomain) and TXT, and the DMARC TXT. ## DKIM — TXT On the base domain’s **DNS** tab, manage the TXT records and add **one** TXT record holding your domain’s DKIM public key. DKIM values are **case-sensitive** and must match exactly; copy the value with the copy icon in SendDart. **DKIM — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | A single DKIM key record. | | `Name` | senddart._domainkey | No | Resolves to `senddart._domainkey.example.com`. `senddart` is the fixed selector SendDart uses. | | `Value` | v=DKIM1; k=rsa; p= | No | The DKIM key record holding your domain’s public key. Must match exactly — DKIM is case-sensitive. | ## SPF — MX on the send subdomain Create a new subdomain named `send`, open its settings, go to the **DNS** tab, and **manage** its MX record. Select **own mail server**, paste the SendDart MX value into the **Server** field, and use the default priority **Low**. **SPF — MX** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | MX | No | Receives bounce and complaint feedback for the MAIL FROM subdomain. | | `Name` | send | No | The `send.example.com` subdomain you created. | | `Mail server` | feedback-smtp.us-east-1.amazonses.com. | No | Region-specific feedback host (keep the trailing dot). Replace `us-east-1` with your domain’s region. | | `Priority` | Low | No | Strato’s default priority setting for an own mail server. | ## SPF — TXT on the send subdomain On the base domain settings, go to the **DNS** tab, manage TXT/CNAME records, and click **Create another record**. Choose **TXT**, set **Name** to `send`, and enter the SPF value. **SPF — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | SPF policy for the MAIL FROM subdomain. | | `Name` | send | No | Resolves to `send.example.com`. | | `Value` | v=spf1 include:amazonses.com ~all | No | Authorizes Amazon SES for the MAIL FROM subdomain. | ## DMARC — TXT on _dmarc Strato may provide a standard DMARC record (e.g. `v=DMARC1; p=reject;`). SendDart recommends starting at `p=none;` to monitor first, then tightening — see [Implementing DMARC](https://www.senddart.com/docs/kb/dmarc). **DMARC — TXT** | Name | Type | Required | Description | | --- | --- | --- | --- | | `Type` | TXT | No | DMARC policy record. | | `Name` | _dmarc | No | Resolves to `_dmarc.example.com`. | | `Value` | v=DMARC1; p=none; | No | A monitoring policy to start with; tighten to `quarantine` or `reject` later. | > **Note:** Strato gotchas: you **must** create the `send` subdomain to host the MAIL FROM MX (the default `mail` path won’t work); DKIM values are **case-sensitive** — copy them exactly; and keep the trailing dot on the MX value. Once all records shown in your SendDart domain configuration are saved, return to SendDart and [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). If it stays pending, see [What if my domain isn’t verifying?](https://www.senddart.com/docs/kb/domain-not-verifying). --- # Domain already registered by another account > Resolve the 403 “domain already registered” error by confirming domain ownership and account access, and requesting a release if needed. ## Overview When you add a domain to SendDart, you may see this error: `The example.com domain has been registered already`. This means the domain is currently associated with a **different SendDart account**. A domain can only be active on one SendDart account at a time. > **Warning:** This is a `403` error — SendDart refuses to register the same domain twice across accounts to prevent two parties from sending as the same identity. The fix is to find and release it from the account that already holds it, not to retry the request. ## Why this happens - A **team member or contractor** added the domain to a separate account. - You are **logged into a different account** than the one where the domain was originally added. - A **previous trial or workspace** of yours still holds the domain. ## How to resolve it 1. **Check with your team.** Ask whether anyone is already using SendDart and may have added the domain under their own account or a shared workspace. 2. **Confirm you’re in the right account.** Make sure you’re logged into the account (and workspace) where you expect the domain to live, then look for it under [Managing domains](https://www.senddart.com/docs/domains/managing). 3. **Request a release.** If you still cannot locate the domain, contact [SendDart support](mailto:support@senddart.com) and share the domain name so the team can verify ownership and release it so you can re-add it. > **Note:** Once the domain is released from the other account, re-add it under your account and publish the DNS records SendDart generates — see [DNS records](https://www.senddart.com/docs/domains/dns) — then [re-verify the domain](https://www.senddart.com/docs/api/domains-verify). ## Related resources - [What if my domain isn’t verifying?](https://www.senddart.com/docs/kb/domain-not-verifying) - [Managing domains](https://www.senddart.com/docs/domains/managing) - [DNS records](https://www.senddart.com/docs/domains/dns) --- # How do I send with an avatar? > Show your logo or photo as an avatar in recipients' inboxes. Per-provider profile pictures only cover that provider; BIMI and Apple Branded Mail let your logo show across an entire domain. An avatar — your logo or a photo shown next to your name in the inbox — is a small thing that does real work. Industry studies have linked a recognizable sender logo to **higher brand recall, better open rates, stronger purchase intent, and more confidence in the email**. The catch is that there's no single switch: almost every mailbox provider has its own way of attaching a picture to an address. There are two broad approaches. You can set a profile picture **per provider** (Gmail, Outlook, Yahoo, Apple Mail), which only affects mail seen in that provider and only for the exact address you set it on. Or you can authenticate your logo at the **domain** level with BIMI or Apple Branded Mail, which lets your logo show for any address on the domain across many providers. ## Gmail 1. Go to your [Google Account settings](https://myaccount.google.com/personal-info). 2. Upload a profile picture. Avatars in Gmail display in the **mobile app** (including in push notifications) and inside **opened emails on desktop**. ## Outlook 1. Go to your [Outlook profile settings](https://account.microsoft.com/profile/). 2. Upload a profile picture. Avatars in Outlook display in the **mobile app** and inside **opened emails on desktop**. ## Yahoo 1. Go to your [Yahoo account settings](https://login.yahoo.com/account/personalinfo). 2. Upload a profile picture. Avatars in Yahoo display in the **mobile app** and inside an **opened email on desktop**. ## Apple Mail Apple Mail only shows an avatar if the recipient has added an image to their **contact card** for you. For a logo that shows without the recipient doing anything, set up [Apple Branded Mail](https://www.senddart.com/docs/kb/apple-branded-mail) — a proprietary Apple format introduced with iOS 18.2 that displays your logo as an avatar in Apple Mail — or set up [BIMI](https://www.senddart.com/docs/domains/bimi) with a Verified Mark Certificate. ## Using Gravatar Some clients (e.g. Thunderbird, Airmail, Postbox) display an image from [Gravatar](https://gravatar.com). Create a free Gravatar account, add your avatar, and verify the addresses you send from to that account so your image is displayed in those clients. ## Limitations Because each provider stores its own profile picture, the per-provider approach has two hard limits: 1. You can only add an avatar to a **real inbox**, limiting it to that one provider. 2. You can only show it on mail sent **from the same address** you set the avatar on. > **Note:** The way around both limits is **[BIMI](https://www.senddart.com/docs/domains/bimi)** (Brand Indicators for Message Identification). BIMI is supported by nearly all major providers and lets you send from **any** address on a domain while showing the same logo. It builds directly on your authentication — you need a `p=quarantine` or `p=reject` [DMARC](https://www.senddart.com/docs/domains/dmarc) policy first. See [Set up BIMI](https://www.senddart.com/docs/domains/bimi) for the full walkthrough. --- # How do I set up Apple Branded Mail? > Apple Branded Mail displays your logo as an avatar in Apple Mail on recent iOS, iPadOS, and macOS. It needs no certificate, accepts more image formats than BIMI, and requires a strict DMARC policy plus an Apple Business Connect account. **Apple Branded Mail** is a proprietary Apple format that displays your logo as an avatar in the inbox of Apple Mail. A recognizable logo can increase brand recognition and trust and improve engagement. ## What is Apple Branded Mail? It is Apple's own mechanism for attaching a brand logo to your mail in Apple Mail. Compared with [BIMI](https://www.senddart.com/docs/domains/bimi), it has two advantages: - Because it's an Apple format, it does **not** require a certificate the way BIMI does. - Image support is broader — it accepts `.png`, `.heif`, and `.jpg` logos. > **Warning:** Apple Branded Mail works **only** with Apple Mail on recent iOS, iPadOS, and macOS versions. Your logo will not show in other mail clients or older Apple Mail. For the widest coverage, combine it with the per-provider steps in [How do I send with an avatar?](https://www.senddart.com/docs/kb/send-with-avatar) and with [BIMI](https://www.senddart.com/docs/domains/bimi) where it fits. ## Prerequisites - [An Apple Business Connect account](https://www.apple.com/business/connect/). - [DMARC](https://www.senddart.com/docs/domains/dmarc) configured on your domain. - A company identification number Apple can use to verify your company. ## Implementing Apple Branded Mail ### 1. Configure DMARC For your logo to appear, set your DMARC policy to either `p=quarantine;` or `p=reject;`. A strict policy guarantees your mail is authenticated and stops others from spoofing your domain and sending mail with your logo. **Required DMARC parameters** | Name | Type | Required | Description | | --- | --- | --- | --- | | `p` | policy | Yes | Must be p=quarantine; or p=reject; | | `pct` | percentage | Yes | pct=100; | **Example DMARC record** ```text "v=DMARC1; p=quarantine; pct=100; rua=mailto:dmarcreports@example.com" ``` > **Warning:** Test your mail to confirm it is passing DMARC **before** moving the policy to `p=quarantine;` or `p=reject;` — tightening the policy on mail that doesn't yet align can cause legitimate messages to be quarantined or rejected. See the [DMARC setup guide](https://www.senddart.com/docs/domains/dmarc). ### 2. Create an Apple Business Connect account Apple displays the logo you set in your Business Connect account. [Create an account](https://www.apple.com/business/connect/) if your company doesn't already have one, using your company details. ### 3. Add your company details Apple will prompt you for details such as your company address and name. ### 4. Add your brand details In Apple Business Connect, select **Branded Mail** in the left sidebar and provide your brand details — brand name, brand website, and similar. ### 5. Add your logo Upload your logo. Apple requires it to be at least **1024 x 1024 px** in `.png`, `.heif`, or `.jpeg` format. ### 6. Add your domain Confirm the domains or email addresses where you want your logo to appear. You can register a logo for your root domain or a subdomain; if you don't set a specific logo for a subdomain, the root-domain logo is used automatically for mail sent from subdomains. ### 7. Verify your company Apple requires details to confirm your company identity. In the United States, provide a Federal Taxpayer Identification Number; other countries use a local equivalent. Apple also asks you to add a DNS record to verify DNS access. ### 8. Verify with Apple After you submit everything, Apple verifies your details — this can take **up to seven business days**. Once verified, Apple sends an email notification, marks the status as verified in Branded Mail, and your logo begins displaying in compatible Apple Mail versions. > **Note:** See Apple's documentation on [Apple Branded Mail](https://support.apple.com/en-au/guide/apple-business-connect/abcb761b19d2/web) for detailed questions about adding your logo. --- # How to avoid Gmail's spam folder > Gmail filters on authentication, sender reputation, and recipient engagement. Authenticate your domain, keep complaints low, and send mail people want. Gmail decides placement primarily from three signals: **is the mail authenticated** (does it really come from where it claims), **what is your sending reputation** (how have recipients reacted to your past mail), and **does this specific message look wanted** (engagement, content, list hygiene). Nothing you do guarantees the inbox, but the items below are the levers that actually move Gmail placement. Work through them in order — authentication first, because Gmail now **requires** it for bulk senders. ## 1. Authenticate the domain (non-negotiable) Since February 2024, Gmail requires every bulk sender (roughly 5,000+ messages/day to Gmail) to pass **SPF and DKIM**, publish a **DMARC** policy, and align the visible `From` domain with the authenticated domain. SendDart generates all of these records when you add a domain — you just publish them at your DNS provider. - **SPF** — authorizes SendDart to send for your domain. Without it Gmail can't confirm the path the mail took. - **DKIM** — cryptographically signs each message so Gmail can verify it wasn't altered and really came from you. SendDart signs with your domain's DKIM keys. - **DMARC** — tells Gmail what to do when SPF/DKIM fail, and is the policy that ties everything together. Start at `p=none` to monitor, then tighten to `p=quarantine` or `p=reject` once your reports are clean. > **Warning:** A domain that is **Verified** in SendDart has passed SPF and DKIM, but DMARC is a record *you* publish and choose the policy for. Add a DMARC record even if it's only `p=none` — Gmail expects to find one. See [DNS records](https://www.senddart.com/docs/domains/dns). ## 2. Keep your complaint rate very low Gmail wants spam complaints (people hitting *Report spam*) kept under **0.3%**, and ideally under **0.1%**. Brushing 0.3% repeatedly is the single fastest way to start landing in spam — and once reputation drops, it recovers slowly. - Only mail people who **asked** to hear from you — see [What counts as email consent?](https://www.senddart.com/docs/kb/consent). - Make the **unsubscribe obvious**. A visible opt-out is what stops an annoyed recipient from hitting *Report spam* instead. - Honor opt-outs immediately. SendDart auto-suppresses anyone who complains — see [Why is an address on my suppression list?](https://www.senddart.com/docs/kb/suppression-list). ## 3. Offer one-click unsubscribe Gmail requires bulk senders to support **one-click unsubscribe** (RFC 8058: a `List-Unsubscribe` header plus `List-Unsubscribe-Post`). SendDart campaigns — and `POST /emails` sends that set a [`topic_id`](https://www.senddart.com/docs/topics/overview) — add this header **and** a per-recipient unsubscribe link in the body automatically, so a Gmail recipient can opt out with the native *Unsubscribe* button next to your name. See [Should I add an unsubscribe link?](https://www.senddart.com/docs/kb/unsubscribe-link). ## 4. Send a consistent, gradually growing volume Gmail's reputation model dislikes spikes. A brand-new domain that suddenly sends 50,000 messages looks exactly like a spammer who just registered a throwaway domain. Ramp up gradually and keep your daily volume steady. - New domain or big increase in volume? Warm up first — see the [warm-up guide](https://www.senddart.com/docs/kb/warm-up). - Avoid all-at-once blasts after long silence; reputation decays when you go quiet, then a sudden burst looks suspicious. ## 5. Legitimize your domain Gmail uses your domain to figure out who you are, so the domain you send from should match the domain that hosts your website. If you send from `@example.com` but your site lives at `example.net`, Gmail can't use your site to corroborate that you're a real business. This matters most for **new** domains with no history. - Host your website on the same domain you send from — especially for a brand-new sending domain. - Periodically check whether your domain is flagged with **[Google Safe Browsing](https://transparencyreport.google.com/safe-browsing/search)** so you catch a bad classification early. - Use **dedicated sending addresses per stream** so Gmail can tab your mail correctly: e.g. `notifications@` for transactional and `updates@` for marketing. A separate address per type gives Gmail a clearer signal of what each stream is. - If your brand runs an **affiliate program**, monitor affiliates and drop any that spam — their behavior can taint your domain by association. ## 6. Write mail that looks like real mail - Balance text and images — an email that is **one big image** with almost no text is a classic spam pattern. - **Less is more, and plain text over heavy HTML.** Simpler, succinct content scores better than bloated marketing HTML. - Use a real, reply-able `From` and a `Reply-To` you monitor; `noreply@` mailboxes that bounce replies hurt trust. - Avoid spammy subject lines (ALL CAPS, "FREE!!!", excessive emoji) and link shorteners that hide the real destination. - Keep your link domains consistent with your sending domain where you can; brand-new or mismatched link domains look riskier. Nothing should be **hidden or manipulative** in the body. ## 7. Watch the right signals Use **[Google Postmaster Tools](https://postmaster.google.com)** to see your domain/IP reputation, spam rate, and authentication results directly from Gmail. Inside SendDart, watch bounces, complaints, and opens in your [logs](https://www.senddart.com/docs/logs/overview) — and remember that opens are an imperfect signal (Gmail's image proxy and corporate scanners both fetch the tracking pixel). > **Note:** SendDart counts a Gmail open only when Gmail's image proxy fetches the pixel on display, and ignores delivery-time prefetches and corporate security scanners — so your open rate reflects humans, not gateways. > **Warning:** Note that open- and click-**tracking** can itself nudge mail toward the Promotions tab or spam, because trackers are a pattern Gmail associates with promotional and spam senders. For transactional streams where placement matters most, consider sending without tracking. See [Why aren't my open rates accurate?](https://www.senddart.com/docs/kb/open-rates-accuracy). --- # How to avoid Outlook's spam folder > Outlook and Microsoft 365 weight sender reputation heavily and run aggressive link/attachment scanners. Authenticate, build reputation slowly, and keep complaints near zero. Microsoft (Outlook.com, Hotmail, Live, and Microsoft 365 / Exchange Online) is often the toughest mailbox provider for new senders. It leans hard on **sender reputation** and tends to react sharply to sudden volume or any complaint signal — sometimes routing mail to **Junk** with little warning. The fundamentals are the same as Gmail — authenticate, warm up, keep complaints low — but a few Microsoft-specific points matter. ## Authenticate, including DMARC Publish **SPF, DKIM, and DMARC**. Microsoft checks all three and uses DMARC alignment as a trust signal. Authentication is **required** for bulk senders (roughly **5,000+ messages per day**) and strongly recommended for everyone else. SendDart generates SPF and DKIM when you verify a domain; you add the DMARC record. See [DNS records](https://www.senddart.com/docs/domains/dns). Set a recognizable sender name on your `from` (for example `Acme Updates `) rather than a bare address — Microsoft surfaces and weighs the display name. ## Reputation is everything — warm up slowly Microsoft has no public reputation dashboard like Gmail's Postmaster Tools (its **SNDS** covers IPs, which on SendDart's shared IP pool you don't control), so you can't inspect your standing as easily. That makes a careful [warm-up](https://www.senddart.com/docs/kb/warm-up) even more important: start small, grow volume in steps, and prioritize your **most engaged** recipients first so early Microsoft signals are positive. > **Warning:** Microsoft is quick to throttle. If you see SMTP responses mentioning a high spam complaint rate or unusual sending pattern, slow down immediately — pushing through makes it worse. ## Keep complaints near zero Microsoft runs a **Junk Mail Reporting Program (JMRP)** feedback loop. On SendDart's shared IP pool you generally can't enroll your own IP, so your best defense is preventing complaints in the first place: mail only people who opted in, make unsubscribe obvious, and remove anyone who disengages. SendDart auto-suppresses complaints account-wide — see [the suppression list](https://www.senddart.com/docs/kb/suppression-list). ## Don't be alarmed by 'phantom' opens and clicks Microsoft Defender / ATP **Safe Links** and **Safe Attachments**, plus gateways like Mimecast and Proofpoint, fetch every image and follow every link at delivery time — before a human sees the message. SendDart filters these scanner user-agents out of your open and click counts, so your engagement numbers stay honest. If your Microsoft open rate looks low, it is usually real, not a tracking artifact. ## Build positive engagement signals A few low-effort actions create the early positive signals Microsoft looks for, especially when you're getting started: - **Engage with your own mail.** Send a message to yourself on Outlook.com, open it, and reply — that interaction is a genuine positive signal. - **Add yourself, and ask recipients to add you, as a contact / Safe Sender.** Mail from known contacts skips much of the junk filtering. - **Don't blast a single message to a big BCC list.** Send individual messages (which is what SendDart does per recipient) rather than one mail BCC'd to hundreds — bulk BCC is a strong spam tell to Microsoft. - **Keep the spam-complaint rate under 0.3%.** Stop sending to a stream that shows no engagement, and never keep mailing an address that unsubscribed or is bouncing. ## Content tips that matter to Microsoft - Keep HTML clean and well-formed, and as **close to plain text** as you reasonably can; broken or bloated HTML scores poorly with Microsoft's filters. - Avoid large image-only emails, risky attachment types, and URL shorteners. - Use a consistent, monitored `From` address and a real `Reply-To`. - Maintain steady volume — gaps followed by bursts read as suspicious. --- # How to avoid iCloud's spam folder > Apple's iCloud Mail is strict on authentication and complaints, and Apple Mail Privacy Protection inflates open rates. Authenticate, keep lists clean, and don't trust opens from Apple clients. Apple's **iCloud Mail** (`@icloud.com`, `@me.com`, `@mac.com`) is less transparent than Gmail or Microsoft — there are no postmaster tools and no public feedback loop — but it rewards the same fundamentals: strong authentication, a clean list, and very low complaints. ## Authenticate fully iCloud checks **SPF, DKIM, and DMARC** and is unforgiving of misaligned or missing authentication. Make sure your domain is Verified in SendDart and that you've published a DMARC record. See [DNS records](https://www.senddart.com/docs/domains/dns). ## Keep complaints and bounces extremely low iCloud silently tightens filtering for senders who generate complaints or who keep hitting invalid mailboxes. Because there's no feedback loop telling you who complained, prevention is the whole game: - Send only to **explicit opt-ins** — see [What counts as email consent?](https://www.senddart.com/docs/kb/consent). - Remove hard bounces and unsubscribes promptly — SendDart auto-suppresses both account-wide ([details](https://www.senddart.com/docs/kb/suppression-list)). - Make unsubscribing easy so people opt out instead of marking spam. ## Apple Mail Privacy Protection (MPP) skews opens Most Apple Mail users have **Mail Privacy Protection** turned on. Apple pre-fetches the tracking pixel through a proxy as soon as the message arrives — whether or not the human ever opens it. That means **open rates from Apple clients are inflated and unreliable**. > **Note:** SendDart filters known scanner user agents and applies a short delivery-time guard to ordinary clients. Webmail image proxies count immediately to avoid losing their single cached fetch. You should still treat Apple privacy opens with caution and lean on **clicks, replies, and conversions** as stronger engagement signals. ## Use consistent, compliant infrastructure - **Separate your marketing and transactional streams** (different sending addresses) so each builds its own reputation with Apple. - Use a recognizable, **consistent `From` name and address**; Apple surfaces the sender prominently. - Make sure your mail is **RFC 5321 and RFC 5322 compliant** (well-formed envelope and headers) — Apple is unforgiving of malformed messages. ## Watch SMTP errors and respond to them When iCloud rejects or defers a message it returns an SMTP error explaining why, and Apple expects you to react rather than retry blindly. Distinguish the two: a **temporary** error (a *deferral*, often a throttle) means slow down and try later, while a **permanent** error (a *rejection*) means stop sending to that address. Watch these in your [logs](https://www.senddart.com/docs/logs/overview). > **Note:** Apple offers no allowlist or feedback loop, but for unresolved iCloud delivery problems you can email **icloudadmin@apple.com** with your company name, sending domain, the exact SMTP errors you're seeing, and a description of the issue. ## Other practical tips - Keep volume consistent and warm up new domains — see the [warm-up guide](https://www.senddart.com/docs/kb/warm-up). - Avoid image-only emails and keep your HTML clean. - Because opens are unreliable on Apple, build re-engagement and sunset rules on clicks/replies, not opens — see [keeping your audiences healthy](https://www.senddart.com/docs/kb/audience-hygiene). --- # Why are my emails going to spam? > The usual culprits: missing authentication, weak sender reputation, high complaints, poor list hygiene, sudden volume spikes, or spammy content — and how to fix each. If your mail is landing in spam, it's almost always one (or a few) of the causes below. Work through them top to bottom — authentication problems are both the most common cause and the easiest to fix. ## 1. Authentication is missing or broken If SPF, DKIM, or DMARC fail — or the visible `From` domain doesn't align with the authenticated domain — Gmail, Outlook, and iCloud will distrust the message. This is the **most common** reason new senders hit spam. **Fix:** confirm your domain shows **Verified** in SendDart and that the DNS records are published correctly, then add a DMARC record. See [DNS records](https://www.senddart.com/docs/domains/dns) and [How to avoid Gmail's spam folder](https://www.senddart.com/docs/kb/avoid-gmail-spam). ## 2. Your sending reputation is low or new A brand-new domain has no track record, so providers are cautious. A domain that previously sent to bad lists has a *bad* track record, which is worse. **Fix:** [warm up](https://www.senddart.com/docs/kb/warm-up) gradually and start with your most engaged recipients to build positive history. ## 3. Too many spam complaints If people mark your mail as spam, providers learn to pre-filter it for everyone. Gmail expects complaints under **0.3%** (ideally under 0.1%); Microsoft and Apple are similarly strict. **Fix:** only mail people who [consented](https://www.senddart.com/docs/kb/consent), make [unsubscribe obvious](https://www.senddart.com/docs/kb/unsubscribe-link), and remove complainers (SendDart does this automatically — see [the suppression list](https://www.senddart.com/docs/kb/suppression-list)). ## 4. Poor list hygiene Mailing dead addresses produces hard bounces, and a high bounce rate is a strong spam signal. Stale lists also have low engagement, which providers read as 'nobody wants this.' **Fix:** remove bounces and unsubscribes, and re-engage or drop inactive contacts. See [keeping your audiences healthy](https://www.senddart.com/docs/kb/audience-hygiene). ## 5. Sudden volume spikes Going from a trickle to a flood overnight looks like a compromised account or a spammer. Providers throttle or junk the surge. **Fix:** grow volume in steps and keep it consistent — see [warm-up](https://www.senddart.com/docs/kb/warm-up). ## 6. The content looks like spam - Image-only emails with little or no text. - Spammy subject lines (ALL CAPS, "FREE!!!", heavy emoji). - Link shorteners or link domains unrelated to your sending domain. - Broken or bloated HTML, or a `noreply@` address that bounces replies. **Fix:** send clean, balanced HTML from a real, reply-able address. See the content sections of [How to avoid Gmail's spam folder](https://www.senddart.com/docs/kb/avoid-gmail-spam). ## Read the spam banner Gmail shows When a message lands in spam, Gmail usually shows a banner explaining why. The wording tells you which lever to pull: | Banner message | What it means | Fix | | --- | --- | --- | | "It's similar to messages that were identified as spam in the past." | Your content is tripping spam filters. | Simplify the email — cut excessive links, images, and marketing language; favor plain, balanced HTML. | | "This message seems dangerous." | A URL or some content was flagged as malicious. | Review every link and the body for anything that could look unsafe; keep link domains aligned with your sending domain. | ## Corporate / enterprise filters Recipients on enterprise security services (Mimecast, Proofpoint, Barracuda, Microsoft Defender) get an extra filtering layer on top of normal spam checks, often keyed on domain age, content patterns, or URL reputation. If a specific business recipient isn't getting your mail, ask them to check their **quarantine/junk** and allowlist your sending domain — the fixes above still apply, but only their admin can release a quarantined message. > **Note:** Remember opens are a noisy signal — corporate scanners and webmail image proxies fetch the tracking pixel. SendDart filters scanners and delivery-time prefetches out of your open counts, so a low open rate after fixing the above usually reflects real placement, not a tracking glitch. --- # Why is an address on my suppression list? > SendDart auto-adds an address to your account-wide suppression list on a hard bounce, a complaint, or an unsubscribe — and skips it on every later send to protect your reputation. Your **suppression list** is the set of addresses SendDart will not send to. It's how the platform stops you from repeatedly mailing addresses that are permanently broken or that have asked you to stop — both of which damage your sender reputation and can violate anti-spam law. ## How an address gets suppressed SendDart adds an address automatically in three cases: - **Hard bounce** — the receiving server reports a *permanent* bounce (the mailbox doesn't exist, the domain is invalid, or the recipient's server permanently rejected the message). Soft/temporary bounces do **not** suppress, because the problem is expected to clear up. - **Complaint** — the recipient marked your message as spam (a feedback-loop complaint). Complaints always suppress. - **Unsubscribe** — a recipient opted out via a campaign unsubscribe link or one-click `List-Unsubscribe`, or you suppressed them manually. > **Note:** Suppression is **account-wide**: once an address is suppressed, it's skipped across all of your sends — transactional `POST /emails`, batches, and campaigns alike. It only affects *your* account; another account's suppressions never touch yours, and yours never touch theirs. ## What happens on a send On **every send path**, SendDart checks each recipient against your suppression list before handing the message off for delivery. Suppressed recipients are skipped — the rest of the send proceeds normally. For a single `POST /emails`, a suppressed recipient is recorded with a `suppressed` status rather than being mailed. See [Email suppressions](https://www.senddart.com/docs/emails/suppressions). ## Should you remove an address? Usually **no** — suppression is protecting you. But the right action depends on why the address was suppressed: | Reason | What to do | | --- | --- | | Hard bounce | Leave it. The mailbox is gone; re-sending only produces more bounces and hurts reputation. Fix the source of bad addresses instead. | | Complaint | Leave it. The recipient explicitly flagged your mail as unwanted — re-mailing risks legal exposure and more complaints. | | Unsubscribe | Leave it unless the person genuinely re-subscribes through a new, documented opt-in. | > **Warning:** If you remove a suppression and re-add the address, you take on the risk: a previously-complained or invalid recipient who bounces or complains again will hurt your standing with mailbox providers. Only do this when you have fresh, explicit [consent](https://www.senddart.com/docs/kb/consent). ## Keeping the list from growing A growing suppression list is a symptom — usually of a list that wasn't cleanly opted-in or has gone stale. Tighten consent at signup and practice ongoing [audience hygiene](https://www.senddart.com/docs/kb/audience-hygiene). --- # Domain & sending warm-up guide > Build sender reputation by ramping volume gradually and mailing your most engaged recipients first. A practical schedule for new domains. **Warming up** means starting at a low daily volume and increasing it gradually, so mailbox providers build a positive reputation for your domain before you send at full scale. A new domain has no track record — if it suddenly sends tens of thousands of messages, providers treat it like a spammer and route mail to junk. SendDart sends on a shared IP pool, so the **IP** reputation is already warm. Your job is to warm up your **domain's** reputation — which is what Gmail, Outlook, and iCloud actually track for authenticated senders. ## The two rules of warm-up 1. **Ramp volume gradually.** Increase how much you send per day in steps, not all at once. Roughly doubling daily volume every few days is a reasonable pace; slow down if you see bounces or complaints rise. 2. **Send to engaged recipients first.** Start with the people most likely to open, click, and reply — recent signups and active customers. Positive early engagement is what tells providers your mail is wanted. ## New domain — first-week schedule A brand-new domain has no reputation, so start very low and roughly double each day. These are baselines, not hard rules — slow down if your metrics worsen. | Day | Messages per day | Messages per hour | | --- | --- | --- | | 1 | up to 150 | — | | 2 | up to 250 | — | | 3 | up to 400 | — | | 4 | up to 700 | 50 max | | 5 | up to 1,000 | 75 max | | 6 | up to 1,500 | 100 max | | 7 | up to 2,000 | 150 max | Past day 7, keep increasing daily volume in steps (roughly ×1.4 per day is a safe pace for a new domain) until you reach your target, holding hourly volume to about a tenth of the daily figure. ## Existing domain — first-week schedule If you're moving an already-established, already-warm domain onto SendDart, you can start higher and ramp faster: | Day | Messages per day | Messages per hour | | --- | --- | --- | | 1 | up to 1,000 | 100 max | | 2 | up to 2,500 | 300 max | | 3 | up to 5,000 | 600 max | | 4 | up to 5,000 | 800 max | | 5 | up to 7,500 | 1,000 max | | 6 | up to 7,500 | 1,500 max | | 7 | up to 10,000 | 2,000 max | Beyond day 7, continue stepping up (roughly ×1.5 per day for an established domain) toward your target daily volume. ## Watch these as you ramp - **Bounce rate** — keep it **below 4%**. A rising bounce rate means list-quality problems; pause and clean before increasing volume. - **Spam rate** — keep it **below 0.08%**. Any climb means slow the ramp and find the root cause before continuing. - **Engagement** — opens (with the caveat that they're noisy), and especially clicks and replies. - For Gmail, watch your domain reputation in **[Google Postmaster Tools](https://postmaster.google.com)** as you ramp. > **Warning:** Avoid third-party "warm-up" services that artificially inflate engagement. They work by gaming spam filters, and as providers like Gmail adjust, that fake history backfires on your real reputation. Warm up with real, relevant mail to engaged recipients instead. ## After warm-up: stay consistent Reputation decays when you go quiet. After warming up, keep a **steady** cadence rather than long silences punctuated by big blasts — a sudden burst after weeks of nothing looks like a fresh, cold sender all over again. > **Note:** Warm-up and authentication go together: a domain can only build reputation once it passes SPF/DKIM and aligns with DMARC. Verify your domain and publish DNS first — see [DNS records](https://www.senddart.com/docs/domains/dns). --- # Should I add an unsubscribe link? > Yes for bulk and marketing mail — it's required by law and by mailbox providers. SendDart campaigns auto-inject a per-contact link and a List-Unsubscribe header. Transactional opt-out is sender-driven. **For bulk and marketing email, yes — always.** A clear unsubscribe link is required by anti-spam law (CAN-SPAM, CASL, GDPR) and effectively required by Gmail and Yahoo, which mandate one-click unsubscribe for bulk senders. Just as importantly, it's your best defense against spam complaints: a recipient who can't find the unsubscribe will hit *Report spam* instead, which hurts you far more. ## Campaigns: handled for you When you send a [campaign](https://www.senddart.com/docs/campaigns/managing), SendDart automatically adds **both** mechanisms to every copy: - **A per-contact unsubscribe link in the body.** If your HTML already contains an unsubscribe link, SendDart leaves it alone; if it doesn't, a small footer with a working opt-out link is appended — so a campaign can never go out with no way to opt out. - **A `List-Unsubscribe` header with one-click support** (RFC 8058 `List-Unsubscribe-Post`). This powers the native *Unsubscribe* button Gmail and Apple Mail show next to your name. When a contact unsubscribes through either path, SendDart marks them unsubscribed and skips them on future sends. See [Unsubscribed contacts](https://www.senddart.com/docs/audiences/unsubscribed). > **Note:** Because campaigns auto-inject the link and header, you don't need to hand-build unsubscribe handling for marketing campaigns — it works out of the box. ## Bulk mail via `POST /emails`: set a `topic_id` If you send newsletters or product announcements through `POST /emails` rather than a campaign, tag the send with a [`topic_id`](https://www.senddart.com/docs/topics/overview). That marks it as subscription mail, and SendDart adds the same two mechanisms it adds to a campaign: a per-recipient unsubscribe footer and the RFC 8058 `List-Unsubscribe` header. Recipients do not have to be contacts — the opt-out is recorded against the address. > **Note:** A topic opt-out is scoped to **that topic**: the address keeps receiving your other email, including receipts and password resets. Only later sends carrying the same `topic_id` skip it. ## Transactional email: sender-driven Transactional messages sent with `POST /emails` and **no** `topic_id` (password resets, receipts, order confirmations) are **not** automatically given an unsubscribe footer — these are one-to-one operational mails the recipient expects, and a marketing-style unsubscribe is often inappropriate (you can't opt out of your own receipt). It would also be dangerous: an unsubscribe writes a suppression that blocks every later send to that address, so one stray click on a password-reset footer would cut off the recipient's own account recovery. That means opt-out for transactional mail is **sender-driven**: it's up to you to decide when an opt-out makes sense and to add your own link. If a recipient should be able to stop a given transactional stream, include your own unsubscribe link in the `html` body and record the resulting opt-out as a [suppression](https://www.senddart.com/docs/emails/suppressions) so future sends to that address are skipped. ## Rule of thumb | Mail type | Unsubscribe link | Who handles it | | --- | --- | --- | | Campaign / marketing | Required | SendDart (auto link + List-Unsubscribe header) | | Newsletter / bulk via `POST /emails` **with** `topic_id` | Required | SendDart (auto link + List-Unsubscribe header, scoped to the topic) | | Newsletter / bulk via `POST /emails` **without** `topic_id` | Required | You — add a link and suppress opt-outs | | Transactional (receipts, resets) | Optional / case-by-case | You (sender-driven — SendDart adds nothing) | --- # What counts as email consent? > Explicit opt-in is real consent; purchased and scraped lists are not. A practical look at CAN-SPAM and CASL basics and what they require. **Consent** is permission from a recipient to email them. It's the foundation of deliverability and the law: mailbox providers reward senders whose recipients want their mail, and anti-spam statutes penalize those who mail people who didn't ask. This is general guidance, not legal advice — consult a lawyer for your specific situation. ## What counts as consent - **Explicit opt-in** — someone deliberately signed up: checked a box, filled in a form, or confirmed via email (double opt-in). This is the gold standard. - **Confirmed opt-in (double opt-in)** — they signed up *and* clicked a confirmation link. The strongest, cleanest form of consent; it also proves the address is valid. - **Existing business relationship** — in some jurisdictions, a recent customer can be emailed about related products, within limits. Narrower than people assume. ## What does NOT count > **Warning:** **Purchased, rented, or scraped lists are never valid consent.** Those recipients never agreed to hear from you. They produce high complaints and bounces, wreck your reputation fast, and can land you on a permanent bad-sender footing with Gmail and Microsoft. SendDart is built for opt-in sending; don't import a bought list. - Buying or renting an email list. - Scraping addresses from websites or LinkedIn. - A business card dropped in a bowl, unless you clearly said you'd email them. - "They're a customer so they won't mind" — assumed consent isn't consent. - A clause buried in your **Terms of Service** that says users "agree to receive emails." - A **pre-checked** marketing checkbox on your signup form — consent must be an active opt-in, so the box has to start unchecked. - Treating someone as opted-in **until they unsubscribe**. Silence is not consent. ## CAN-SPAM (United States) CAN-SPAM doesn't require opt-in, but it does require: - No false or misleading **headers** or `From` addresses. - No deceptive **subject lines**. - A clear, working **unsubscribe** mechanism, honored within 10 business days. - A valid **physical postal address** in the message. - Identifying the message as an **ad** where applicable. ## CASL (Canada) CASL is stricter — it generally requires **express or implied consent before** you send, requires you to **identify yourself**, and requires a working **unsubscribe**. Penalties are significant. If you mail Canadian recipients, get explicit opt-in. ## GDPR / e-Privacy (EU/UK) For EU/UK recipients, marketing email generally requires **freely given, specific, informed opt-in** consent, with an easy way to withdraw it. Pre-ticked boxes don't count. ## How to collect consent cleanly The simplest way to get real consent is to ask for it clearly and separately. Add an **unchecked** checkbox to your signup form with specific wording, for example: > **Note:** Yes, I want to receive product updates and occasional marketing emails. - Keep it **optional** and **unchecked** by default. - Make the wording **clear and specific** about what they'll receive. - Place it **outside** your Terms of Service, not bundled into them. - Include a one-click unsubscribe link in every email you then send. For an extra-strong record, use **double opt-in**: after signup, send a confirmation email the recipient must click before they're added. It proves the address is valid and that its owner actually wanted in — see [keeping your audiences healthy](https://www.senddart.com/docs/kb/audience-hygiene). ## Practical takeaway Build your list with explicit opt-in, always include a working unsubscribe (SendDart campaigns do this for you — see [Should I add an unsubscribe link?](https://www.senddart.com/docs/kb/unsubscribe-link)), include your postal address in marketing mail, and honor opt-outs immediately. Do that and you satisfy the law *and* keep providers happy. --- # Keeping your audiences healthy > Remove bounces and unsubscribes, re-engage or drop inactive contacts, and watch your complaint rate. A clean list is the foundation of inbox placement. **List hygiene** is the ongoing work of keeping your audiences full of valid, engaged, consenting recipients. It's the highest-leverage thing you can do for deliverability: a clean list lowers bounces and complaints, raises engagement, and keeps mailbox providers trusting you. A neglected list does the opposite, slowly, until your mail starts landing in spam. ## Remove bounces and unsubscribes SendDart does most of this automatically: hard bounces, complaints, and unsubscribes are added to your account-wide [suppression list](https://www.senddart.com/docs/kb/suppression-list) and skipped on every future send. But suppression hides bad addresses from sending — it doesn't prune your source data. - Periodically clean the **source** of your contacts (your CRM, signup database) so you stop importing addresses that will just bounce. - Don't re-add or re-import addresses that previously bounced or complained — you'll just re-suppress them and waste reputation. - Treat the suppression list growing fast as a warning sign that your acquisition is letting in bad or non-consenting addresses. > **Note:** Suppression and unsubscription are different. SendDart auto-**suppresses** sends to bounced and complained addresses, but it does not automatically **remove** that contact from your audience. Use a [bounce / complaint webhook](https://www.senddart.com/docs/webhooks/overview) to proactively unsubscribe or prune those contacts at the source so your audience counts and segments stay honest. ## Collect valid addresses in the first place The cheapest hygiene is not letting bad addresses onto the list at all: - **Block bots with CAPTCHA at signup.** Bots sign up freely and fill your list with fake addresses that bounce. A challenge such as Google reCAPTCHA, hCaptcha, or Friendly Captcha keeps signups human. - **Use double opt-in.** Send a confirmation link the subscriber must click before they're added — this verifies the address is real *and* that its owner wanted in, and supports CAN-SPAM / CASL compliance. - **Verify deliverability with a third-party service.** Valid *syntax* (RFC 5322) doesn't mean a live inbox; an address-verification service flags addresses likely to bounce before you ever mail them. ## Re-engage, then sunset, inactive contacts Contacts who never open, click, or reply drag down your engagement signals — and low engagement is itself a spam signal. Major providers like Gmail and Microsoft expect you to mail people who've recently engaged, so as a rule of thumb limit non-transactional sends to contacts who **opened or clicked within the last 6 months** (adjust for your industry and cadence). Don't keep mailing dead weight forever. 1. **Identify the inactive** — Find contacts with no clicks or replies over a meaningful window (e.g. the last 3–6 months). Lean on clicks and replies rather than opens, which are noisy. 2. **Run a re-engagement campaign** — Send a short "do you still want to hear from us?" message with a clear way to stay subscribed. 3. **Sunset the rest** — Stop mailing — or unsubscribe — contacts who don't re-engage. A smaller, engaged list outperforms a big, dead one on both placement and results. > **Note:** Opens are unreliable — corporate scanners and webmail image proxies (and Apple Mail Privacy Protection) fetch the tracking pixel. SendDart filters scanners and delivery-time prefetches out of your counts, but for engagement decisions, **clicks and replies are stronger signals than opens**. ## Monitor your complaint rate A rising complaint rate is the clearest early warning that a list or a campaign is unwelcome. Keep complaints under **0.1%** where you can; treat 0.3% as a red line. If complaints climb, pause, look at what changed (a new segment? a bought list? a tone shift?), and fix the source. ## Hygiene checklist - Only add contacts with explicit [consent](https://www.senddart.com/docs/kb/consent). - Let SendDart auto-suppress bounces, complaints, and unsubscribes — and don't fight it by re-importing them. - Review engagement quarterly; re-engage or sunset the inactive. - Watch bounces and complaints on every campaign in your [logs](https://www.senddart.com/docs/logs/overview). - Keep volume steady and warm up new domains — see the [warm-up guide](https://www.senddart.com/docs/kb/warm-up). --- # Maximize deliverability for Supabase Auth emails > Five steps to land Supabase authentication emails — verifications, magic links, password resets — in the inbox when sending through SendDart: custom domain, a dedicated subdomain, no tracking, link-scanner handling, and DMARC. Authentication emails — email verifications, magic links, password resets — are some of the most time-sensitive mail you'll ever send: if they hit spam, users can't sign in. If you wire up [Supabase Auth](https://supabase.com/docs/guides/auth) to send through SendDart (from your own verified domain), the five steps below give those messages the best possible chance at the inbox. ## 1. Set up a custom domain on Supabase By default Supabase generates a `supabase.co` domain for your project and uses it for the links inside your auth emails (verify email, reset password). Before going live, configure a **custom domain**. The point is to **align the domain in your `from` address with the domain in the links** — for something as sensitive as verification and magic links, telling the inbox provider that the message origin and the link destinations share a domain is a meaningful trust signal. That changes your links from a generated host like: ```text https://039357829384.supabase.co/auth/v1/{code} ``` to something on your own domain: ```text https://auth.example.com/auth/v1/{code} ``` Supabase has a guide for [setting up a custom domain](https://supabase.com/docs/guides/platform/custom-domains). ## 2. Use a dedicated subdomain for auth Send authentication mail from a **subdomain** (for example `auth.example.com`) rather than your root domain. This isolates the reputation of your auth sending from your root domain, and — just as importantly — it **signals your intent** to the inbox provider: mail from `auth.example.com` is clearly authentication mail, not marketing, so it's judged by the standards that apply to wanted, transactional messages. > **Note:** If you'd rather not have a subdomain just for auth, use one subdomain for all your transactional mail (e.g. `notifications.example.com`). Either way, add the subdomain in SendDart and verify it — see [Add a domain](https://www.senddart.com/docs/add-a-domain) and [subdomain vs. root domain](https://www.senddart.com/docs/kb/subdomain-vs-root). ## 3. Disable link and open tracking Open and click tracking are useful for marketing, but for transactional and auth mail they can **hurt deliverability**. Open tracking embeds a 1x1 pixel; click tracking rewrites your links to pass through a tracking host first. Both can look suspicious to inbox providers, and — critically — link rewriting is [known to corrupt single-use verification links](https://supabase.com/docs/guides/platform/going-into-prod), breaking sign-in for your users. Turn tracking off for the sending domain you use for auth. See [Domain tracking](https://www.senddart.com/docs/domains/tracking). > **Note:** Keeping auth mail tracking-free means the magic link the user clicks is the exact link you generated — no rewrite layer that can mangle a single-use token. ## 4. Prepare for link scanners Some inbox providers and enterprise security systems run a `GET` request against every link in a message **before** the user ever sees it. Because Supabase Auth links are **single-use**, a scanner can silently consume the token and leave the user with a dead link. To work around this, alter the email template so the magic link points to a **landing page you control** instead of the raw auth URL. That page shows a *Sign in* button; clicking it redirects to the real magic-link URL. The scanner's `GET` hits your harmless landing page, and the token is only spent when the human clicks. ## 5. Set up DMARC Deliverability is built on trust, and authentication is its foundation. **DMARC** tells the inbox provider that you are who you say you are: it ties your SPF and DKIM results together and states what should happen if they fail. Publishing a DMARC record signals that you're a legitimate sender whose mail belongs in the inbox. SendDart generates SPF and DKIM when you verify a domain; you publish the DMARC record yourself. Start at `p=none` to monitor, then tighten once your reports are clean. See the [DMARC setup guide](https://www.senddart.com/docs/domains/dmarc). > **Note:** Send your Supabase auth mail through SendDart the same way as any other transactional message — via the SDK (`mb.emails.send(...)`) in Node.js, or `POST ${BASE}/emails` with your `mb_` API key from any other runtime. The five steps here are about the **domain** and **template** around that call, not the call itself. --- # Sending to Apple Private Relay > Reliably deliver to @privaterelay.appleid.com (Sign in with Apple's Hide My Email). Register your sending domains — including SendDart's return-path subdomain — and from-addresses in the Apple Developer Portal, and authenticate with SPF and DKIM. If your app supports **Sign in with Apple**, users can choose **Hide My Email**. Apple then assigns each user a unique, randomly generated address under `@privaterelay.appleid.com` and forwards mail from it to their real inbox. Apple will only relay mail from senders it recognizes — so a few configuration steps are required, or your messages bounce. > **Note:** Apple offers **two** Hide My Email services: one through Sign in with Apple, and one through iCloud+. This guide covers **Sign in with Apple**, which generates a unique address for account creation and login. Configure it in the Apple Developer Portal under **Certificates, Identifiers & Profiles → More → Sign in with Apple for Email Communication → Configure**. ## Register your sending domains Apple requires you to list every domain you send from. If your **return-path** (envelope) domain differs from your visible sending domain, you must register that too. > **Warning:** With SendDart the return-path runs through a **subdomain**, so it differs from your visible `From` domain. Find it in your Domain settings — it's formatted as `send.yourdomain.tld` (or `send.yoursubdomain.yourdomain.tld`) for the MX and SPF records. Register **both** your primary domain and this `send.` subdomain as Apple email sources, or relay mail will bounce. ## Register your email addresses Alongside your sending domains, Apple requires registration of every from-address you use to send from those domains. Add them one by one or as a comma-separated list. If you also send to Private Relay from sources other than SendDart, include those addresses as well. ## Authenticate your sending domains Apple requires SPF and DKIM. Because SendDart **mandates SPF and DKIM** for every domain that sends through it, a domain that is **Verified** in SendDart already meets Apple's authentication requirement. See [DNS records](https://www.senddart.com/docs/domains/dns). ## Still seeing bounces from @privaterelay.appleid.com? Relay bounces don't always carry a detailed reason. The common causes are: - The user **deleted** their Hide My Email address in Apple settings. - The user **exceeded the daily limit** of 100 emails to/from their Hide My Email address. - A **misconfiguration** — double-check that every sending domain (including the `send.` return-path subdomain) and every from-address is registered and authenticated with Apple. > **Note:** Apple lets the account owner and admins in the Apple Developer Portal opt in to **notifications when relay delivery fails** — enable that to catch problems early. For more, see Apple's docs on [configuring the Private Email Relay service](https://developer.apple.com/help/account/configure-app-capabilities/configure-private-email-relay-service/) and [communicating using the Private Email Relay service](https://developer.apple.com/documentation/signinwithapple/communicating-using-the-private-email-relay-service/). --- # How do Dedicated IPs work? > SendDart sends on a shared, professionally-managed IP pool by default, and Scale plans can add a dedicated IP. Here's why shared is the right default for most senders, what a dedicated IP actually buys you, and when it helps versus hurts. The sending IP address is one identifier inbox providers like Gmail use to track sender reputation and make filtering decisions. A natural question is whether you should be on a **dedicated IP** — a range of IPs used only by you — instead of a shared pool. **By default, SendDart sends all mail on a shared, professionally-warmed IP pool.** For most senders that is genuinely the better choice. If you outgrow it, **Scale plans can add a dedicated IP** (we provision, warm up, monitor, and auto-scale it for you), and **Enterprise plans include one** — contact us to provision. This page explains what dedicated IPs do and when they help versus hurt, so you can judge which model fits your sending. ## What a dedicated IP is By default, most platforms — SendDart included — put you on **shared IPs**: a set of addresses used across many senders, whose reputation is the aggregate of everyone's behavior. A **dedicated IP** assigns a range exclusively to your sending, so the reputation reflects only you. Done well, a dedicated IP must be **warmed up** gradually (a new IP has no reputation and is scrutinized), **scaled** to per-provider rate limits, and **monitored** continuously — all of which are delicate and time-consuming. ## Why dedicated IPs are no longer a silver bullet Historically, a dedicated IP was seen as *the* ingredient for great deliverability. That's no longer true. Inbox providers now weight **domain reputation**, **sending history**, and **sending feedback** (bounces and complaints) far more heavily than raw IP reputation. Authenticating your domain and keeping complaints low matters more than which IP your mail leaves on. > **Note:** This is why SendDart focuses on what actually moves placement for a domain-authenticated sender: SPF/DKIM/DMARC, a clean list, and steady volume. On a shared pool the **IP** reputation is already warm and professionally managed — your job is to warm up your **domain**. See the [warm-up guide](https://www.senddart.com/docs/kb/warm-up). ## The one thing a dedicated IP does buy: no noisy neighbors The genuine benefit of a dedicated IP is **removing the risk of noisy neighbors**. On a shared pool you ride on the aggregate reputation of everyone in it — usually a positive, since there's power in numbers, but a small group of senders who want full, isolated control over their own IP reputation prefer a dedicated IP for that reason. ## When a dedicated IP would actually hurt For many senders a dedicated IP **hurts** rather than helps — which is exactly why a shared pool is the better default. A dedicated IP is a poor fit if you have: - **Low volume** — under ~30k emails/month often isn't enough to keep an IP warm, and a cold IP delivers worse than a warm shared one. - **Inconsistent sending** — sudden swings in volume damage a dedicated IP's reputation. - **Imperfect practices** — a dedicated IP exposes your sending behavior even more directly, with no pool to absorb it. - **No sending history** — a brand-new sender has nothing to build a dedicated reputation on. - **An IP-allowlisting requirement** — managed shared pools scale dynamically and don't expose a fixed list of IPs to allowlist. > **Note:** If your sending matches that list — low or bursty volume, a newish domain, no need to allowlist fixed IPs — SendDart's managed shared pool is genuinely the better choice, not a compromise. You get a continuously-warmed, monitored IP reputation for free and spend your effort on domain authentication and list hygiene, which is where the leverage is. ## When dedicated IPs make sense (and what you would need) Dedicated IPs tend to pay off only for **high, steady, well-behaved** volume from an established sender — the profile where isolation from noisy neighbors outweighs the cost of warming and maintaining your own IP. As a rule of thumb the industry uses, a dedicated IP wants roughly: - Consistent volume comfortably above **500 emails/day** (and ideally well over 30k/month) to stay warm. - Steady, predictable sending rather than bursts. - A clean track record — low bounces and complaints. - Fully authenticated, verified domains. > **Warning:** If your volume and consistency genuinely require dedicated, isolated IP reputation, **SendDart offers dedicated IPs as an add-on on Scale plans (included with Enterprise)** — we handle warm-up, monitoring, and scaling; contact us to provision one. For the overwhelming majority of senders, the shared pool plus strong [domain authentication](https://www.senddart.com/docs/domains/dns) delivers as well or better — with none of the warm-up burden. --- # Why use Topics? > Topics let recipients opt out of one kind of email without unsubscribing from everything. That keeps engagement high and complaints low — which protects deliverability. Here's when to use Topics, and how they differ from Segments. Every send starts with one decision: **who is this for?** Those recipients — a person, an audience, or a [segment](https://www.senddart.com/docs/segments/overview) — are the core of sending. By default everyone in that group receives the message, but not everyone in it wants every message. **[Topics](https://www.senddart.com/docs/topics/overview)** give recipients a way to say *don't send me this kind of email* without unsubscribing from everything. Think of a Topic as a **contract with your recipients**: a promise that if they opt out of a content type, you'll honor it. Topics don't define who receives a message — they define **who asked not to** receive it. This page explains why that matters for deliverability and how Topics differ from segments. ## Why Topics improve deliverability Deliverability is about landing in the inbox instead of spam, and **recipient engagement** is a key factor. Gmail, Outlook, and the rest track whether people open, click, or mark your mail as spam. When you send every marketing email to everyone, a slice of the list never engages — and that does real damage: - **Lower open rates** — recipients ignore mail that doesn't interest them. - **Higher spam complaints** — frustrated recipients hit *Report spam* instead of unsubscribing. - **Falling sender reputation** — providers see low engagement and start filtering you to spam. Topics give recipients agency and give you signal. When someone says *no promotional emails*, the system honors it while still sending the content they do want — so you keep the engagement and avoid the complaint. ## Without Topics: a single global unsubscribe Without Topics, your unsubscribe page offers exactly one option: **unsubscribe from everything**. That's a blunt instrument — plenty of recipients who'd happily keep getting *some* of your mail leave entirely because of one too many emails about something they didn't want. With Topics, they can decline a single content type and stay subscribed to the rest, so you retain more engaged subscribers. ## When to use Topics Topics are most valuable when you send **multiple types of marketing content** to the same audience. Common examples: | Topic example | Description | | --- | --- | | Newsletter | Regular updates, articles, or curated content | | Product Updates | New features, releases, and announcements | | Promotions | Discounts, sales, and special offers | | Events | Webinars, conferences, and meetups | | Tips & Tutorials | Educational content and how-to guides | ## When you might not need Topics If you only ever send **one** kind of marketing email — say a monthly newsletter and nothing else — Topics add complexity without much benefit. A simple subscribe/unsubscribe model is enough. ## Topics vs. Segments Topics and [segments](https://www.senddart.com/docs/segments/overview) solve fundamentally different problems, and the distinction is the key to using both well. | Aspect | Topics | Segments | | --- | --- | --- | | Who controls it | Your recipients | You (the sender) | | Visibility | Shown on the unsubscribe page | Internal only (recipients never see them) | | Purpose | Let recipients manage their preferences | Organize contacts for targeted sending | | Example | "Newsletter", "Product Updates" | "Enterprise customers", "Free trial users" | ## How Segments and Topics work together Segments are **who you're sending to**; Topics are **what you're sending**. When you send a [campaign](https://www.senddart.com/docs/campaigns/managing): 1. **Choose a Segment** — Pick the segment that defines your recipients — your sender intent. 2. **Label with a Topic** — Tag the content with a Topic so the system can respect recipient preferences. 3. **Send, minus opt-outs** — Everyone in the segment receives the message except those who opted out of that Topic. For example, a product announcement sent to your *Enterprise Customers* segment, labeled with the *Product Updates* Topic, automatically excludes anyone who previously declined product updates. **Segments target; Topics protect preferences** — they work together without competing. ## Opt-in vs. opt-out Topics When you create a Topic, you choose its default subscription behavior, and **you can't change it later**: - **Opt-in (default)** — all contacts receive this Topic unless they explicitly unsubscribe (applies retroactively to every contact). Use it for broadly relevant content like product updates. - **Opt-out** — contacts do *not* receive this Topic unless they explicitly subscribe. Use it for niche content only some users want, like a beta program or developer-focused updates. > **Warning:** You cannot change the default subscription type after a Topic is created — choose opt-in vs. opt-out deliberately. ## Public vs. private Topics - **Public** — every contact sees this Topic on the unsubscribe page. - **Private** — only contacts already opted in can see it. Useful for exclusive content (a beta program, VIP announcements) you don't want to advertise to everyone. ## Best practices - **Keep it simple** — aim for 3–5 clear content types; a long list of checkboxes overwhelms recipients. - **Use clear names** — "Newsletter" and "Product Updates" communicate; "Category A" and "Misc" don't. - **Add descriptions** — use the optional description to set expectations about frequency and content. - **Always label campaigns with a Topic** — so recipients who declined that content don't receive it, and an unsubscribe can be scoped to that Topic rather than everything. > **Note:** If you send a campaign **without** a Topic and someone unsubscribes, they're unsubscribed from **all** your mail. Labeling your content protects both you and your recipients. See [Topics](https://www.senddart.com/docs/topics/overview) to get started, and [customize your unsubscribe page](https://www.senddart.com/docs/settings/custom-unsubscribe) to show your Topics with your branding. --- # Account quotas and limits > How the plan sending quotas, per-request limits, and rate limiting work — and how to raise your limits. SendDart applies two kinds of limit to keep deliverability healthy and protect your sending reputation: **sending quotas** derived from your plan that cap how many emails an account can send in rolling windows, and **per-request limits** on how many recipients, batch items, and attachment bytes a single API call may carry. These limits are independent — a request can be small enough to satisfy every per-request limit and still be rejected if it would push you over a sending quota. ## Sending quotas Sending quotas come from your **plan**, and are measured over **rolling windows** — not calendar periods that reset at midnight. Both **sent and received** emails count toward them. As older emails age out of a window, that budget frees up again automatically. - **Free plan** — **100 emails per rolling 24 hours** and **3,000 emails per rolling 30 days** (sent + received combined). The daily cap is an **anti-abuse safety rail**, not a billing meter — buying email credits does not lift it. - **Paid plans** — a **monthly volume** set by the plan (measured over a rolling 30 days, sent + received combined) with **no daily cap**. - When a send would exceed a quota, the request is **rejected** with a `429` — `daily_quota_exceeded` or `monthly_quota_exceeded`. It is never queued, trickled, or partially sent; retry after the window frees up, or raise the limit (see below). > **Note:** Your plan limits and current usage are shown in the dashboard. The quotas are also summarized in [Usage limits](https://www.senddart.com/docs/api/limits). ## Per-request limits Each API call must also stay within these per-request limits: | Limit | Value | | --- | --- | | Recipients per email (`to`) | up to 50 | | Emails per batch (`POST /emails/batch`) | up to 100 | | Total attachments per email | up to 40 MB | Exceeding a per-request limit returns a `422 validation_error` describing which limit was hit — split the work across more requests (or use a batch) and retry. > **Note:** Every recipient counts against your quotas individually: multiple `to`, `cc`, or `bcc` addresses on one email each count as a separate email. If you receive email (inbound), each received message also counts as one email against the quotas, the same as a sent one. ## Rate limiting Send endpoints are also rate limited. If you send too fast you receive a `429 rate_limit_exceeded` response. Back off and retry with **exponential delay** rather than hammering the endpoint — a tight retry loop will keep tripping the limit. ```json { "statusCode": 429, "name": "rate_limit_exceeded", "message": "Too many requests — back off and retry." } ``` Rate limits are enforced over **60-second windows**, per client IP: roughly **30 requests per minute** on the send endpoints, **20 per minute** on expensive endpoints (such as AI and support), and **120 per minute** on general public endpoints. There is **no separate burst allowance** above the stated limit — once you exhaust the window, the next request receives a `429` until it resets. Because the limit is keyed per IP, requests from multiple services behind the same address count together toward it. Rate-limit responses follow the [IETF rate-limit header standard](https://datatracker.ietf.org/doc/html/draft-ietf-httpapi-ratelimit-headers). Read these headers to drive **client-side throttling** so you stay just under the limit instead of discovering it via `429`s: | Header | Meaning | | --- | --- | | `ratelimit-limit` | Maximum requests allowed in the current window. | | `ratelimit-remaining` | Requests still allowed in the current window. | | `ratelimit-reset` | Seconds until the window resets. | | `retry-after` | On a `429`, seconds to wait before retrying. | - **Batch where you can.** A single [batch send](https://www.senddart.com/docs/api/emails-batch) of up to 100 emails counts as **one** request against the rate limit, so batching is the most efficient way to push volume. - **Throttle from the headers** rather than guessing — slow down as `ratelimit-remaining` approaches zero. ## Reputation limits: bounce and spam rates Beyond volume, your account must keep its **bounce rate** and **spam (complaint) rate** healthy. These are deliverability guardrails enforced by the upstream mailbox providers as much as by SendDart, and breaching them can lead to a **temporary pause in sending** until the rate recovers. - Keep your **bounce rate under 4%**. Remove inactive and invalid addresses, only send to recipients who opted in, and use test addresses (never fake real-looking ones) when testing. - Keep your **spam/complaint rate under 0.08%**. Give recipients a clear way to opt out, send relevant and timely mail, and only send with consent. - Monitor both rates from the dashboard metrics and via [bounce and complaint webhooks](https://www.senddart.com/docs/webhooks/events) so you can react before a pause is triggered. ## Raising your limits Quotas follow your plan, so raising them is self-serve — there is no approval process (see [Does SendDart require production approval?](https://www.senddart.com/docs/kb/production-approval)): - **Upgrade your plan** for a larger monthly volume — and no daily cap, since only the Free plan has one. Upgrades take effect on your next send. - **Buy email credits** ($0.90 per 1,000) to extend your **monthly** volume without changing plans. Credits never expire — but they do not lift the Free plan’s daily rail, which only upgrading removes. > **Note:** For the full table of recipient, batch, and attachment limits plus the daily quota, see [Usage limits](https://www.senddart.com/docs/api/limits). --- # Does SendDart require production approval? > No — there is no approval step. New accounts start on the Free plan limits, and higher limits come from upgrading your plan. No. There is **no production-approval step**, no sending sandbox, and no verified-recipient restriction. As soon as you have a **verified sending domain**, you can send to any recipient — the only limits on a new account are the **Free plan quotas**. ## What limits a new account New accounts start on the **Free plan**: - **100 emails per rolling 24 hours** — an anti-abuse safety rail on the Free plan only. - **3,000 emails per rolling 30 days** (sent + received combined). - A send that would exceed either quota is **rejected** with a `429` (`daily_quota_exceeded` / `monthly_quota_exceeded`) — see [Account quotas and limits](https://www.senddart.com/docs/kb/quotas). > **Note:** Higher limits are self-serve: **upgrade your plan** for a larger monthly volume and no daily cap, or buy email credits to extend the monthly volume. There is no request-and-approval flow. ## The one gate: domain verification The only thing that blocks sending outright is an unverified **from-domain**. If you have added a domain but not yet published its DNS records, it stays **Pending** and you cannot send **from** it — that is a DNS problem, not an account approval. - **Domain shows Pending** → publish the SPF/DKIM/DMARC records so it verifies. See [Managing domains](https://www.senddart.com/docs/domains/managing). - **Send rejected with a domain-related `validation_error`** → the `from` address is not on one of your verified domains. ## Getting to production volume 1. **Verify your sending domain** — Publish the SPF/DKIM/DMARC records SendDart generates so your domain is fully verified. See [Managing domains](https://www.senddart.com/docs/domains/managing). 2. **Pick a plan that fits your volume** — The Free plan is sized for testing and integration work. Upgrade to a paid plan for the monthly volume you need — paid plans have no daily cap. 3. **Warm up gradually** — Ramp volume over days rather than all at once, and keep your bounce and complaint rates healthy — see [Account quotas and limits](https://www.senddart.com/docs/kb/quotas) for the reputation guardrails. --- # How to handle API keys securely > Best practices for SendDart API keys: keep them server-side, scope them to sending, rotate them, and revoke leaked keys. A SendDart API key (it starts with `mb_`) authenticates every request as your account. Treat it like a password: anyone who has it can send email as you and, for a full-access key, manage your domains, audiences, contacts, and campaigns. What no key can do is touch the keys themselves — creating, re-scoping, and revoking keys happen only in the dashboard, so a stolen key can never mint a replacement for itself. The full key is **shown only once** at creation and is stored only as a **hash** afterward — SendDart can never show it to you again. ## Keep keys server-side only - Call the API **from your server**, never from a browser, mobile app, or any other client the user controls — see [How do I fix CORS issues?](https://www.senddart.com/docs/kb/cors). - Never commit keys to source control, embed them in client-side code, or paste them into logs, screenshots, or support tickets. - Store keys in a **secret manager** or environment variable, not in your codebase. > **Warning:** If a key ever appears in client-side code, a public repo, or a shared log, treat it as compromised and revoke it immediately. ## Use the least-privileged scope API keys carry a permission level. Pick the **narrowest** one that does the job: | Permission | Can do | Use for | | --- | --- | --- | | **sending_access** | Send email only. | Any server that only needs to send transactional or marketing email. | | **full_access** | Send email **and** manage domains, audiences, contacts, and campaigns. It can *list* your API keys, but not create, re-scope, or revoke one. | Administrative tooling that genuinely manages resources. | A `sending_access` key is the safe default: even if it leaks, it cannot delete your domains. Neither level can mint new keys — that is dashboard-only for every caller. See [Authentication](https://www.senddart.com/docs/authentication) and [Create an API key](https://www.senddart.com/docs/create-an-api-key). ## Rotate and revoke SendDart API keys **do not expire automatically** — a key stays valid until you revoke it, with no built-in expiry or auto-rotation. Rotating them yourself on a schedule is what keeps a forgotten or leaked key from being a long-lived liability. Rotate **at least every 90 days**, and immediately if you suspect a key is compromised. - **Rotate periodically.** In the dashboard, create a new key, deploy it, then revoke the old one — keys are cheap, so rotate on a schedule and whenever someone with access leaves. - **Revoke leaked keys immediately.** Revoke from the **API Keys** page; it takes effect right away, and subsequent requests with the old key return `403 invalid_api_key`. - **Use separate keys per service** so you can revoke one without disrupting the others. - **Delete stale keys.** If a key has not been used recently, delete it rather than leaving it active — an unused key is just attack surface. Keys idle for 30+ days are flagged in the dashboard to help you find them. ### How to rotate without downtime Both the old and new key work at the same time, so rotate by overlapping them — never delete the old key first. The two key-lifecycle steps happen in the dashboard; the deploy and verify steps in the middle are yours to automate: 1. **Create a new key (dashboard)** — On the **API Keys** page, create a replacement with the **same permission level** and domain restriction as the key you are retiring, and copy the token — it is shown once. See [Create an API key](https://www.senddart.com/docs/create-an-api-key). 2. **Update every service** — Deploy the new key to all environments that reference the old one. 3. **Verify it is working** — Confirm the new key is in use — for example by filtering the [logs](https://www.senddart.com/docs/logs/overview) by API key and checking for recent requests, or by listing your keys with `GET /api-keys` and reading each `last_used_at` — before going further. 4. **Revoke the old key (dashboard)** — Only once the new key is confirmed live everywhere, revoke the old key from the **API Keys** page. Revocation is immediate and irreversible. > **Warning:** Do not delete the old key before the new one is deployed everywhere. Because both keys work simultaneously, verifying the new key first means zero downtime during the transition. > **Warning:** You cannot script the create and revoke steps. `POST /api-keys`, `PATCH /api-keys/:id`, and `DELETE /api-keys/:id` refuse every API-key caller with `403 dashboard_only` — a key may never mint, re-scope, or revoke a key. If you previously automated rotation end to end, split it: a signed-in person creates and revokes in the dashboard, and your automation handles the deploy and verification in between. `GET /api-keys` still works with a full-access key, so the "which keys exist and when were they last used" half of the runbook can stay automated. > **Note:** Manage keys in the dashboard under **API Keys**. Because the full key is shown only once, store it safely at creation time — if you lose it, revoke it and create a new one there. --- # How do I fix CORS issues? > The SendDart API is server-to-server. Calling it from a browser triggers CORS errors and leaks your key — proxy through your own backend instead. If you are seeing CORS errors calling SendDart, it is because the API is **server-to-server** by design. It is not meant to be called directly from a browser, and the fix is not to work around CORS — it is to move the call to your backend. The error usually surfaces in the browser console when you call the API from client-side code, and looks like this: ```text Access to fetch at 'https://www.senddart.com/api/emails' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. ``` ## Why browser calls fail - **It leaks your API key.** Any request from a browser ships your `mb_` key to the user, where it can be read from network tools or page source. Anyone who copies it can send email as you. - **It hits CORS.** The API does not send permissive cross-origin headers for arbitrary web origins, so the browser blocks the response. > **Warning:** Disabling CORS, using a public CORS proxy, or embedding your key in front-end code does not make this safe — it just exposes your key. Never put a SendDart API key in client-side code. ## The fix: proxy through your backend Send from your own server. Your front end calls **your** endpoint (authenticated as your user), and your server — holding the API key in a secret — calls SendDart: **Your backend (Node.js)** ```js // POST /api/contact on YOUR server — the browser calls this, not SendDart. app.post('/api/contact', async (req, res) => { // Validate / authenticate the request as your own user first. const r = await fetch('https://www.senddart.com/api/emails', { method: 'POST', headers: { // Key lives only on the server, in an env var or secret manager. 'Authorization': `Bearer ${process.env.SENDDART_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ from: 'Acme ', to: ['support@acme.com'], subject: 'New contact form submission', text: req.body.message, }), }); res.status(r.status).json(await r.json()); }); ``` This keeps the key out of the browser entirely and sidesteps CORS, because the cross-origin request is now between two servers. See [How to handle API keys securely](https://www.senddart.com/docs/kb/handling-api-keys). --- # How do I keep sensitive data out of SendDart? > What SendDart retains in the email log, and how to avoid putting secrets you do not want stored into subjects and bodies. SendDart keeps a per-email log so you can see delivery status, debug failures, and correlate webhook events. That means the content you put into an email is **retained for a time** as part of that record. Treat anything you send as data SendDart stores, and keep secrets you do not want logged out of it. ## What is retained For each email you send, the log typically retains: - The **envelope**: `from`, `to`, `cc`/`bcc`, and `reply-to` addresses. - The **subject** line. - The message **body** (HTML and/or text) and any custom headers you set. - Delivery **events**: sent, delivered, bounce, complaint, open, and click. ## How to avoid storing secrets - **Do not put raw secrets in the subject or body.** Passwords, full API keys, card numbers, and similar values should never be the literal content of an email. - **Send a link, not the secret.** For password resets, magic links, or one-time access, send a short-lived, single-use URL that resolves to the sensitive value on your own system instead of embedding the value itself. - **Minimize personal data.** Only include the recipient details the message genuinely needs. - **Keep internal identifiers out of the subject.** Subjects are the most visible part of the log; put correlation IDs in custom headers or your own metadata rather than the subject line. > **Warning:** Anything placed in a subject or body may be retained in the email log and visible in the dashboard. If you would not want it stored, do not send it as email content. ## Turning off message-content storage For accounts with stricter compliance needs, SendDart can **turn off storage of message content** — subjects and bodies are not retained in the log, while delivery metadata and events still are. This is offered to established, good-standing senders rather than brand-new accounts, since it relies on a healthy sending history. If your account has a steady sending history and a low bounce rate and you need content storage disabled, **contact support** to have it enabled. --- # How does pricing work? > SendDart pricing is usage-based by emails sent, with a free tier for getting started. SendDart pricing is **usage-based**: you pay based on the number of emails you send. There is a **free tier** for getting started and evaluating the platform, so you can verify a domain and send your first emails without committing to a paid plan. - **Usage-based** — billing scales with emails sent. - **Free tier** — enough to get started, build your integration, and try real sends. - **Quotas come from your plan** — your [monthly sending quota](https://www.senddart.com/docs/kb/quotas) is set by the plan you are on and can be extended with email credits ($0.90 per 1,000). Only the Free plan’s daily cap is a pure anti-abuse safety rail rather than a billing limit — credits never lift it. ## How volume is counted Because billing is by email, it is worth knowing what counts as one. Each recipient is counted individually: multiple `to`, `cc`, or `bcc` addresses on a single message each count as a separate email. Inbound (received) email, if you use it, also counts toward your usage. ## Transactional vs. marketing Pricing reflects the two different ways you send: - **Transactional / API sending** is priced on **emails sent** over a billing period. - **Marketing / campaigns** are typically priced on the **number of contacts** you store rather than the number of messages, since one campaign goes to your whole audience. ## Overages Paid usage can continue beyond your plan’s included volume via **pay-as-you-go overage** rather than failing outright, so an occasional spike does not stop your sending. Overages are convenient for spikes but are generally less cost-effective per email than moving to a higher tier — if you consistently exceed your included volume, the plan page will show the more economical option. > **Note:** For current plans, included volume, overage rates, and prices, see the [pricing page](https://www.senddart.com/pricing) — it is the source of truth for what each tier costs and includes. --- # How do I change my account email? > Change the email address on your SendDart account from your account settings in the dashboard. You change the email address on your SendDart account from **account settings** in the dashboard. This is a dashboard-only action — there is no API endpoint for it. 1. **Open your profile** — Sign in to the dashboard and go to your profile / account settings. 2. **Enter the new email** — Under your email, type the new address in the email field and submit the update. 3. **Confirm from both inboxes** — You are signed out, and a confirmation email is sent to **both** your new and your current address. Click the confirmation link in **each** email to complete the change. 4. **Sign in with the new email** — Once both confirmations are done, log back in using your new email address. > **Warning:** The change is not complete until you confirm from **both** inboxes. Requiring confirmation from the current address as well as the new one prevents someone from hijacking the account if they gain access to only one mailbox. > **Note:** Changing your account email does not affect your API keys, verified domains, or sending — those are tied to the account, not to the login email. --- # How do I delete my account or team? > Delete your SendDart account or team from settings, and what happens to your domains, API keys, and data. You can delete your SendDart account or team from **settings** in the dashboard. This is a dashboard-only action, and it is **permanent** — deletion cannot be undone. ## How to delete 1. **Leave your team** — In settings, leave the team associated with your account first. Account deletion becomes available once you are no longer attached to a team. 2. **Delete the account** — Select **Delete account** and confirm. On confirmation, your account and all account data are deleted. ## What happens when you delete - **API keys are revoked.** Every key on the account stops working immediately; in-flight requests using them will fail with `403 invalid_api_key`. - **Domains are removed.** Your verified domains are detached — you can stop publishing their SendDart DNS records afterward. - **Account data is removed.** Audiences, contacts, campaigns, and the email log associated with the account are deleted per the retention policy. - **Sending stops.** No further email can be sent on the account. > **Warning:** Deletion is permanent. Export anything you need (such as your contacts or send history) before you delete, and make sure no production service is still pointing an API key at the account. ## Before you delete If you only want to stop a single integration, you do not have to delete the whole account — you can [revoke just that API key](https://www.senddart.com/docs/kb/handling-api-keys) instead and leave the account intact. --- # Where can I find documents like DPA or W-9? > Download compliance and tax documents — penetration test attestation, SOC 2 report, DPA, and W-9 — from Settings → Documents in the SendDart dashboard. SendDart keeps your account’s compliance and tax documents in one place in the dashboard, under **Settings → Documents**. This is a dashboard-only area — there is no API endpoint for it — and you must be signed in to your account to access it. ## What’s on the page - **Penetration test** — a Letter of Attestation from the independent third-party security firm that performs SendDart’s annual penetration testing, available to download. - **SOC 2** — SendDart’s SOC 2 Type II report (under the AICPA framework), covering the audited period, available to download. - **DPA** — the Data Processing Agreement governing how SendDart processes data on your behalf. The version here is pre-signed by SendDart and is considered fully executed once you have an account, so no counter-signature is required. - **Form W-9** — provides SendDart’s U.S. taxpayer identification number for vendor onboarding and accounts payable. > **Note:** You must be logged in to your SendDart account to reach the Documents page. --- # Why am I getting a restricted_api_key error? > A 401 restricted_api_key means your API key lacks permission for the action. Here is how to tell that apart from a missing User-Agent header (a 403), an unverified or mismatched domain (a 422), and new-account sending restrictions. A `401 restricted_api_key` means your request authenticated fine — the API key is valid — but the key **does not have permission** for the action you tried. This is the single most common cause: using a **sending-only key** (`sending_access`) to manage resources. ```json { "statusCode": 401, "name": "restricted_api_key", "message": "This API key is restricted to only send emails. Use a full-access key to manage resources." } ``` > **Note:** A `401 restricted_api_key` is about **permissions**, not authentication. A bad or revoked key returns `403 invalid_api_key`, and a missing key returns `401 missing_api_key`. If you are seeing one of those auth errors instead, see [Authentication](https://www.senddart.com/docs/authentication). ## Cause 1 — a sending-only key managing resources API keys come in two permission levels: | Permission | Can do | | --- | --- | | **full_access** | Send email **and** manage resources — domains, audiences, contacts, and campaigns. | | **sending_access** | Send email **only**. Cannot create, update, or delete domains, audiences, contacts, or campaigns. | If you call an endpoint like `POST /domains` or `DELETE /audiences/:id` with a `sending_access` key, you get `401 restricted_api_key`. The fix is to use a `full_access` key for management calls and reserve the `sending_access` key for `POST /emails`. > **Note:** API keys are the exception, and they fail with a **different** error. `POST /api-keys`, `PATCH /api-keys/:id`, and `DELETE /api-keys/:id` return `403 dashboard_only` for **any** API key — upgrading to `full_access` will not help, because creating, re-scoping, and revoking keys is dashboard-only by design. Do it signed in at the **API Keys** page; see [Create an API key](https://www.senddart.com/docs/create-an-api-key). Listing keys with `GET /api-keys` still works with a `full_access` key. > **Warning:** Keeping a narrow `sending_access` key on your sending servers is the **right** security posture — do not "fix" a permission error by upgrading that key. Instead, run management tasks with a separate `full_access` key from a trusted environment. ## Cause 2 — an unverified from-domain (also a 422) A frequent point of confusion: sending from a domain you have not verified returns a `422 validation_error`, because the request body itself is rejected before any permission check on the resource. ```json { "statusCode": 422, "name": "validation_error", "message": "The domain is not verified. Verify it before sending." } ``` You can only send from a domain (or a subdomain of a domain) you have added and verified by publishing its SPF/DKIM/DMARC DNS records. If the `from` address is not even a valid email, you instead get `422 invalid_from_address`. See the full [Errors](https://www.senddart.com/docs/api/errors) reference for every name and status code. > **Warning:** A subtle variant: you verified a **subdomain** (e.g. `sending.yourdomain.com`) but your `from` uses the **root** (`you@yourdomain.com`), or vice-versa. The `from` domain must match a verified domain **exactly**, including the subdomain. Either change the `from` to your verified domain, or add and verify the exact domain you want to send from. ## Cause 3 — new-account sending restrictions A brand-new account starts in a restricted **review mode** until production access is granted. While in review mode: - You can only send to **verified recipient addresses** — sending to an arbitrary recipient is rejected. - Daily send volume and send rate are capped to small starter limits. - Your verified from-domain still works, but the recipient must also be verified. > **Note:** Review-mode rejections surface as send failures rather than a clean permission error. If sends to verified recipients succeed but sends to new addresses fail, your account is almost certainly still in review mode — request production access. See [Usage limits](https://www.senddart.com/docs/api/limits). ## Cause 4 — a missing User-Agent header This one bites people who **hand-roll** HTTP requests (the official [`senddart`](https://www.senddart.com/docs/resources/sdks) SDK sets a `User-Agent` for you, so SDK users never hit this). Every call to the API surface (`/emails`, `/domains`, `/audiences`, `/campaigns`, and the rest) **must** include a `User-Agent` header. A request without one is rejected with a 403 before it reaches the endpoint logic: ```json { "statusCode": 403, "name": "validation_error", "message": "All API requests must include a User-Agent header." } ``` This is confusing because the same request often works from `curl` (which sets a `User-Agent` automatically) but fails from a `fetch`/library call that omits it. The fix is simply to send a descriptive `User-Agent`: **cURL** ```bash curl -X POST 'https://www.senddart.com/api/emails' \ -H 'Authorization: Bearer mb_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -H 'User-Agent: my-app/1.0' \ -d '{ "from": "you@yourdomain.com", "to": "user@example.com", "subject": "Hello", "html": "

Hello

" }' ``` **Node.js** ```javascript await fetch('https://www.senddart.com/api/emails', { method: 'POST', headers: { Authorization: 'Bearer mb_xxxxxxxxx', 'Content-Type': 'application/json', 'User-Agent': 'my-app/1.0', }, body: JSON.stringify({ from: 'you@yourdomain.com', to: 'user@example.com', subject: 'Hello', html: '

Hello

', }), }); ``` > **Note:** The public tracking and webhook-ingest paths are exempt — only the management/sending API surface requires a `User-Agent`. See the [User-Agent](https://www.senddart.com/docs/api/introduction) note in the API introduction. ## Checklist 1. **Confirm the key permission** — If you are calling a management endpoint, use a `full_access` key. A `sending_access` key sending to `POST /emails` is fine; managing domains/audiences/contacts/campaigns with it returns `401 restricted_api_key`. If the endpoint you are calling is an API-key one and the error is `403 dashboard_only`, no key will work — do it in the dashboard. 2. **Send a User-Agent header** — If you get a `403 validation_error` mentioning User-Agent, your HTTP client is omitting the header. Add a descriptive `User-Agent` to every request. 3. **Verify the from-domain** — If you are sending and the error is `422 validation_error` about the domain, finish DNS verification first — and make sure the `from` matches your verified domain exactly (subdomain included). That is a separate problem from a permission error. 4. **Check production access** — If sends only work to verified recipients, request production access to leave review mode. --- # It says delivered but the recipient didn't get it > A delivered event means the receiving mail server accepted the message — not that it reached the inbox. Here is where a "delivered but missing" email usually ends up. A `delivered` event means **the receiving mail server accepted the message** and returned a `250 OK` success code over SMTP. That is the furthest point we can observe: once the recipient's server takes the message, it may file it in the inbox, queue it for later, route it to spam, or even discard it — and what happens next (a forwarding rule, a filter, a quarantine) is entirely on their side and is **not** reported back to us. Any later event (open, click, unsubscribe) requires the recipient to actually engage. > **Note:** `delivered` = accepted by the destination server. It is **not** a read receipt and **not** a guarantee the message reached the visible inbox. ## Where a "delivered" email usually is ### Spam or quarantine The most common landing spot. The server accepted the message (so it counts as delivered) and then filed it in the **Spam/Junk** folder, or held it in an **admin quarantine** that the user never sees. Ask the recipient to check Spam/Junk, and — on corporate accounts — to ask their admin to check the quarantine and release/allowlist your sender. ### Aliases and forwarding If the address is an **alias** or **forwarder** (e.g. `team@` redirecting to several mailboxes, or a personal address forwarding to another provider), delivery to the first hop succeeds, but the forward to the final mailbox can be silently filtered or broken by SPF/DKIM alignment loss on the second hop. Confirm the real destination mailbox and test sending to it directly. ### Provider-side filtering rules User-created **mail rules** (filters that auto-archive, delete, or move messages by sender/subject) and organization-wide policies can move an accepted message out of the inbox immediately. Have the recipient search **all folders** (including Archive, Trash, and any custom folders) for your subject or from-address. ## How to diagnose 1. **Check the email log** — Open the email by its `id` in the dashboard (or via [retrieve email](https://www.senddart.com/docs/api/emails-get)). A `delivered` event with no `bounce` or `complaint` confirms the destination server accepted it. 2. **Have the recipient search everywhere** — Spam/Junk, Archive, Trash, and custom folders — search by your from-address, not just the subject. 3. **Check aliases/forwarding** — If the address forwards elsewhere, send a direct test to the final mailbox to isolate the second hop. 4. **Ask about quarantine** — On business email, the admin quarantine is invisible to the user. Have them ask IT to check it and allowlist your domain. ## If you can reach the recipient The fastest fix is to have the recipient look in the likely hiding spots and, if they find your message, mark it **Not Spam** or add your domain to their allowlist: - Corporate spam filters or firewalls - Personal inbox filtering rules - Promotional, spam/junk, or deleted folders - Group inboxes or shared queues ## Improve your odds next time When you can't reach the recipient, you can still raise the chance the next message lands in the inbox: - **Publish DMARC** to build trust with the receiving provider — see [DNS records](https://www.senddart.com/docs/domains/dns). - **Warm up new domains** slowly before sending large volumes — see the [warm-up guide](https://www.senddart.com/docs/kb/warm-up). - **Align link domains** with your sending domain (avoid shorteners and unrelated link hosts). - **Turn off open/click tracking** for streams where placement matters most — tracking can read as promotional. - **Reduce images** and trim the body; succinct, balanced HTML scores better than heavy marketing layouts. > **Warning:** If messages land in Spam consistently (not just once), it is a **deliverability** problem, not a one-off. Tighten SPF/DKIM/DMARC alignment, warm up the domain, and clean your list. See [Deliverability](https://www.senddart.com/docs/kb/why-spam). --- # Why aren't my open rates accurate? > Open tracking relies on a 1x1 pixel, which modern mail clients distort in both directions. Treat opens as a directional signal, not an exact count. Open tracking works by embedding a **1×1 tracking pixel** (a tiny image) in the email. An "open" is recorded when that pixel is fetched. The problem: modern mail clients fetch — or refuse to fetch — that pixel in ways that have little to do with whether a human actually read your message. Opens are inflated by some clients and undercounted by others, so treat the number as **directional**, not exact. > **Note:** Use opens to compare campaigns against each other (is this subject line trending up or down?), not as a literal headcount of readers. **Clicks** are a far more reliable engagement signal. ## Why opens get inflated ### Apple Mail Privacy Protection (MPP) When a recipient uses Apple Mail with **Mail Privacy Protection** enabled, Apple **pre-fetches every image — including the tracking pixel — on Apple's servers, for every message, whether or not the user opens it.** This both **inflates** opens (messages register as "opened" that were never read) and **obscures** them (the fetch comes from an Apple proxy with a generic location/user-agent, so you cannot trust the open's timing or geography). A large share of opens from Apple Mail audiences are MPP artifacts. ### Security scanners and link previewers Corporate mail gateways and antivirus scanners (Mimecast, Proofpoint, Barracuda, Microsoft Defender / "Safe Links", Symantec, Sophos, Trend Micro, and similar) fetch every image **and** follow every link at **delivery time**, before any human sees the message. Counting those would log a phantom open (and phantom click) for essentially every message. ## Why opens get undercounted Many recipients have **images turned off** by default, or read in plain-text/preview panes that never load the pixel. Those people may genuinely read (and even click) your email while never registering an open. So the true number of readers is almost always **higher** than the open count for image-off audiences. ### Gmail clips messages over 102KB Gmail **clips** any message larger than **102KB**, hiding the tail of the email behind a "View entire message" link. Because the tracking pixel typically sits at the bottom, a clipped message **does not register an open** unless the recipient expands the full message. Keep your HTML well under 102KB to avoid silently losing opens (and clipped content). ### Plain-text-only emails are never tracked Open tracking depends on the 1×1 pixel, which only exists in an **HTML** body. An email sent with **only a plain-text version** has nowhere to put the pixel, so it can never record an open at all — even though the recipient may read it fully. ## How SendDart filters opens To keep opens as meaningful as possible, SendDart applies two filters before recording an open: - **Scanner / prefetch filtering** — pixel hits from known corporate scanners and antivirus gateways (Mimecast, Proofpoint, Barracuda, Microsoft "Safe Links" / "Existence Discovery", Defender, Symantec, Forcepoint, Sophos, Trend Micro, BitDefender, and more) are **dropped** as machine fetches, never humans. - **Prefetch window** — known scanner user agents are discarded at any time. Ordinary clients have a short, configurable delivery-time guard (10 seconds by default); Gmail and Yahoo image-proxy fetches count immediately because the proxy commonly caches its one human-triggered fetch. - **Webmail image proxies count.** Gmail (`GoogleImageProxy`) and Yahoo (`YahooMailProxy`) fetch and cache images on **their** servers only when the message is actually **displayed** by a human — so, past the prefetch window, a proxy hit is a genuine open signal and is counted. (Earlier behavior that discarded these meant Gmail/Yahoo opens never registered at all.) > **Warning:** No filter can undo Apple Mail Privacy Protection: MPP fetches look like legitimate post-window opens, so audiences heavy on Apple Mail will still show inflated open rates. Lean on **clicks** and on **relative** open trends, not absolute open counts. ## Tracking can also hurt placement Open tracking does not affect whether a message is *delivered*, but it can affect *where* it lands. Trackers are heavily associated with marketers and spammers, so inbox providers may treat a tracked message as promotional and file it accordingly. For **transactional** mail, where inbox placement matters most, consider disabling open tracking entirely. ## What to do - Compare open rates **between** your own campaigns rather than against an absolute target. - Weight **click-through** and replies more heavily than opens when judging engagement. - Track impact **outside the inbox** too — page visits, signups, conversions — since email is usually a means to an end. - Disable open tracking on transactional streams to protect placement. - For list hygiene, treat "no opens AND no clicks over many sends" as the unengaged signal — not opens alone. --- # Opportunistic vs enforced TLS > TLS encrypts email in transit between mail servers. Opportunistic TLS prioritizes delivery; enforced TLS prioritizes confidentiality. Here is the tradeoff. TLS (Transport Layer Security) encrypts an email **in transit** as it travels from the sending mail server to the receiving mail server over SMTP. Whether that encryption is best-effort or mandatory is the difference between **opportunistic** and **enforced** TLS — and it is a real tradeoff between getting the mail delivered and guaranteeing it was encrypted. > **Note:** For SMTP connections, the supported protocol versions are **TLS 1.2, TLS 1.1, and TLS 1.0** — the receiving server negotiates the highest version both sides support. ## Opportunistic TLS With **opportunistic** TLS, the sending server **tries** to negotiate an encrypted connection (via STARTTLS). If the receiving server supports TLS, the message is encrypted in transit. If the receiving server does not support TLS — or the handshake fails — the sender **falls back to plaintext** and delivers the message anyway. - **Delivery first.** The message is almost never blocked for a TLS reason; it goes through encrypted when possible, plaintext when not. - **No guarantee of confidentiality.** A silent downgrade (including an active downgrade attack that strips STARTTLS) leaves the message in cleartext, and you would not know. - This is the **default** behavior across most of the internet's mail, and what SendDart uses for normal sending so legitimate mail is not bounced by a receiver with a weak or misconfigured TLS setup. ## Enforced TLS With **enforced** (required) TLS, encryption is **mandatory**. If the receiving server cannot negotiate a valid TLS connection, the message is **not delivered** — it is deferred or bounced rather than sent in plaintext. - **Confidentiality first.** The message is never transmitted unencrypted; a downgrade attack causes a delivery failure instead of a silent leak. - **Delivery can fail.** Any receiver with no TLS, an expired certificate, or a misconfigured handshake will reject your mail — so enforced TLS can cause bounces that opportunistic TLS would have delivered. - Appropriate for **sensitive or regulated** mail (e.g. healthcare, finance) where leaking content in transit is worse than a bounce, often paired with **MTA-STS** and **TLS-RPT** so receivers advertise and you monitor TLS enforcement. ## Which should I use? | | Opportunistic TLS | Enforced TLS | | --- | --- | --- | | Priority | Maximize delivery | Guarantee confidentiality | | If receiver has no/broken TLS | Sends in plaintext anyway | Fails (defer/bounce) | | Downgrade attack | Can silently strip encryption | Delivery fails instead of leaking | | Best for | General transactional & marketing mail | Sensitive / regulated communications | > **Note:** For most senders, **opportunistic TLS is the right default** — it encrypts the vast majority of mail in practice without sacrificing delivery. Reach for enforced TLS only when a confidentiality requirement outweighs the risk of bounced mail to receivers with poor TLS support. --- # What attachment types aren't supported? > Attachments are capped at 25 MB per file and 40 MB total, and executable/dangerous file types are widely rejected by receiving providers. Link to large or risky files instead. Attachments are supported on `POST /emails`, but two things commonly cause failures: **size limits** and **blocked file types**. Both matter because even an attachment SendDart accepts can be stripped or quarantined by the **receiving** mail provider. ## Size limits SendDart enforces these caps and rejects the send if either is exceeded: | Limit | Value | | --- | --- | | Per attachment (single file) | up to **25 MB** | | Total of all attachments per email | up to **40 MB** | These apply whether you supply the file inline as base64 `content` or as a hosted `path` URL that SendDart fetches. For a `path`, an oversized file is rejected up front using its `Content-Length`, and again after download if the actual size exceeds the cap. > **Warning:** These caps are about what SendDart will accept. Remember that **base64 encoding inflates a file by roughly 33%**, and many receiving inboxes enforce their own total-message limit (Gmail ~25 MB, Outlook ~20 MB). A message that is technically under our cap can still bounce on the receiving end. ## Blocked / risky file types There is no benefit to attaching an **executable or script** file — virtually every major provider (Gmail, Outlook/Microsoft 365, Yahoo, and corporate gateways) **blocks or quarantines** these regardless of what the sending platform allows. Common examples that are routinely rejected: - Executables and installers — `.exe`, `.msi`, `.bat`, `.cmd`, `.com`, `.scr`, `.app`, `.dmg` - Scripts — `.js`, `.vbs`, `.ps1`, `.sh`, `.jar`, `.py` - Office documents with **macros** — `.docm`, `.xlsm`, `.pptm` - Archives that hide the above — `.zip` / `.rar` / `.7z` containing blocked types are often stripped too Files with no declared or recognizable MIME type fall back to `application/octet-stream`, which spam filters tend to treat with extra suspicion — so even an otherwise-fine binary can hurt deliverability. ### Full list of blocked send extensions For completeness, the following extensions are blocked for **sending** (you can still **receive** any of them). The list is the standard set of executable, script, and dangerous types rejected across providers: | | | | | | | --- | --- | --- | --- | --- | | .adp | .app | .asp | .bas | .bat | | .cer | .chm | .cmd | .com | .cpl | | .crt | .csh | .der | .exe | .fxp | | .gadget | .hlp | .hta | .inf | .ins | | .isp | .its | .js | .jse | .ksh | | .lib | .lnk | .mad | .maf | .mag | | .mam | .maq | .mar | .mas | .mat | | .mau | .mav | .maw | .mda | .mdb | | .mde | .mdt | .mdw | .mdz | .msc | | .msh | .msh1 | .msh2 | .mshxml | .msh1xml | | .msh2xml | .msi | .msp | .mst | .ops | | .pcd | .pif | .plg | .prf | .prg | | .reg | .scf | .scr | .sct | .shb | | .shs | .sys | .ps1 | .ps1xml | .ps2 | | .ps2xml | .psc1 | .psc2 | .tmp | .url | | .vb | .vbe | .vbs | .vps | .vsmacros | | .vss | .vst | .vsw | .vxd | .ws | | .wsc | .wsf | .wsh | .xnk | | > **Note:** These restrictions apply only to **sending**. Inbound/received mail can carry any of these types. ## Recommended: link, don't attach For anything large, risky, or executable, **host the file and send a link** instead of attaching it. This keeps you under size limits, avoids type-based blocking, lets you update or revoke the file later, and improves deliverability. 1. **Host the file** — Upload to your own storage (S3, a CDN, a file-sharing service) and get a stable URL. 2. **Link in the email body** — Include a clear download link in the HTML instead of an attachment. 3. **For supported attachments, use a clean type** — PDFs, images (PNG/JPG), and CSV/plain-text files are safe to attach within the size caps. > **Note:** For the exact request fields, base64 vs hosted-`path` handling, and per-file/total caps, see [Attachments](https://www.senddart.com/docs/emails/attachments). ---