Send an email
Queues an email from the API key's environment and returns it with status: "queued"; it is handed to the delivery provider moments later. Follow it with GET /v1/emails/{id} or the email.sent / email.failed webhooks. Live (coss_live_…) keys must send from a verified domain of the organization. Sandbox (coss_test_…) keys accept any from and never deliver anything; the response has sandbox: true. Recipients on the environment's suppression list (for every email, or for the email's category) are skipped and get the status suppressed. With a future scheduled_at the email is stored with the status scheduled and sent at that time; the domain and the suppression list are checked again then. Attachments are base64-encoded; only metadata is kept after sending. Recipients count against the organization's send quota (per second and per day; sandbox environments have their own daily quota). With open or click tracking on (the environment's settings, or tracking), the HTML body is delivered with a tracking pixel and/or links rewritten to coss.com redirects; the stored html stays as sent.
bearerAuthAuthorizationBearer <token>A secret API key from the dashboard: coss_live_… for production environments, coss_test_… for sandbox environments.
Idempotency-Key?stringMakes retries safe: a repeated request with the same key and body returns the original email (with its current status) instead of sending again, for 24 hours. 1-256 characters.
1 <= length <= 256Coss-Version?"2026-10-10"The API version (a date) to use for this request. Defaults to your organization's version, pinned to the latest one when it first used the API and upgraded from the dashboard. The SDK always sends the version it was built for.
"2026-10-10"application/json- body
- body
- …
from*stringAn email address, optionally with a display name: "Acme hello@acme.com".
to*|array<>Who it goes to.
cc?|array<>Who it's copied to.
bcc?|array<>Who it's blind copied to.
reply_to?|array<>Where replies go.
subject?stringRequired unless the email is sent from a template (template_id).
1 <= length <= 998html?stringHTML body. Provide html, text, or both.
text?stringPlain-text body. Without it, an html email goes out with a text part generated from the HTML.
template_id?stringSend a published email template (its id or alias) instead of subject, html and text.
1 <= length <= 100template_version?integerA published version of the template to send. Defaults to the latest one.
1 <= valuelocale?stringThe template locale to send, e.g. "pt-BR". Falls back to the language ("pt"), then to the template's default locale.
length <= 35variables?Values for the template's variables, keyed by name.
headers?Up to 15 custom headers. Names are case-insensitive.
tags?array<>Your tags on the email.
items <= 50category?stringWhat kind of email this is, e.g. "marketing". Recipients suppressed for this category (or for every email) are skipped.
^[A-Za-z0-9_-]{1,256}$scheduled_at?stringSend the email at this time instead of now (ISO 8601 with an offset, at most 30 days ahead). A time that is not in the future sends immediately. Scheduled emails can be rescheduled or canceled until they are sent.
date-timeattachments?array<>Up to 20 files, at most 25 MB combined.
items <= 20tracking?Overrides the environment's tracking settings (its default, or the rule for this email's category) for this email. Omitted fields keep the configured setting.
stream?stringtransactional (the default) or marketing. Marketing email goes out on its own sending infrastructure and reputation, so its complaints never hold up transactional mail. It needs the environment's postal address (marketing settings), exactly one recipient, and no List-Unsubscribe header: coss.com adds one-click unsubscribe headers and a footer with the address and an unsubscribe link (place them yourself with {{{unsubscribe_url}}}, {{{preferences_url}}} and {{{mailing_address}}}). Contacts who unsubscribed are skipped.
"transactional""marketing"subaccount?stringSend for one of your sub-accounts (email for platforms): its id (sub_…) or your uid for it. The email then counts toward its quotas and reputation, skips its suppressions (and the environment's), and must come from one of its domains or a domain you share with sub-accounts. Transactional email only.
1 <= length <= 256The email, accepted for delivery (queued or scheduled). A replay returns the original email with its current status.
application/json- response
- response
- …
object*"email""email"id*stringfrom*stringWho it's sent from.
to*array<string>The To addresses.
cc*array<string>The Cc addresses.
bcc*array<string>The Bcc addresses.
reply_to*array<string>The Reply-To addresses.
subject*stringThe subject, rendered if it came from a template.
html*|The HTML part. null: none, or the body was discarded.
text*|The plain text part. null: none, or the body was discarded.
headers*The custom headers it was sent with.
tags*array<>Your tags on the email.
category*|The email's category, which suppressions and tracking rules can scope to. null: none.
stream*stringtransactional or marketing.
"transactional""marketing"status*stringWhether the email was handed to the delivery provider. scheduled emails wait for scheduled_at; canceled ones were canceled before that. Per-recipient delivery is in recipients.
"queued""sent""failed""scheduled""canceled"failure*|Why the email failed; null unless status is failed.
recipients*array<>Each recipient, with how delivery to them went.
attachments*array<>Attachment metadata. Content is never returned, and is discarded once sent.
sandbox*booleanTrue when sent from a sandbox environment (never delivered).
tracking*Open and click tracking, as resolved when the email was sent, with engagement so far. Opens can be inflated by mail clients that prefetch images, clicks by link scanners.
created_at*stringdate-timesent_at*|When it was handed to the provider. null: not yet.
date-timescheduled_at*|When the email was scheduled to be sent; null if it was not.
date-timebatch_id*|The batch that sent the email; null if it was sent on its own.
template*|The template the email was rendered from; null if it was sent without one.
broadcast_id*|The broadcast the email is part of; null for any other email.
subaccount_id*|The sub-account the email was sent for; null if it was sent for none.
content_storage*Whether coss.com keeps the email's content after sending it.
import { Coss } from "coss";const coss = new Coss({ apiKey: process.env.COSS_API_KEY, baseUrl: "https://api.coss.com",});const { data, error } = await coss.email.send({ from: "Acme <onboarding@acme.com>", to: "user@example.com", subject: "Welcome to Acme", html: "<p>Thanks for signing up!</p>", tags: [ { name: "template", value: "welcome", }, ], category: "onboarding",});{ "object": "email", "id": "email_01k7c8m4q2f3e9v6t5r1n0p8yz", "from": "Acme <onboarding@acme.com>", "to": [ "user@example.com" ], "cc": [], "bcc": [], "reply_to": [], "subject": "Welcome to Acme", "html": "<p>Thanks for signing up!</p>", "text": null, "headers": {}, "tags": [ { "name": "template", "value": "welcome" } ], "category": "onboarding", "stream": "transactional", "status": "sent", "failure": null, "recipients": [ { "address": "user@example.com", "type": "to", "status": "delivered", "last_event_at": "2026-10-10T12:00:02.000Z" } ], "sandbox": false, "tracking": { "opens": false, "clicks": false, "unsubscribe": false, "open_count": 0, "first_opened_at": null, "last_opened_at": null, "click_count": 0, "first_clicked_at": null, "last_clicked_at": null }, "attachments": [], "created_at": "2026-10-10T12:00:00.000Z", "sent_at": "2026-10-10T12:00:01.000Z", "scheduled_at": null, "batch_id": null, "template": null, "broadcast_id": null, "subaccount_id": null, "content_storage": { "mode": "store", "discarded_at": null }}