# coss.com > One API key and one SDK for transactional and marketing email, inboxes for AI agents, SMS, Verify (one-time codes by SMS or email), Sign (e-signatures), Forms (hosted form endpoints), Scheduling (bookings and calendars), Hooks (webhooks as a service for your own users) and Risk (sign-up, login and payment risk decisions, and rate limiting). These docs are written for people and coding agents alike. ## Reading these docs - Every page is Markdown at its URL plus `.md`, as linked below (the docs home is https://coss.com/docs/index.md). Fetch the pages you need rather than guessing. - API reference pages (https://coss.com/docs/api-reference/…) give each operation's method and URL, parameters, request body, responses and errors, with TypeScript, HTTP, Python, Go, Ruby, PHP, Java and .NET examples. The OpenAPI 3.1 document is https://api.coss.com/openapi.json. - This file lists the guides. API operations have indexes of their own: each product below links its own, and https://coss.com/docs/api-reference/llms.txt has them all. - https://coss.com/llms-full.txt is every guide in one file (over 1 MB), with one short entry per API operation. - Claude Code plugin, an Agent Skill for other agents, and the MCP server: https://coss.com/docs/agents.md. ## Adding coss.com to a project 1. **Get a development API key.** In the project's directory, run `npx coss-cli init` and tell the user to expect a browser window: it opens the coss.com dashboard, where they sign in and approve a key for this project (it waits up to 5 minutes). It then writes the key to `.env.local` (Next.js) or `.env` as `COSS_API_KEY`, and installs the `coss` package in JavaScript projects. A key already in that file is kept: check it starts with `coss_test_` (`--force` replaces it). Where no browser can open (over SSH, in a container or a cloud sandbox) it prints a link and waits for a code typed into the terminal, so ask the user to run it there themselves. It writes a short version of these notes into the project's AGENTS.md (`--no-agents` skips that) and prints the one next step for this key, including the drop-in when the project already uses Nodemailer, Better Auth, Auth.js, Laravel, Rails or Django. See https://coss.com/docs/cli.md. 2. **Build and test with that key.** Development keys (`coss_test_…`) work with every API, record every email and SMS with their events and webhooks, and deliver nothing; the simulator addresses and numbers produce bounces, complaints and failures (https://coss.com/docs/environments.md). Never ask for a live key (`coss_live_…`) to develop with: going live (a verified domain, a registered number, a production key) is the user's step, in the dashboard. 3. **Use the SDK.** TypeScript: `import { Coss } from "coss"`; `new Coss()` reads `COSS_API_KEY`. Every method returns `{ data, error }` and never throws for API or network failures, so check `error` (`type`, `code`, `message`, and `hint` when it names the fix); retries are automatic and safe (an `Idempotency-Key` on every POST). See https://coss.com/docs/quickstart.md and https://coss.com/docs/sdk.md. Python, Go, Ruby, PHP, Java and .NET SDKs: https://coss.com/docs/sdks.md. Nodemailer, Better Auth, Auth.js, Laravel, Rails and Django: https://coss.com/docs/integrations.md. An agent that needs its own email address gets one with `coss.inboxes.create()`: mail to it arrives as threads with an `inbox.message.received` webhook, and it replies with `coss.inboxes.messages.reply()` (https://coss.com/docs/inboxes.md). 4. **Receive webhooks.** Verify every request with `verifyWebhook(rawBody, headers, secret)`, which throws on a bad signature (https://coss.com/docs/sdk/webhooks.md; events: https://coss.com/docs/webhooks.md). Locally, `npx coss-cli listen --forward-to localhost:3000/` forwards the environment's events to the handler and writes `COSS_WEBHOOK_SECRET` into the same env file as the key. `npx coss-cli webhooks add ` registers an endpoint and writes that secret (replacing a listen secret, so both sign the same way). `npx coss-cli trigger ` sends a sample one. These commands use the CLI's own sign-in (`npx coss-cli login`, approved like `init`) or `COSS_API_KEY` in their environment. 5. **Check what happened.** `npx coss-cli logs tail` follows the environment's API requests and events, and `npx coss-cli emails diagnose ` explains a delivery. The MCP server (`npx -y coss-mcp`, https://coss.com/docs/mcp.md) reads a development key from the project env file when its own environment has none. Call `get_setup` before writing send code, and `diagnose_email` to explain a delivery. It also searches these docs, and has tools for marketing, Verify, Sign, Forms, Scheduling, Hooks and Risk; `npx coss-cli --help` lists the same products' commands. # Audit log (/docs/audit-log) Your organization has one audit log. It records changes, not reads: | Actor (`actor_type`) | Changes | | -------------------- | ---------------------------------------------------------------------------------------- | | `user` | Made by a member in the dashboard: API keys, domains, members, invitations, settings… | | `api_key` | Made with an API key: domains, webhook endpoints, suppressions, canceled emails… | | `system` | Made by coss.com support, shown as `coss.com support` (for example suspending the organization) | Each event has an `action` (`.`, e.g. `api_key.created`, `domain.deleted`, `member.role_changed`), the target it changed, and the project and environment it happened in (`null` for organization-wide changes such as domains and members). Changes made through the API carry the request's `request_id` in their `metadata`, so you can find the request in the environment's [logs](/docs/logs). Owners and admins can open **Settings → Audit log** in the dashboard to filter events and export them as CSV. Or read them through the API: ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // ---cut--- const { data, error } = await coss.auditEvents.list({ action: ["domain.", "api_key.created"], from: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), }); for (const event of data?.data ?? []) { console.log(event.created_at, event.actor_label, event.action, event.target_label); } ``` An `action` ending in `.` matches every action of that resource (`domain.`). Pages are newest first: pass the last event's `id` as `after` while `has_more` is true. The audit log is organization-wide: an API key of any environment, live or sandbox, reads every event of the organization. A member's personal key can only read it while its owner's role can (owners and admins). Reading it is not itself logged, and its events never appear in an environment's logs. # Plans and billing (/docs/billing) Every organization is on a plan. A paid plan's monthly fee is **usage credit**: it is spent on usage of any coss.com product, so a month costs the larger of the fee and your usage (plus any add-ons). The Free plan has no credit but includes a monthly allowance. | | Free | Pro | Scale | Enterprise | | --- | --- | --- | --- | --- | | Price | Free | $25/month | $250/month | From $2,000/month, annual commitment | | Included | 3,000 email recipients a month, 1,000 MB of email attachments a month, 3,000 received emails a month, 1,000 MB of received email data a month, 1,000 form submissions a month, 1,000 MB of form uploads a month, 100 scheduling bookings a month, 5 signature requests completed requests a month, 3 inboxes, 100 risk phone checks a month, 50,000 hooks messages a month, 10,000 risk assessments a month, 10,000 risk content checks a month, 3 Scheduling hosts | $25 of usage, 3 inboxes, 100 risk phone checks a month, 500,000 hooks messages a month, 50,000 risk assessments a month, 100,000 risk content checks a month, 25 Scheduling hosts | $250 of usage, 3 inboxes, 100 risk phone checks a month, 5,000,000 hooks messages a month, 500,000 risk assessments a month, 1,000,000 risk content checks a month, 100 Scheduling hosts | Per contract | | Support response target | 3 business days | 1 business day | 4 business hours | 2 business hours | | Urgent issues | Not included | 4 business hours | 1 business hour | 1 business hour | | Usage beyond it | Not available | Usage rates below | Usage rates below | Contract rates | | Sending rate | 2 emails a second, 3,000 a day | 14 emails a second, 100,000 a day | 50 emails a second, 1,000,000 a day | Custom | | SMS rate | Sandbox only | 10 SMS segments a second, 10,000 a day | 30 SMS segments a second, 100,000 a day | Custom | | Marketing rate | 2 marketing emails a second | 10 marketing emails a second | 50 marketing emails a second | Custom | | Scheduling slot rate | 5 slot lists or searches a second | 25 slot lists or searches a second | 100 slot lists or searches a second | Custom | | Domains | 1 | 10 | 100 | Custom | | Team members | 3 | 10 | Unlimited | Unlimited | | Webhook endpoints per environment | 2 | 10 | 10 | Custom | | Contacts per environment | 1,000 | 50,000 | 250,000 | Custom | | SMS phone numbers | 0 | 5 | 50 | Custom | | Inboxes | 3 | 1,000 | 10,000 | Custom | | Email sub-accounts | 0 | 0 | 1,000 | Custom | | Scheduling hosts | 3 | 25 | Unlimited | Custom | | Hosts per availability search | 5 | 25 | 500 | Custom | | Seats per group session | 10 | 50 | 10,000 | Custom | | Custom tracking domains | — | Yes | Yes | Yes | | Audit log | — | Yes | Yes | Yes | | Log drains | — | — | Yes | Yes | | Single sign-on (SAML, OIDC) | — | — | Yes | Yes | | Directory sync (SCIM) | — | — | — | Yes | | Dedicated IPs | — | — | Add-on | Add-on | | Email for platforms (sub-accounts) | — | — | Yes | Yes | | Calendar delegations | — | — | Yes | Yes | | Scheduling holds | — | Yes | Yes | Yes | | Scheduling host portal | — | — | Yes | Yes | | Scheduling attribute routing | — | — | Yes | Yes | | Scheduling pages without coss.com's name | — | — | Yes | Yes | | Bring-your-own OAuth apps for Scheduling | — | — | Yes | Yes | | HIPAA mode with a BAA | — | — | — | By contract | See what your volume would cost on the [pricing page](/pricing). Enterprise plans are sold as annual contracts: custom rates, committed volumes, invoicing with payment terms, and direct debit. [Contact sales](mailto:sales@coss.com). ## Usage [#usage] Usage is counted per product and billed at these rates: | Product | Rate | | | --- | --- | --- | | Email | $0.40 per 1,000 recipients for the first 1,000,000; $0.30 per 1,000 recipients from 1,000,001 to 10,000,000; $0.22 per 1,000 recipients beyond 10,000,000 | | | Email via dedicated IPs | $0.10 per 1,000 recipients | With the Dedicated IPs add-on, on top of Email | | Email attachments | $0.25 per 1,000 MB | Attachments past each email's first 1 MB, per recipient; rounded up to the MB per email | | Received email | $0.40 per 1,000 emails for the first 1,000,000; $0.30 per 1,000 emails from 1,000,001 to 10,000,000; $0.22 per 1,000 emails beyond 10,000,000 | Mail flagged as spam or carrying a virus is free | | Received email data | $0.75 per 1,000 MB | Received messages past their first 1 MB, with the same mail free; rounded up to the MB per email | | Inboxes | $0.99 per 30 inbox-days for the first 3,100; $0.24 per 30 inbox-days from 3,101 to 31,000; $0.045 per 30 inbox-days beyond 31,000 | 30 inbox-days are an inbox for a month, charged by the day; every plan includes 3 inboxes | | SMS (US) | $0.0142 per segment | | | SMS (other countries) | $0.022 to $0.1134 per segment | By country: coss.com/pricing#sms | | SMS received (US) | $0.016 per segment | | | SMS received (other countries) | $0.0104 to $0.0104 per segment | By country: coss.com/pricing#sms | | SMS phone numbers (local) | $1.15 per number-month | | | SMS phone numbers (toll-free) | $2.15 per number-month | | | SMS registration fees (brand registration) | $4.50 | Passed through at cost | | SMS registration fees (brand vetting) | $41.50 | Passed through at cost | | SMS registration fees (campaign vetting) | $15.00 | Passed through at cost | | SMS registration fees (campaign, monthly) | $10.00 | Passed through at cost | | SMS registration fees (low-volume campaign, monthly) | $1.50 | Passed through at cost | | Signature requests | $0.50 per completed request | | | Risk phone | $0.01 per check | | | Risk assessments | $1.00 per 1,000 assessments for the first 1,000,000; $0.50 per 1,000 assessments from 1,000,001 to 10,000,000; $0.25 per 1,000 assessments beyond 10,000,000 | Live API calls. Blocked decisions and replays are free | | Risk content checks | $0.25 per 1,000 checks | Classify on its own; content in an assessment is part of its price | | Verifications | $0.05 per verification | | | Verification SMS (US) | $0.0142 per segment | | | Verification SMS (other countries) | $0.022 to $0.1134 per segment | By country: coss.com/pricing#sms | | Form submissions | $1.00 per 1,000 submissions | | | Form uploads | $0.25 per 1,000 MB | The files of accepted submissions, kept 90 days; rounded up to the MB per submission | | Scheduling | $0.10 per booking | | | Scheduling hosts | $0.99 per 30 host-days | 30 host-days are a host for a month, charged by the day from January 2027, beyond what your plan includes | | Hooks | $0.10 per 1,000 messages | One per message whatever its fan-out; retries, recoveries and test sends are free | - **Email** is counted per recipient handed to the email provider: every address in `to`, `cc` and `bcc` once, except suppressed addresses. Emails that fail before sending, or are canceled, cost nothing. Sandbox environments are never billed. - **Email attachments** are counted in MB, past the first 1 MB of each email's attachments and rounded up, for each recipient the email is billed for: 3.5 MB of attachments to 2 recipients is 6 MB. - **Received email** is counted per message stored, once for each environment it reaches (sandbox environments too: they receive real mail). Mail flagged as spam or carrying a virus, mail dropped over a limit and the dashboard's test emails cost nothing. - **Received email data** is counted in MB, past the first 1 MB of each raw message and rounded up, once for each environment it reaches. What's free above is free here too. - **Inboxes** are counted per day each live inbox exists, starting when it's created: 30 inbox-days are an inbox for a month. Sandbox inboxes are free. See [inboxes](/docs/inboxes#pricing). - **SMS** is counted per segment, by destination country, once a message reaches a carrier; received messages by the receiving number's country. Phone numbers and US carrier registration fees are passed through at cost. SMS needs a paid plan: see [countries and pricing](/docs/sms/countries-and-pricing). - **Volume pricing is graduated**: each band is priced at its own rate, so there's no cliff. With 2,000,000 emails in a month, the first 1,000,000 cost $0.40 per 1,000 and the next 1,000,000 $0.30 per 1,000: $700. - Usage is counted in calendar months (UTC), and the bands start over each month. ## How a month is billed [#how-a-month-is-billed] Your plan's fee is charged at the start of each month, and becomes that month's credit. At the end of the month, its usage is rated, the credit is applied, and anything beyond it is charged on the next month's invoice with the next fee. For example, on Pro with 2,000,000 emails in October: | | | | --- | --- | | October fee (charged October 1) | $25.00 | | October usage | $700.00 | | October credit | -$25.00 | | **Charged November 1 (with November's $25 fee)** | **$675.00** | Over the month you paid $700: the larger of the fee and the usage. ### Charges during the month [#charges-during-the-month] Usage beyond your credit doesn't always wait for the month's end. When usage not invoiced yet reaches your **billing threshold**, it's charged to your payment method right away, as an invoice of its own (`threshold`), and comes off the month's invoice, which still shows the whole month's usage. You pay for it once, at the same rates. New accounts start with a threshold of $100. It's a fifth of your [credit limit](#credit-limit), up to $5,000, so it rises with the limit. Contracts and net terms aren't charged this way. ## Add-ons [#add-ons] Add-ons are charged on top of your plan, and aren't paid by its usage credit: | Add-on | Price | Plans | | | --- | --- | --- | --- | | Dedicated IPs | $50/month | Scale, Enterprise | Your own sending IPs, managed and warmed up automatically. Email sent through them is also metered. | Add one on the dashboard's billing page (owners): you pay for the rest of the month at once and it applies as soon as that's paid. Removing it takes effect at the end of the month, and can be undone until then. Add-ons stay when you upgrade; downgrade to a plan that doesn't offer one only after removing it. On a contract, add-ons are part of the contract. ## Changing plans [#changing-plans] - **Upgrades** take effect as soon as they're paid: you pay the difference for the rest of the month, and get the same difference as extra credit. - **Downgrades and cancellations** take effect at the end of the month, and can be undone until then. Remove what the lower plan doesn't include first (for example, single sign-on or log drains): a downgrade is refused while you still use it. - If a month starts on Free and you upgrade, Free's allowance still covers its first emails. ## Limits and paused sending [#limits-and-paused-sending] - On **Free**, live sends past the month's allowance are refused with a `402` `billing_error` (`usage_limit_exceeded`) until the next month or an upgrade, and so are new live inboxes past its inbox-days and new live Scheduling hosts past its host-days. Received mail past its allowance is dropped (and counted on **Received emails**). Once only an attachment or received data allowance is used up, emails within their included 1 MB still go through. - If an invoice can't be collected, we retry it and email your billing contacts. Once it's overdue past the grace period (14 days unless your contract says otherwise), live sending is paused (`402`, `billing_hold`) until it's paid. So are new live bookings, Scheduling hosts, signature requests and inboxes, and hosted forms stop accepting submissions. Sandbox keys keep working, scheduled emails wait rather than fail, and bookings already made stay. Mail still arrives, and monthly charges for inboxes, hosts and phone numbers you keep continue. - Owners can set a **spend limit**: when usage beyond your credit reaches it, live sending pauses until the next month or until the limit is raised. Usage alerts go out at 80% and 100% of your credit (owners can change the thresholds). - Every self-serve account has a [credit limit](#credit-limit). Over it, live sending pauses (`402`, `billing_hold`) until it's back under. - Owners can also set monthly **budgets** for members' personal API keys, projects and single API keys: over a budget, only its live sending pauses (`402`, `budget_exceeded`). See [Spend and budgets](/docs/spend). ## Credit limit [#credit-limit] The credit limit caps what coss.com carries for your organization: usage not invoiced yet, unpaid invoices, and threshold charges from the last 30 days (a card payment can still be disputed by then). Your plan's fee doesn't use it up, and usage its credit covers isn't counted. - A new account's limit is **$500**. - It rises on its own to twice your **settled** payments (paid more than 30 days ago), up to $100,000. Payments for your plan's fee count towards this. - Billing settings show your limit and what's in use, and owners get an email at 80%. - If you need more sooner (say you're moving a large volume over), [ask support](/docs/support) to raise it: a limit they set replaces the automatic one. - A threshold charge that fails pauses live sending right away until your first payment has settled; after that, only reaching the limit (or the grace period above) does. Paying the charge resumes sending within a minute. A payment disputed as fraud pauses it until support has looked at it. Contracts and net terms have no credit limit unless one is agreed. ## Credits [#credits] Besides your plan's credit, coss.com support can add credits, in dollars or as free units of a product (for example, 50,000 free emails). Credits that apply to one product are used before general ones, and those expiring soonest go first. Your billing settings list every credit with what's left of it, including threshold charges waiting to come off the month's invoice. ## Invoices and payment [#invoices-and-payment] Invoices are in US dollars. By default they're charged to your card; contracts can be invoiced with payment terms (bank transfer) or charged by direct debit. Billing settings show your invoices and their PDFs, and let owners update the payment method and billing details. ## Billing API and events [#billing-api-and-events] Read the organization's billing with any API key (billing is organization-wide, so every environment's key sees the same). Plan changes, payment methods and spend limits stay in the dashboard. ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // ---cut--- const { data: billing } = await coss.billing.get(); // The plan, this month's usage and what it would cost so far (cents), standing and limits. console.log(billing?.plan, billing?.estimate.total, billing?.status); // ^? // Usage per day and environment, oldest first. const { data: usage } = await coss.billing.usage({ granularity: "day", group_by: "environment" }); // This month's usage per member (`user_id`: whose personal API key caused it; `null`: the rest). const { data: byMember } = await coss.billing.usage({ granularity: "month", group_by: "user" }); // Invoices (newest first) and credits. const { data: invoices } = await coss.billing.invoices.list({ status: "open" }); const { data: credits } = await coss.billing.credits.list(); ``` `group_by` also takes `project` and `api_key`. Usage recorded before coss.com kept its source has `null` there. Amounts are integers in cents; unit prices are dollar strings (`"0.0004"`). Lists page with `after` (the last `id`) while `has_more` is true. Usage covers up to 400 days per request (7 by hour) and is kept for 400 days. Subscribe a webhook endpoint to the `billing.*` [events](/docs/webhooks#organization-events) to follow invoices, payments, plan changes, usage alerts and paused sending as they happen: ```ts twoslash import { verifyWebhook } from "coss"; declare const body: string; declare const headers: Headers; declare function notifyFinance(message: string): void; // ---cut--- const event = await verifyWebhook(body, headers, process.env.COSS_WEBHOOK_SECRET!); if (event.type === "billing.invoice_payment_failed") { notifyFinance(`${event.data.invoice.number}: ${event.data.failure.message}`); } else if (event.type === "billing.usage_threshold_reached") { console.log(`${event.data.percent}% of this month's ${event.data.of} used`); } ``` Billing events go to live environments' endpoints only. `billing.plan_changed` is sent when a change is decided, with the moment it applies in `effective_at` (a downgrade's is the start of next month); `change` is `reverted` when a scheduled change is undone. # Content screening (/docs/content-screening) coss.com screens a sample of the messages your **live** environments send, right before they are handed to the email provider or the carrier, for spam, phishing, malware and fraud. It protects the people who receive them and the deliverability of every sender on coss.com. Sandbox messages are never screened. ## Which messages are screened [#which-messages-are-screened] Screening applies to live [emails](/docs/email/sending) (sub-accounts' and inboxes' included) and live [SMS](/docs/sms/sending). Each organization is sampled on its own: every one of its first messages, more as its volume grows, and after that a share of messages chosen at random. Which messages are sampled is never announced and can't be predicted, so a sender can't save the abuse for the messages it expects to be unscreened. A [sub-account](/docs/email/subaccounts) is sampled on its own too, so its first messages are always screened. Short image-based emails are always screened. A flagged sender receives increased screening, and repeated strongly suspicious messages can be blocked before the sender reaches the normal blocking threshold. ## Verdicts [#verdicts] An AI model scores the message for each category, and the highest score decides: | Verdict | What happens | | --------- | ------------------------------------------------------------------------------------------------------------- | | Allowed | The message is sent | | Flagged | The model thinks it may be abusive. It is sent, and your organization's [standing](/docs/reputation) becomes `warning` | | Blocked | The model is confident it is abusive. It isn't sent, and live sending is suspended | A blocked email fails with `content_rejected` (an `email.failed` webhook); a blocked SMS fails the same way (`sms.failed`). Live sending is then suspended for the whole organization (an `account.suspended` webhook, an email to owners and admins) until coss.com support has reviewed it, as for any [suspension](/docs/reputation#when-live-sending-is-suspended). When the blocked email belongs to a sub-account, only that sub-account is paused (`subaccount.paused`, with `data.trigger` `content_screening`), not your organization. An enforced block also restricts the verified sender domain, including after a domain or organization is deleted or transferred. Contact support to have that restriction reviewed. A sub-account using a shared platform domain does not restrict the platform domain. Flags expire with the reputation window: once no flagged message is left in it, the warning clears by itself. ## When screening is unavailable [#when-screening-is-unavailable] A message sampled for screening is never sent unscreened. If the model doesn't answer in time, the message is held: it stays `queued`, and coss.com tries again a minute later, and again until it gets a verdict. A message still not screened an hour after it was due fails with `content_screening_unavailable`. Messages that weren't sampled are sent as usual. Image inspection has limits: at most 16 images or animation frames, 2 MiB per image and 8 MiB total. Unsupported formats, unavailable images and over-limit content hold the message for the same retry path. Images are fetched only from public HTTP(S) addresses; redirects are refused. ## Privacy [#privacy] - **What the model sees**: for an email, the sender address, subject, up to 8,000 characters of readable text, images displayed by the email (including inline image attachments), and link hosts and paths without query strings; for an SMS, the sending number, text, and link hosts and paths. Recipient envelope lists and unrelated attachments are not included. The body or images may themselves contain personal data. - **Who processes it**: the model runs through Vercel's AI Gateway with zero data retention: the model providers may not keep the content or train on it. - **What coss.com keeps**: the verdict, never the message's content. Verdicts are kept for 90 days (see [data retention](/docs/data-retention)). - **Scores stay internal**: the API, webhooks and dashboard show `content_rejected` and your standing, never a message's scores. Screening is not a spam checker you can test content against. The model's instructions treat the message as untrusted data, but text written to manipulate it can still lower its scores; screening is one safeguard among several (bounce, complaint and opt-out rates, and coss.com's own review). ## If a decision is wrong [#if-a-decision-is-wrong] Contact coss.com support: a person reviews every suspension, and reinstates the organization when the message wasn't abusive. To have a person review an automated decision and explain your point of view, write to [legal@cal.com](mailto:legal@cal.com). See the [Acceptable Use Policy](/legal/acceptable-use#4-content-screening) and the [Privacy Policy](/legal/privacy#4-automated-content-screening). # Data retention (/docs/data-retention) coss.com keeps message data only as long as it is useful for delivery, debugging and abuse prevention. A background job deletes data once it passes the period below, for every organization and environment (sandbox and live alike). Deletion is permanent: coss.com cannot restore deleted data. | Data | Kept | Details | | --- | --- | --- | | Emails | 45 days | Subject, bodies, addresses, headers, tags, recipient statuses, delivery events, opens, clicks and attachment names. Queued and scheduled emails are kept until they are sent or canceled, and a broadcast's emails until the broadcast is finished. | | Attachment content | Until the email is sent | The bytes of attachments; only their name, type, size and checksum stay with the email. | | Email content without content storage | Until the email is sent | In environments whose content storage is set to discard: the subject, bodies, headers, template variables and attachment names. The rest of the email (addresses, tags, recipient statuses, events) is kept like any other. | | Received emails | 30 days | Emails sent to your receiving addresses: the raw message, headers, bodies, attachments and spam and authentication verdicts. You can also delete one right away. | | SMS messages | 45 days | Text, phone numbers, tags, segment counts and delivery events. Queued and scheduled messages are kept until they are sent or canceled. | | Received SMS | 30 days | Replies and other messages sent to your phone numbers: the text and the sender's number. | | Verifications | 30 days | One-time code requests: the phone number or email address, the channel, the status, attempts and why one was blocked. Codes are never stored, only a keyed hash until they expire. | | DMARC reports | 90 days | Aggregate reports mailbox providers send about your domains: the reporting organization, source IP addresses, message counts and authentication results. The report emails themselves are not kept. | | Idempotency keys | 24 hours | A request repeated with the same Idempotency-Key replays the first response. | | Webhook deliveries | 30 days | Event payloads, delivery statuses and attempt logs (including response excerpts). Deliveries still being retried are kept until they finish. | | CLI webhook listeners | 24 hours after expiry | Listeners `coss listen` opens to receive the environment's events, and the forwarding status (local status code, duration, error) the CLI reports for each event. The events themselves are kept as webhook deliveries. | | Hooks messages | 30 days | Messages you send to your applications (payloads), their deliveries and attempt logs (including response excerpts). Deleting an application stops access to its messages at once; they are deleted with the rest of their day. | | Hooks portal sessions | 24 hours after expiry | Sign-ins to the portal you create for your applications' users (never the token itself). | | Log drain batches | 7 days | The lines sent to your log drains and their delivery attempts (including response excerpts). Lines that could not be sent within 3 days are dropped. | | Content screening results | 90 days | Verdicts of the automated abuse screening. The screened content itself is never stored. | | Reputation statistics | 31 days | Hourly bounce, complaint and Hooks delivery failure counts behind your account standing. | | Dedicated IP statistics | 31 days | Hourly delivery counts per sending IP of your dedicated IPs. | | Standing notification emails | 90 days | Records of the emails sent to owners and admins about a warning or suspension. | | DMARC notification emails | 90 days | Records of the emails sent to owners and admins when a domain is ready for a stricter DMARC policy, or its mail fails DMARC. | | Account standing history | 2 years | Warnings, suspensions and reinstatements. The latest change is kept while the organization exists. | | Risk assessments | 1 year | Decisions, scores, reasons, signals (ASN, country, counts) and the feedback you sent. Your user id stays until you ask coss.com to forget the user. | | Risk assessment personal data | 90 days | The email address, IP address and user agent you sent with an assessment. Only keyed hashes remain afterwards. | | Risk memory | 1 year | Keyed hashes of mailboxes that have an account and of identifiers you reported as fraud or abuse (IP addresses count for 30 days), and the countries and networks each user logged in from (by keyed hash of your user id), counted from when they were last seen. | | Admin audit log | 2 years | Actions coss.com staff take on organizations and users. | | Network and access logs | 90 days | Our load balancer, CDN and network flow logs: IP addresses, requested URLs, user agents and connection details, kept to investigate abuse and security incidents. | | Expired sessions and invitations | 7 days after expiry | Sign-in sessions (with the iOS app's push notification registration), verification and reset tokens, and invitations that were never accepted. | | Invoices and payments | 10 years | Invoices with their line items, payments and credit notes, as tax law requires. Kept after your account is closed. | | Usage records | 400 days | Hourly counts of billable usage per environment, and which project, API key and member (for personal keys) each came from. Each invoice keeps its month's totals. | | Billing notification emails | 90 days | Records of usage alerts and payment reminders sent to your billing contacts. | | Support conversations | 2 years after it's resolved | Your support tickets: what you and our team wrote, attachments, and who wrote them. They're kept after your account or organization is deleted, until this period ends. | | Filtered support mail | 30 days | Mail to our support address that was spam or automated, and never answered. | | Notification emails | 90 days | Records of the emails sent to owners and admins about what to do next, such as registering an SMS sender and the outcome of its review. | | Push notifications | 30 days | Records of the notifications sent to the iOS app: their kind, subject and how many devices received them, never their text. | | Payment provider events | 30 days | Notifications from our payment processor about invoices and payments. | | Suppressions | Until you delete it | Email addresses and phone numbers that sends skip, including SMS opt-outs. Never removed automatically, so a bounced address or an opted-out number stays protected. | | Inboxes | Until you delete it | Inboxes with their addresses and names, and their threads' subjects and participants. Each message of a thread goes with its email (sent or received, as above), and a thread goes a day after its last message did. | | Contacts | Until you delete it | Your contacts with their custom properties, audience memberships, topic choices and consent timestamps (when they subscribed, unsubscribed or confirmed). Kept until you delete them. | | Unconfirmed contacts | 30 days | Contacts asked to confirm their subscription (double opt-in) who never did, deleted with their memberships and choices. One who had opted out (unsubscribed before, or left a topic) is kept, unsubscribed. | | Broadcasts | Until you delete it | Broadcasts with their content and their counters (recipients, deliveries, bounces, complaints, opens, clicks, unsubscribes). Kept until you delete them; each email they made is kept like any other email once the broadcast is finished. | | Signing and builder sessions | 7 days after expiry | Links to the signing page and the template builder you create (never the token itself), and the ones emailed to signers. | | Signature requests | Until you delete it | Documents uploaded for signing, and signature requests with their signers, the fields they filled and their audit trail (with the addresses and browsers they signed from). Kept until you delete them: they are your records of what was signed. | | Form submissions | 90 days | What was submitted to your forms, with uploaded files, the submitter's address, browser and the page it came from. Submissions you delete, and files of submissions you delete, are removed right away. | | Spam and unconfirmed form submissions | 14 days | Form submissions flagged as spam or held for review that you didn't release, and submissions whose submitter never confirmed their email address. | | Booking attendee details | 90 days after the booking ends | The attendee's name, email address and phone number, their answers to booking questions and the booking's metadata. You can also erase an attendee right away. | | Bookings | 395 days after the booking ends | A booking's time, host, event type, status and history, including who it was reassigned from and reports of bulk reassignments, without its attendee's details. Calendars contribute only busy times, which are replaced as calendars change and deleted when a calendar is disconnected. | | Out of office notes | 90 days after the time away ends | The notes and the message to bookers on a host's time away. | | Out of office | 395 days after the time away ends | When a host was away and the reason given, without notes. An entry you delete goes within 30 days. | | Imports from other providers | 90 days | Reports of imports from Resend, SendGrid or Postmark: what was found, what was imported and what needs attention. The provider's API key is deleted as soon as an import finishes or is canceled, and an import that is never started is deleted after 24 hours. What it imported is kept like anything you create yourself. | | Account and configuration | While your account exists | Users, organizations, projects, environments, API keys, domains, SMS phone numbers and carrier registrations (with the business details they were registered with), email templates (with every published version), webhook endpoints, log drains, Hooks applications, event types and endpoints, risk allow and block lists, forms, scheduling hosts, schedules, event types and connected calendars, contact properties, audiences, segments, topics, settings, and billing details (plan, contracts and credits). Items you delete (a key, a domain, a template, an endpoint, a drain, an application) are removed right away. | Periods start when the data is created (for example, when you call `coss.email.send()`), unless the table says otherwise. Deletion runs continuously, so data may disappear shortly after its period ends, never before. ## Emails [#emails] An email is deleted 45 days after it was created, together with everything recorded about it: recipients and their statuses, delivery events, opens and clicks, tracked links and attachment names. Emails that are still queued or scheduled are kept until they are sent or canceled. After deletion: - `coss.email.get()`, `coss.email.listEvents()` and the dashboard return `not_found` for it. - If it had open or click tracking, its tracked links stop redirecting and its open pixel stops counting. - Suppressions created by its bounces and complaints stay in place: they still name the email's id, which no longer resolves. Attachment content is discarded much earlier: as soon as the email is sent, fails or is canceled. Only each attachment's name, type, size and checksum stay with the email. ## Received emails [#received-emails] A [received email](/docs/email/receiving) is deleted 30 days after it arrived, with its raw message, headers, bodies and attachments. Delete one sooner with `coss.email.received.delete()` or from its dashboard page: its content goes right away. Messages blocked for a virus never have their content stored. ## Webhook deliveries [#webhook-deliveries] Every event sent to your [webhook endpoints](/docs/webhooks), with its delivery status and the log of attempts (status codes, timing and up to 1 KB of each response), is deleted 30 days after the event. A delivery that is still being retried is kept until it succeeds or gives up. ## Keeping your own records [#keeping-your-own-records] To keep message history longer, store it on your side as it happens: subscribe a webhook endpoint to the events you need (`email.sent`, `email.delivered`, `email.bounced`, …) and record them in your own database. Event payloads include the email's id, sender, recipients, subject, tags and category. ## What is never deleted automatically [#what-is-never-deleted-automatically] - **Suppressions** stay until you remove them, so an address that bounced or complained stays protected however long ago that was. See [suppressions](/docs/email/suppressions). - **Account and configuration data**: your organization, its members, projects, environments, API keys, domains, webhook endpoints and settings. Anything you delete yourself (a key, a domain, an endpoint) is removed right away. ## Abuse prevention [#abuse-prevention] coss.com screens a sample of live messages for abuse and keeps the verdict (never the content) for 90 days. Your account standing's history (warnings, suspensions and reinstatements) is kept for 2 years, and the latest change is kept for as long as the organization exists. # HIPAA mode (/docs/hipaa) HIPAA mode is one switch for your whole organization, for organizations that handle protected health information (PHI). It narrows where PHI can go and who at coss.com can reach it. The safeguards support your HIPAA compliance, which also depends on how you use coss.com. Don't send PHI to coss.com without a signed Business Associate Agreement. Our [Terms](/legal/terms) don't allow it. ## Turning it on [#turning-it-on] HIPAA mode is contract-only: it comes with an Enterprise contract and isn't available on self-serve plans. You can't turn it on yourself, by any key or role. Ask for it from **Settings → Compliance** in the dashboard. Then: 1. **You sign a Business Associate Agreement (BAA)** with coss.com, and the mode becomes a line on your contract. 2. **Your contract must include the audit log**, as Enterprise does. 3. **coss.com staff turn it on** and record the BAA's date and reference. It applies at once, including to messages still waiting to go out. Only coss.com staff can turn it off. Billing never does: a contract ending or a downgrade leaves the mode on until someone decides otherwise. When it's turned off, requiring two-factor authentication stays on until an owner changes it. Every member can see the mode's status, your BAA and the vendors below on **Settings → Compliance**. Your code can read it too, and so can agents, through the MCP server's `get_account_status`: ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // ---cut--- const { data: environment } = await coss.environment.get(); console.log(environment?.organization.hipaa_mode); // ^? ``` ## What it changes [#what-it-changes] | Control | What it does | | -------------------------------------- | ------------------------------------------------------------------------------------------------ | | **AI screening off** | Your messages are never sampled or sent to an AI model ([content screening](/docs/content-screening)). | | **AI classification off** | Risk, Forms and Scheduling never send text to an AI model. Form submissions and assessments continue without content scores. | | **Phone lookups off** | Live phone checks are refused, so numbers aren't sent to Twilio Lookup. | | **Push notifications off** | Your organization's and projects' names don't pass through Apple. | | **SMS limited to US numbers** | Live SMS goes to US numbers only, message bodies aren't kept after sending, and Verify codes need your own number. | | **Email content discarded** | Subjects, bodies, headers and template variables of live emails are deleted as soon as each email is finished. | | **Open and click tracking off** | Live emails have no tracking pixel or rewritten links, so link URLs aren't stored. Unsubscribe links still work. | | **Request bodies not logged** | API logs and log drains keep metadata such as the path and status, with no request or response bodies or query strings. | | **Two-factor authentication required** | Every member needs two-factor authentication, or SSO through your own provider. Owners can't turn the requirement off. | | **Automatic logoff** | Dashboard sessions end after 15 minutes without activity. Activity in organizations outside HIPAA mode doesn't count. | | **coss.com staff can't view content** | Staff can't reveal email content or impersonate your members, and internal email lists hide subjects and recipients. | | **Encrypted delivery required** | Email is sent only over TLS. A message is dropped rather than delivered unencrypted if the receiving server doesn't support it. | | **Audit log kept** | Changes in your organization, including anything coss.com support does, are recorded and kept for as long as your account exists. | Sandbox environments reach no vendor and keep test messages for developers to read, so the limits on stored data, tracking and SMS apply to live environments only. Keep PHI out of them: they aren't covered. A few details: - **Mail coss.com sends for you.** When Forms, Sign, Verify or Scheduling send from coss.com's own sender because you haven't set one, those emails get the same rules: no screening, no stored content, required TLS and hidden from staff. - **Dropped email.** coss.com may not hear that a message was dropped for lack of TLS, so its recipient can stay `sent`. - **Dedicated IPs.** Your mail uses shared IPs until your dedicated IPs require TLS, usually within minutes of turning the mode on. ## What it refuses [#what-it-refuses] A request the mode refuses fails with `403` `permission_error` and the code `hipaa_mode_restriction`, whatever the key's permissions. The [SMTP relay](/docs/email/smtp) answers `550`. Retrying won't help, and neither will another key. | Request in a live environment | Result | | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | A send or broadcast that turns on `tracking`, or changing the tracking settings to turn it on | Refused. Without asking for it, emails simply go untracked. | | Setting [content storage](/docs/email/content-storage) to `store` | Refused | | `coss.sms.send()` to a number outside the US | Refused. A message accepted before the mode was turned on fails with that code at dispatch. | | `coss.verify.start()` for SMS without an `sms_from` in Verify's settings, or to a number outside the US | Refused. See [SMS codes](/docs/verify/sms#which-number-sends-it). | | `coss.risk.checkPhone()` | Refused | | `coss.risk.classify()` | Refused | ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // ---cut--- const { error } = await coss.sms.send({ from: "+14155550123", to: "+447700900123", body: "Your appointment is confirmed.", }); if (error?.code === "hipaa_mode_restriction") { // Not retryable: reach this recipient another way. } ``` Other things stop quietly instead. `coss.risk.assess()` answers without content scores, and Forms and Scheduling skip their content checks. Scheduling skips SMS reminders to numbers it can't text. ## What stays up to you [#what-stays-up-to-you] - Only send PHI once your BAA is in place, and only from live environments. Sandbox environments keep test emails and aren't covered by the controls above. - Discarding only covers sent email and SMS. Received email and SMS, broadcasts, contacts, form submissions and bookings stay stored under your BAA for their normal [retention periods](/docs/data-retention). - Keep PHI out of email subject lines and metadata such as tags and categories. Discarding removes a subject only once the email is finished, and tags and categories are kept. - Webhook endpoints and log drains deliver to services you choose, so you need your own BAA with them where they receive PHI. Form submission webhooks include what was submitted. - Calendars connected to Scheduling (Google, Microsoft, CalDAV) and Zoom receive event titles, under your own agreements with those providers. - A captcha you configure on a form sends the submitter's address to that captcha provider. ## Vendors [#vendors] | Vendor | Used for | In HIPAA mode | | ------------------------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------- | | Amazon Web Services | Hosting, database, file storage and email delivery (SES) | Under BAA | | Twilio Programmable Messaging | SMS delivery | Under BAA, for US numbers only, which is what Twilio's BAA covers | | Google Workspace | Mail sent to support@coss.com | Under BAA | | Vercel AI Gateway | AI content screening and classification | Not used | | Twilio Lookup | Phone number checks | Not used | | Apple Push Notification service | Notifications to the iOS app | Not used | | Stripe | Payments | No PHI expected: it receives billing contacts and invoices only | | Sentry | Error reports | No BAA. Content, email addresses and phone numbers are removed from reports, but error text can't be guaranteed free of PHI. | # Log drains (/docs/log-drains) A log drain is an HTTPS endpoint that receives an environment's [log](/docs/logs) as it is written: every API request, email event and webhook attempt, plus the changes made to the environment (from the organization's audit log). coss.com posts them in batches, usually within a few seconds, signed like [webhooks](/docs/webhooks): as NDJSON to an endpoint you run, or straight into [Grafana Cloud](#grafana-cloud), [Datadog](#datadog) or an [OpenTelemetry collector](#opentelemetry), with no relay in between. | Source | Lines | | --------- | ---------------------------------------------------------------------------------------------- | | `api` | Requests made with the environment's API keys (`api.request`) | | `email` | Email events: `email.sent`, `email.delivered`, `email.bounced`… | | `webhook` | Delivery attempts to the environment's webhook endpoints (`webhook.attempt`) | | `audit` | Changes to the environment: API keys, webhook endpoints, log drains, suppressions, tracking… | A drain takes every source unless you list some. Organization-wide changes (members, domains, SSO) stay in the organization's [audit log](/docs/audit-log) and are not sent to drains. ## Create a drain [#create-a-drain] In the dashboard, open **Log drains** in an environment. Or with the API: ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // ---cut--- const { data, error } = await coss.logDrains.create({ url: "https://logs.example.com/coss", sources: ["api", "email"], }); // Store data.secret: it is returned only now. ``` Drains belong to the API key's environment, like webhook endpoints. An environment can have up to 5 drains. ## Formats [#formats] A drain's `format` picks the body of each request; `auth_header` adds a header the destination authenticates with (its value is stored encrypted and never shown again; a drain only reports `auth_header_name`). The dashboard's **Destination** presets fill both in. | Format | Destination | Body | | --------- | ------------------------------------------------------------------- | -------------------------------------------- | | `ndjson` | Your own endpoint (the default) | One JSON object per line, [below](#ndjson) | | `loki` | Loki's push API, `/loki/api/v1/push` (Grafana Cloud Logs) | A stream per source and level | | `datadog` | Datadog's log intake, `/api/v2/logs` | One Datadog log per line | | `otlp` | OTLP/HTTP logs in JSON, `/v1/logs` (Grafana Cloud, Honeycomb, a collector) | One log record per line | Every format carries each line whole (the same object NDJSON would), so nothing is lost by choosing one. Change a drain's format, URL or header at any time: a batch being retried goes out as the drain is then. ### Grafana Cloud [#grafana-cloud] With Loki, use your stack's Loki URL (its details page in the Grafana Cloud portal) and Basic authentication with the Loki user and an access policy token with the `logs:write` scope: ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // ---cut--- const user = "123456"; const token = process.env.GRAFANA_CLOUD_TOKEN ?? ""; await coss.logDrains.create({ url: "https://logs-prod-012.grafana.net/loki/api/v1/push", format: "loki", auth_header: { name: "Authorization", value: `Basic ${btoa(`${user}:${token}`)}`, }, }); ``` Lines arrive labelled `service_name="coss"`, `environment_id`, `source` and `level`; each line is the JSON object, so `{service_name="coss"} | json` reads its fields. Grafana Cloud's OTLP endpoint works too (`format: "otlp"`, its URL + `/v1/logs`, the instance ID as the user). ### Datadog [#datadog] ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // ---cut--- await coss.logDrains.create({ url: "https://http-intake.logs.datadoghq.com/api/v2/logs", format: "datadog", auth_header: { name: "DD-API-KEY", value: process.env.DD_API_KEY ?? "" }, }); ``` For another Datadog site, use its intake host (`http-intake.logs.datadoghq.eu`, `http-intake.logs.us3.datadoghq.com`…). Logs arrive with `service:coss`, `source:coss`, tags `source:` and `environment_id:`, a status from the line's level, its `message`, and the whole line under the `coss` attribute (`@coss.status_code`, `@coss.type`…). ### OpenTelemetry [#opentelemetry] `format: "otlp"` posts [OTLP/HTTP](https://opentelemetry.io/docs/specs/otlp/#otlphttp) logs as JSON to any `/v1/logs` endpoint (a collector, Honeycomb, Grafana Cloud…): `service.name` is `coss`, each record's severity comes from the line's level, its time from the line, and its body is the line as a map. Put the destination's key in `auth_header` (`Authorization: Bearer …`, `x-honeycomb-team`…). Header names coss.com sets itself (`Content-Type`, `User-Agent`, `webhook-*`, `coss-*`, `Host`…) can't be used. ## NDJSON [#ndjson] Each request is a `POST` with `Content-Type: application/x-ndjson`: one JSON object per line, each line ending with a newline, at most 500 lines or 1 MB per request. Log lines are exactly the objects [`GET /v1/logs`](/docs/api-reference/logs/list-logs) returns (`"object": "log"`), and audit events the objects of the [audit log](/docs/audit-log) (`"object": "audit_event"`): ```json {"object":"log","id":"log_01k7c8m4…","occurred_at":"2026-01-15T09:30:00.000Z","source":"api","level":"info","type":"api.request","message":"POST /v1/emails 202","request_id":"req_01k7c8m4…","status_code":202,…} {"object":"audit_event","id":"oaudit_01k7c8n1…","created_at":"2026-01-15T09:30:02.000Z","actor_type":"api_key","actor_id":"key_01k7…","action":"webhook_endpoint.created","target_type":"webhook_endpoint","target_id":"whep_01k7…",…} ``` The headers carry a [Standard Webhooks](https://www.standardwebhooks.com) signature over the body (`webhook-id`, `webhook-timestamp`, `webhook-signature`), plus `coss-log-drain-id` and `coss-environment-id` (requests of every format carry them). Verify every request with the drain's secret before storing its lines: ```ts twoslash import { verifyLogDrainBatch } from "coss"; declare const request: Request; // ---cut--- const lines = await verifyLogDrainBatch( await request.text(), request.headers, process.env.COSS_LOG_DRAIN_SECRET ?? "", ); for (const line of lines) { if (line.object === "log") console.log(line.occurred_at, line.level, line.message); else console.log(line.created_at, line.actor_label, line.action); } ``` `verifyLogDrainBatch` throws `WebhookVerificationError` when the signature doesn't match or the request is more than five minutes old: answer with a 4xx status then. ## Delivery [#delivery] - Answer with a 2xx status once the lines are stored. Anything else (or no answer within 15 seconds) is retried after 5 seconds, 1 minute, 5 minutes, 30 minutes, 1, 2, 4, 8 and 8 hours. - A batch can arrive more than once: the `webhook-id` header is the batch's id and stays the same on every retry, and each line has its own `id`. Skip what you already stored. (Loki drops a repeated line with the same timestamp by itself.) - Batches go out one at a time per drain, in the order lines were written. API request lines are written within about a second of the response, so they can follow the email events a request caused: sort by `occurred_at` (audit events: `created_at`) if order matters. Lines logged while a batch is being retried wait for it. - If a batch fails all 10 attempts (about a day), coss.com disables the drain and drops the lines still waiting for it; the audit log records `log_drain.disabled`. Fix the endpoint, then enable the drain again: it receives lines logged from then on. - Disabling a drain yourself also drops its waiting lines, and nothing is kept for a disabled drain. - While an organization is suspended, its drains are held; lines that wait more than 3 days are dropped. Each drain's page in the dashboard (or `coss.logDrains.batches.list()`) shows its recent batches with every attempt, its status code and the start of the response. Batches are kept for 7 days. # Logs (/docs/logs) Each environment has a log. It records: | Source | Lines | | --------- | -------------------------------------------------------------------------------------------- | | `api` | Every request made with one of the environment's API keys (`api.request`) | | `email` | Every email event: `email.sent`, `email.delivered`, `email.bounced`, `email.opened`… | | `webhook` | Every delivery attempt to one of the environment's webhook endpoints (`webhook.attempt`), and every event [`coss listen`](/docs/cli#receive-webhooks-locally) forwarded (`webhook.forward`) | Lines have a level: `error` for 5xx responses, bounces, complaints and failures, `warning` for 4xx responses, delays, suppressions and webhook attempts that will be retried, `info` for everything else. Lines about the same email share its `resource_id`, so a send request, the email's events and the webhook attempts they caused read as one timeline. Open **Logs** in an environment of the dashboard to search, filter, follow new lines live and export them as CSV or NDJSON. Or read them through the API: ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // ---cut--- const { data, error } = await coss.logs.list({ from: new Date(Date.now() - 24 * 60 * 60 * 1000), level: ["warning", "error"], source: "api", }); for (const line of data?.data ?? []) { console.log(line.occurred_at, line.status_code, line.message, line.request_id); } ``` Pages are newest first: pass the last line's `id` as `after` while `has_more` is true. A query covers an hour unless you pass `from`/`to`, and at most 31 days. Reading logs is not itself logged. ## Searching [#searching] The dashboard's search box takes `key:value` filters and free text. Repeating a key matches any of its values; `-key:value` excludes. | Filter | Matches | | ------------------------- | ------------------------------------------------ | | `level:error` | `info`, `warning`, `error` | | `source:email` | `api`, `email`, `webhook` | | `status:5xx`, `status:404`| A status class or code | | `method:POST` | The request method | | `route:/v1/emails/:id` | The matched route | | `path:/v1/domains` | A path prefix | | `type:email.bounced` | A line type | | `key:key_…` | Requests made with one API key | | `request:req_…` | One request (the `X-Request-Id` header) | | `resource:email_…` | Lines about one email, domain or endpoint | | `recipient:user@…` | Email events of one recipient | ## What is kept [#what-is-kept] Request and response bodies are stored redacted: secrets (such as a webhook endpoint's signing secret), attachment contents and the `Authorization` header are never kept, long strings are cut to 2,048 characters and bodies to 16 KB. Requests that fail authentication can't be attributed to an environment and are not logged. Logs are kept for 30 days. To keep them longer, or to search them next to your own logs, stream them to your logging stack with a [log drain](/docs/log-drains). # Members and roles (/docs/members-and-roles) Everyone who works in an organization is a **member** with one of three roles: | Role | Can | | ---------- | --------------------------------------------------------------------------------------------------------------------------- | | **Owner** | Everything an admin can, plus: manage billing (plan, payment methods, add-ons) and [budgets](/docs/spend), require single sign-on, make or remove owners, delete the organization | | **Admin** | Use and configure every product in every project: domains, templates, webhooks, API keys, contacts, Risk rules, Hooks, SMS senders and so on. Invite and remove members and admins, change organization settings, set up [single sign-on](/docs/sso) and [directory sync](/docs/scim), read the [audit log](/docs/audit-log) and billing | | **Member** | Read every project and environment in the dashboard (never webhook signing secrets), and create [personal API keys](/docs/environments#personal-keys) in the environments an owner or admin opened to them | Members can't change anything in the dashboard: what they do, they do through their personal keys. An organization has at least one owner at all times: the last owner can't leave, be removed or step down until someone else is an owner. The plan sets how many members an organization can have (Free: 3, Pro: 10, Scale: Unlimited; see [plans and billing](/docs/billing)). One person can own up to 5 organizations, and belong to any number. ## Invitations [#invitations] Owners and admins invite people from the dashboard's **Members** page, as an admin or a member. Nobody is invited as an owner: invite them, then make them an owner once they've joined. - The invitation is emailed to the address you enter and expires after 48 hours; you can resend or cancel it until then. The invitee accepts it signed in with the invited address, once it's verified. - Inviting needs a verified email address on your own account. Disposable addresses can't be invited. - An organization has at most 50 pending invitations at a time, and invitations sent each day are rate limited. - An invitation lasts only as long as its inviter may invite: when they leave, are removed or lose the admin role, their pending invitations are canceled. With [directory sync](/docs/scim) your identity provider adds and removes members instead, and people at your [SSO](/docs/sso) domains join as members the first time they sign in. ## Changing roles and removing members [#changing-roles-and-removing-members] Owners and admins change roles and remove members on the **Members** page. Only owners can change an owner's role, remove an owner, or make someone an owner. Members added by directory sync are managed in your identity provider: their role comes from its groups, and removing them there removes them here (making one an owner is still possible in the dashboard). Every change is recorded in the [audit log](/docs/audit-log). While an organization is suspended, invitations and member changes are refused. ## API keys [#api-keys] Each API key belongs to one environment, and is either an **organization key** (servers, shared jobs) or a **personal key** of one member, whose usage counts as that member's [spend](/docs/spend): - Owners and admins create both, and can assign a personal key to any member. - Members create personal keys for themselves where an owner or admin has opened the environment to them. `coss login` and `coss init` create personal keys of the member who approves them. - A personal key stops working when its owner leaves or is removed, and its organization-wide permissions (domains, billing, the audit log) follow its owner's current role. - Every key has full access or a restricted set of permissions (sending only, read only, or the permissions you pick). [Environments and API keys](/docs/environments#api-keys) has the details and the full permissions table. ## Leaving an organization [#leaving-an-organization] Leave from the organization's **Settings** page (**Leave organization**). Your personal API keys in it are revoked, the invitations you sent that are still pending are canceled, and you need a new invitation to come back. The only owner has to make another member an owner first. ## Deleting an organization [#deleting-an-organization] Owners delete an organization from its **Settings** page (**Delete organization**), by typing its slug. Settle any open invoices first, and a suspended organization can only be deleted by coss.com support. Deletion takes effect at once: every API key and directory sync token stops working, the SSO provider is removed, members and pending invitations are removed, scheduled emails never go out and webhook deliveries stop. coss.com then deletes the organization's data in the background: its projects and environments, emails, domains (also at the email provider), received mail, contacts, logs, the audit log and everything else it holds. Its [phone numbers](/docs/sms/senders) go back to the carrier, so move any you want to keep first. It can't be undone. ## Deleting your account [#deleting-your-account] Delete your account from your account settings (**Delete account**). It deletes your profile, sign-in methods (password, passkeys, connected Google or GitHub accounts, two-factor) and personal API keys, signs you out everywhere and removes you from every organization. Organizations where you are the only member are deleted with it. It is refused while you are the only owner of an organization that has other members (make someone else an owner, or delete the organization, first), while one of your organizations is suspended, and while an organization that would be deleted has open invoices. # Reputation (/docs/reputation) Your organization has one **standing**, measured from what its live environments send: | Status | Meaning | | ----------- | ---------------------------------------------------------------------------------------- | | `good` | Every check is within its thresholds | | `warning` | A check crossed its warning threshold. Nothing is refused; fix the cause before it grows | | `suspended` | Live sending is refused until coss.com support reinstates the organization | Sandbox environments are never measured, and keep working while an organization is suspended. ## What is measured [#what-is-measured] Rates are counted per recipient over a rolling window of 7 days (never reaching back before the organization's last reinstatement). Suppressed, failed, queued and canceled recipients don't count, and neither do the [mailbox simulator's](/docs/environments#sandbox-behaviour) addresses. A rate is only acted on once the window holds enough volume to make it meaningful; below that, it is reported but never warns. The default thresholds: | Signal | Warning at | Then | Minimum volume | | --- | --- | --- | --- | | Bounce rate (permanent bounces per recipient) | 4% | Live sending suspended at 8% | 200 recipients | | Complaint rate (spam complaints per recipient) | 0.08% | Live sending suspended at 0.3% | 500 recipients | | Marketing bounce rate | 4% | Marketing email paused at 8% | 200 recipients | | Marketing complaint rate | 0.08% | Marketing email paused at 0.3% | 500 recipients | | SMS opt-out rate (numbers that replied STOP per message that reached a carrier) | 2% | Live sending suspended at 5% | 200 messages | | SMS carrier filtering rate (messages carriers filtered as spam) | 3% | Live sending suspended at 10% | 200 messages | | Hooks deliveries that failed every attempt | 50% | Never suspends | 5,000 deliveries | These are stricter than most mailbox providers' own, so coss.com acts before they do. coss.com can set different thresholds for an organization: [`GET /v1/reputation`](#reading-your-standing) returns the ones that apply to yours, check by check. - **Email** is measured per [stream](/docs/email/streams#reputation). Transactional bounces and complaints decide the standing. Marketing bounces and complaints never suspend the organization: at their higher threshold **marketing email is paused** (broadcasts and `stream: "marketing"` sends are refused with `403` `marketing_paused`) while transactional email keeps going. - **SMS** is measured by the share of numbers that replied STOP and of messages carriers filtered as spam (see [opt-outs and reputation](/docs/sms/receiving#opt-outs-and-reputation)). - **Hooks** deliveries that failed every attempt only warn: they usually mean your customers' endpoints no longer exist (see [Hooks delivery](/docs/hooks/delivery#reputation)). - **Content screening** blocks a message it is confident is abusive and suspends live sending at once; messages it flags warn. See [content screening](/docs/content-screening). - A [sub-account](/docs/email/subaccounts#reputation) has its own standing: its rates pause that sub-account alone, while your organization's standing still counts everything it sends. coss.com re-evaluates an organization as soon as a new live bounce or complaint arrives, and every hour while it is warned. A warning clears by itself once every check is back within its thresholds. ## When live sending is suspended [#when-live-sending-is-suspended] - Live emails and SMS are refused with `403` `permission_error` (`account_suspended`). Sends coss.com had already accepted may still go out; scheduled sends wait until the suspension is lifted. - New live API keys can't be created. Sandbox keys and environments keep working, and so does everything that isn't a send. - **A suspension is never lifted automatically.** Contact coss.com support: a person reviews the account and reinstates it, and rates are measured afresh from then on. A marketing pause works the same way. ## Notifications [#notifications] Every change of standing is sent to the `account.*` [webhooks](/docs/webhooks#organization-events) of each live environment: | Type | Sent when | | ------------------------------ | --------------------------------------------- | | `account.reputation_warning` | A check crossed its warning threshold | | `account.reputation_recovered` | The warning cleared | | `account.suspended` | Live sending was suspended | | `account.reinstated` | coss.com support lifted the suspension | | `account.marketing_paused` | Marketing email was paused | | `account.marketing_reinstated` | coss.com support lifted the marketing pause | Warnings, suspensions and marketing pauses are also emailed to the organization's owners and admins (those with a verified address), with the checks behind them and what to do. Recoveries and reinstatements aren't emailed. The dashboard shows a banner, and its **Reputation** page lists the checks and the history of the standing. ## Reading your standing [#reading-your-standing] ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // ---cut--- const { data: reputation } = await coss.reputation.get(); if (reputation && reputation.status !== "good") { for (const check of reputation.checks) { if (check.severity !== "ok") console.log(check.trigger, check.rate, check.message); } } if (reputation?.marketing.status === "paused") { console.log("Marketing email is paused:", reputation.marketing.reason); } ``` Any key with `reputation:read` reads it ([`GET /v1/reputation`](/docs/api-reference/reputation/get-reputation)). Each check carries its `rate`, `count` and `volume` over the `window`, and the `warning_threshold`, `suspend_threshold` and `minimum_volume` that apply to your organization. ## Keeping a good standing [#keeping-a-good-standing] - Send only to people who asked for your messages, and remove addresses that bounce: coss.com [suppresses](/docs/email/suppressions) them for you after a permanent bounce or a complaint. - Make unsubscribing easy: marketing email gets [one-click unsubscribe](/docs/email/unsubscribe). - Keep marketing on the marketing stream, so a campaign's complaints never hold up password resets. - Test with a sandbox key and the simulator's addresses, never by sending to made-up addresses from a live environment. The [Acceptable Use Policy](/legal/acceptable-use#3-bounce-complaint-and-opt-out-rates) is the policy behind these thresholds. # Directory sync (SCIM) (/docs/scim) Directory sync lets your identity provider (Okta, Microsoft Entra ID, JumpCloud…) manage your organization's members over SCIM 2.0: people you assign to the coss.com application become members, members of a group you map become admins, and people you deactivate or delete lose access. It's part of the Enterprise plans. Directory sync needs [single sign-on](/docs/sso): people it adds sign in through your identity provider, and only addresses at the SSO provider's domains can be provisioned. ## Connect your directory [#connect-your-directory] Owners and admins connect it in the organization's settings, under **Directory sync**. The organization has one connection. Give your identity provider: - the **SCIM base URL**: `https://coss.com/api/auth/scim/v2`, and - a **bearer token**, created on the same page. Pick how long it lasts (90 days, 1 year or 2 years) and copy it at once: it isn't shown again. Up to two tokens work at a time, so you can replace one without a gap: create a new token, update your identity provider, then revoke the old one. When every token has expired or been revoked, syncing stops until you create a new one. ## What your directory controls [#what-your-directory-controls] Users are matched by their primary email address (or `userName` when they have none). | In your directory | In coss.com | | -------------------------------------------------- | ------------------------------------------------------------------- | | An active user | A member of the organization | | An active user in a group mapped to **admin** | An admin | | A user deactivated or deleted | Removed from the organization: their SSO sessions here end and their personal API keys are revoked | - **Group roles**: map a group's name to the admin or member role. Names are matched without regard to case, and saving the mappings applies them to every directory user at once. Groups do nothing else. - **Owners are never changed.** Directory sync never adds, demotes or removes an owner. If your directory deactivates someone who is an owner here, the page warns you; remove or demote them on the **Members** page yourself. - Members your directory manages can't be removed or have their role changed in the dashboard (making one an owner is still possible): change them in your directory. - An existing coss.com account with a matching, verified address joins as it is. Your directory never rewrites its name or other details. - While the directory is connected, signing in with SSO needs an active user in it (owners excepted), so people you deactivate can't sign in again through your identity provider. - While the organization is suspended, nobody is added or promoted; removals still apply. Connecting, disconnecting, tokens and group roles are recorded in the [audit log](/docs/audit-log), and the page lists the connection's recent activity. ## Disconnecting [#disconnecting] **Disconnect** makes every token stop working at once. Members the directory added stay, as ordinary members you manage on the **Members** page, and anyone at your SSO domains can sign in with SSO again. Disconnecting a large directory may take more than one step: the page shows "Disconnecting" until you finish it. The SSO provider can't be removed while a directory is connected: disconnect the directory first. # Spend and budgets (/docs/spend) The **Spend** page of your organization splits the month's usage charges by who caused them: projects, environments, API keys, and the members whose personal API keys sent it. Owners and admins see everything; members see their own spend. ## Organization keys and personal keys [#organization-keys-and-personal-keys] Every API key is one of two kinds: - An **organization key**, for production servers, staging and shared jobs. Its usage is the organization's. - A **personal key**, assigned to one member: its usage is that member's spend. Members create them for themselves in environments that allow it, to experiment without touching the organization's keys; `coss login` and `coss init` create them too. Owners and admins can assign a key to any member. See [personal keys](/docs/environments#personal-keys) for who can create them and what they can do. Spend follows the key that sent each email (a broadcast's emails follow the key that created it). Emails sent from the dashboard are the organization's. A member's spend stays theirs after the key is revoked. ## How spend is counted [#how-spend-is-counted] Spend is a share of the month's **usage charges**, at your plan's prices: each product's charge is split by each source's share of its usage (email recipients, for example). Because prices get cheaper with volume and your plan includes credit or units, what a member costs depends on the whole organization's usage, and the parts always add up to the usage lines of your invoice. - Your plan's credit pays for spend, it doesn't reduce it: a member's experiments show their real share even when the credit covers them. - Discounts on a product reduce its spend; on Free, usage within the allowance costs $0. - Sandbox usage is never billed, so it is never spend. - Usage recorded before coss.com kept its source belongs to its environment, without a key or a member. The same split is available from the API: `GET /v1/billing/usage` with `group_by` `project`, `api_key` or `user` ([Plans and billing](/docs/billing#billing-api-and-events)). ## Budgets [#budgets] Owners set monthly budgets on the Spend page's **Budgets** tab: | Budget | Applies to | | ------------------ | -------------------------------------------------------------------------------- | | **Default member** | Every member's personal keys, unless they have a budget of their own | | **Member** | One member's personal keys (or none: exempt them from the default) | | **Project** | Everything sent in a project, whatever key (or the dashboard) sent it | | **API key** | One key, organization or personal | coss.com checks spend every few minutes. At each alert threshold of a budget (80% and 100% unless you change them) it emails the billing contacts, and the member it concerns, and sends a `billing.budget_threshold_reached` [event](/docs/webhooks#organization-events). Once spend goes **over** a budget: - Live sends from that source are refused with `402` `billing_error` (`budget_exceeded`) — over SMTP, `550`. Scheduled emails wait instead, and broadcasts pause (`pause_reason` `budget_exceeded`) and resume by themselves. - Everything else keeps working: other members' and the organization's keys, sandbox keys, and reads. - `billing.budget_hold_placed` is sent, and `billing.budget_hold_lifted` when it ends: at the start of the next month, or as soon as an owner raises (or removes) the budget. Checks run every few minutes, so spend can pass a budget by what is sent in between. Emails already accepted before the pause still go out. New live bookings, Scheduling hosts, signature requests and inboxes in a project over budget are refused too, and its hosted forms stop accepting submissions. Mail still arrives and monthly charges for what you keep continue, so even a budget of $0 can't stop those. Budgets sit alongside your organization's **spend limit** (in billing settings), which pauses all live sending once usage beyond your credit reaches it. # Single sign-on (/docs/sso) Single sign-on (SSO) lets your organization's people sign in to the coss.com dashboard through your identity provider: Okta, Microsoft Entra ID, Google Workspace, or any other OpenID Connect or SAML 2.0 provider. It's part of the Scale and Enterprise plans. SSO is about the dashboard. API keys keep working the same way whatever you choose here. ## Before you start [#before-you-start] - **Verified domains.** SSO signs in people whose address is at one of your organization's [verified domains](/docs/email/domains). Add a domain your people use under **Domains** and verify it first, even if you don't send email from it. - **One provider** per organization, using one protocol. Owners and admins set it up in the organization's settings, under **Single sign-on**. ## Set up your identity provider [#set-up-your-identity-provider] Create an application in your identity provider with the values the **Single sign-on** page shows (they exist before you save anything, so you can create the application first): | Protocol | Value | Looks like | | -------------- | -------------------------------------- | ----------------------------------------------------------------------- | | OpenID Connect | Redirect URI | `https://coss.com/api/auth/sso/callback/` | | SAML 2.0 | ACS URL | `https://coss.com/api/auth/sso/saml2/sp/acs/` | | SAML 2.0 | Entity ID (audience) and metadata URL | `https://coss.com/api/auth/sso/saml2/sp/metadata?providerId=` | Then fill in your provider's side on coss.com: - **OpenID Connect**: the issuer URL (coss.com reads its `/.well-known/openid-configuration`; it must be a public `https://` address), the client ID and the client secret. - **SAML 2.0**: the identity provider's metadata XML, or its SSO URL, entity ID (issuer) and signing certificate. - **Domains**: the verified domains whose people sign in through this provider. ## Signing in [#signing-in] People choose **Sign in with SSO** on the sign-in page and enter their work email (or follow a link to `/sso?org=`), and coss.com sends them to your identity provider. - Someone signing in for the first time joins your organization as a **member**. Make them an admin on the **Members** page, or map directory groups to roles with [directory sync](/docs/scim). - Someone who already has a coss.com account with that verified address keeps it: SSO is linked to it. - Every sign-in is checked again: the address your provider returns must be at one of the provider's domains, and those domains must still be verified. - An SSO sign-in through your organization's provider also satisfies its [two-factor requirement](/docs/two-factor#requiring-it-for-an-organization): your identity provider is responsible for multi-factor authentication. ## Requiring SSO [#requiring-sso] Owners can make SSO the only way **members and admins** open the organization. Anyone who signed in another way is sent to your identity provider when they open it. To turn it on you need: 1. an active provider, 2. to have signed in with SSO yourself, and 3. a password on your own account. Owners keep **break-glass access**: they can still sign in with their password (and their authenticator code, if two-factor is required) in case the identity provider fails. The settings page lists owners without a password, who have no such access. Only owners can turn the requirement on or off. ## When SSO stops working [#when-sso-stops-working] - A provider whose domain is no longer verified becomes **inactive**: nobody can sign in through it until the domain is verified again, or removed from the provider and the provider saved. While SSO is required, members and admins can't open the organization in the meantime; owners still can. - A domain the provider lists can't be deleted under **Domains** (`domain_in_use_by_sso`): take it off the provider first. - **Removing the provider** turns SSO off, deletes every account's link to it and signs out everyone who signed in with it. It can't be removed while [directory sync](/docs/scim) is connected. If you're locked out (for example, your identity provider is gone and no owner has a password), contact coss.com support. ## Limits [#limits] - One provider per organization. - Sign-in starts at coss.com (service provider initiated). IdP-initiated SAML and SAML single logout aren't supported. - A SAML error that happens after your identity provider's step is shown on the callback URL rather than on the sign-in page. # Support (/docs/support) Every ticket is read and answered by a person. You can reach us two ways, and they're the same conversation: a reply in one shows up in the other. - **From the dashboard:** open **Support** in your organization's sidebar, or press ⌘K and search for it. - **By email:** write to [support@coss.com](mailto:support@coss.com). ## What each plan gets [#what-each-plan-gets] | | Free | Pro | Scale | Enterprise | | --- | --- | --- | --- | --- | | Support response target | 3 business days | 1 business day | 4 business hours | 2 business hours | | Urgent issues | Not included | 4 business hours | 1 business hour | 1 business hour | | Front of the queue | No | No | Yes | Yes | | Channels | Email, Dashboard | Email, Dashboard | Email, Dashboard | Email, Dashboard, Shared Slack channel, Named contact | | Contractual SLA with credits | No | No | No | By contract | | Hours | Monday to Friday, 9am to 6pm Central Time | Monday to Friday, 9am to 6pm Central Time | Monday to Friday, 9am to 6pm Central Time | Monday to Friday, 9am to 6pm Central Time; 24x7 by contract | These are the times we aim to send a first response, counted only during support hours: they are targets, not guarantees. Enterprise contracts can make them commitments, with service credits and support outside these hours. **Urgent** means production is down. We may reclassify a ticket when we read it, and a ticket from a plan without urgent support follows that plan's normal target. ## Raising a ticket [#raising-a-ticket] Say what happened, what you expected, and any error messages you saw (a request's `X-Request-Id` is the fastest way for us to find one). Please leave out passwords and API keys. The form tells you when to expect a reply before you send it. You can say which project and product it's about, and point at a specific item: pick a recent email or text message, or paste the ID of a domain, form, contact, booking or similar. On an email or text message's page, **Get help** opens a ticket with all of this filled in. A ticket raised from the dashboard belongs to that organization. Owners and admins see all of an organization's tickets; other members see their own. ## Emailing us [#emailing-us] Email us from the address on your coss.com account. If we can prove the message really came from that address and you belong to one organization, the ticket appears in that organization's dashboard and follows its plan. Your domain needs to publish a DMARC policy for us to prove that. Otherwise we can't tell who sent it, since anyone can put any address in the From line. We still read and answer it, but a person checks who you are before it joins your organization, and we won't share account details until then. A ticket raised from the dashboard never has this problem. ## What happens next [#what-happens-next] You get a confirmation with your ticket number and when to expect a reply. Replies arrive by email and in the dashboard, and you can answer in either. Replying to a resolved ticket opens it again. If we ask you something and don't hear back for a week, we close the ticket with a note; replying opens it again. You can also mark a ticket as resolved yourself. A support conversation is kept for 2 years after it's resolved; see [data retention](/docs/data-retention). # Two-factor authentication and passkeys (/docs/two-factor) Your coss.com account signs in with a password, a connected Google or GitHub account, a passkey or your organization's [single sign-on](/docs/sso). Two-factor authentication and passkeys protect those sign-ins. They're set up per person, in your account settings under **Security**. These protect the dashboard. API keys are separate credentials and aren't affected by any of them. ## Authenticator app [#authenticator-app] Two-factor authentication on coss.com uses an authenticator app (1Password, Google Authenticator, Authy and the like): once it's on, every sign-in with your password or a connected Google or GitHub account also asks for the 6-digit code from the app. There are no codes by email or SMS. 1. Under **Security**, set up an authenticator app and confirm your password. An account that only signs in with Google or GitHub sets a password first (with **Forgot password** on the sign-in page). 2. Scan the QR code (or enter the key) in your app, and confirm a code from it. 3. Save your **backup codes**. Each one signs you in once if you lose your authenticator. Create a new set of backup codes whenever yours run out or are lost: the old ones stop working. Turning two-factor off needs your password and a recent sign-in. After 10 wrong codes, the account is locked for 15 minutes. ## Passkeys [#passkeys] A passkey signs you in with your fingerprint, face or device PIN instead of a password. Add one or more under **Security**, and use **Sign in with a passkey** (or your browser's autofill) on the sign-in page. A passkey sign-in doesn't ask for an authenticator code: the passkey is already two factors, the device and your biometric or PIN, which coss.com requires it to check. Passkeys don't count as two-factor authentication for an organization that requires it (below): your password still works without a code, so the requirement asks for an authenticator app. ## Requiring it for an organization [#requiring-it-for-an-organization] Owners and admins can require two-factor authentication for everyone in an organization, in its **Settings** under **Security**. You need it on your own account first, and the page shows how many members don't have it yet. While it's required, a member without an authenticator app is sent to their **Security** settings when they open the organization, until they set one up. Signing in through the organization's own [SSO](/docs/sso) counts instead: your identity provider is responsible for multi-factor authentication there. SSO through another organization's provider doesn't. ## Lost your authenticator? [#lost-your-authenticator] Sign in with one of your backup codes, then set up the app again. If you have neither, contact coss.com support: after confirming it's you, support can reset two-factor on your account (this is recorded), and you set it up again. # Webhooks (/docs/webhooks) Add webhook endpoints per environment in the dashboard (**Webhooks**) or through the API. Each endpoint subscribes to event types (all of them by default) and has its own `whsec_…` signing secret. ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // ---cut--- const { data: endpoint, error } = await coss.webhookEndpoints.create({ url: "https://example.com/webhooks/coss", event_types: ["email.delivered", "email.bounced"], }); // Store the secret now: it is only returned when the endpoint is created (or its secret rolled). const secret = endpoint?.secret; ``` ## Events [#events] | Type | Sent when | | ------------------------ | ------------------------------------------------------- | | `email.sent` | The provider accepted the email | | `email.delivered` | A recipient's mail server accepted it | | `email.delivery_delayed` | Delivery to a recipient is being retried | | `email.bounced` | A recipient's mail server rejected it | | `email.complained` | A recipient marked it as spam | | `email.failed` | The email could not be sent at all | | `email.suppressed` | A recipient was skipped because it is suppressed | | `email.scheduled` | An email was [scheduled](/docs/email/sending#scheduling-rescheduling-and-cancellation) for later | | `email.rescheduled` | A scheduled email got a new time (`data.reschedule`) | | `email.canceled` | A scheduled email was canceled | | `email.opened` | A recipient opened it ([open tracking](/docs/email/tracking)) | | `email.clicked` | A recipient clicked a tracked link ([click tracking](/docs/email/tracking)) | | `email.unsubscribed` | A recipient used [one-click unsubscribe](/docs/email/unsubscribe) | | `email.received` | An email arrived at one of the environment's [receiving addresses](/docs/email/receiving) | | `inbox.message.received` | An email arrived in one of the environment's [inboxes](/docs/inboxes) | | `contact.created` | A [contact](/docs/email/contacts) was added (one at a time: imports send no events) | | `contact.updated` | A contact's names, status, properties or topics changed | | `contact.deleted` | A contact was deleted | | `contact.unsubscribed` | A contact unsubscribed from all marketing email, or from one topic (`topic`), through the [preference center](/docs/email/topics-and-preferences) or one-click unsubscribe | | `contact.confirmed` | A contact confirmed their address ([double opt-in](/docs/email/topics-and-preferences#double-opt-in)) | | `broadcast.sending` | A [broadcast](/docs/email/broadcasts) started sending | | `broadcast.sent` | A broadcast finished: every eligible contact was processed and none of its emails is still waiting (failures are in its `stats`) | | `broadcast.paused` | A broadcast was paused, by you or by coss.com (`pause_reason`) | | `broadcast.canceled` | A scheduled, sending or paused broadcast was canceled | | `broadcast.failed` | A broadcast stopped for good (`error`) | | `sms.scheduled` | An [SMS](/docs/sms/sending) was scheduled | | `sms.sent` | The carrier accepted an SMS | | `sms.delivered` | The carrier delivered it to the phone | | `sms.undelivered` | The carrier couldn't deliver it (`data.failure`) | | `sms.failed` | The SMS could not be sent at all (`data.failure`) | | `sms.suppressed` | The SMS was skipped because its number is [suppressed](/docs/sms/sending#suppressions) (`data.suppression`) | | `sms.canceled` | A scheduled SMS was canceled | | `sms.received` | An SMS arrived at a number whose replies go to this environment ([receiving](/docs/sms/receiving)) | | `sms.opted_out` | A number replied STOP and was suppressed in this environment | | `sms.opted_in` | A number replied START and its opt-out was removed | | `sign_request.sent` | A signature request was sent (created with `send`, or a draft sent) | | `sign_request.viewed` | A signer opened it for the first time (`data.signer`) | | `sign_request.signer_signed` | A signer signed (`data.signer`); `data.status` is `completed` when they were the last | | `sign_request.declined` | A signer declined, which declines the request (`data.reason`) | | `sign_request.completed` | Everyone signed and the sealed, signed document is ready to download | | `sign_request.canceled` | You canceled it | | `sign_request.expired` | It passed its `expires_at` before everyone signed | | `verification.approved` | The right code was checked (billed once) | | `verification.failed` | Too many wrong codes, or the code couldn't be sent (`data.failure`) | | `verification.blocked` | The fraud guard stopped it before a code was sent (`data.reasons`) | | `form.submission.received` | A [form](/docs/forms) submission was accepted (`data.data`: what was submitted) | | `form.submission.flagged` | Risk held a submission for review or refused it as spam (`data.spam_reason`) | | `scheduling.booking.confirmed` | A [booking](/docs/scheduling/bookings) was confirmed. Ids, times and statuses only: retrieve it for the attendee | | `scheduling.booking.pending_approval` | A booking is waiting for the host's approval | | `scheduling.booking.rescheduled` | A booking moved (`data.previous_start`) | | `scheduling.booking.cancelled` | A booking was cancelled | | `scheduling.booking.declined` | A booking was declined, or its approval deadline passed | | `scheduling.booking.no_show` | An attendee was marked as a no-show | | `scheduling.booking.external_conflict` | Something else landed on a booked time, or the host changed the event on their calendar | | `scheduling.booking.calendar_write_failed` | A booking couldn't be written to the host's calendar. It still stands | | `scheduling.booking.location_ready` | A booking's meeting link is ready | | `scheduling.booking.reassigned` | A booking went to [another host](/docs/scheduling/reassigning) (`data.previous_host_ids`) | | `scheduling.reassignment.completed` | [Many bookings](/docs/scheduling/reassigning#many-at-once) finished moving, or that was cancelled (`data.counts`) | | `scheduling.booking.started` | A confirmed booking's start time arrived. It doesn't mean anyone joined | | `scheduling.booking.ended` | A confirmed booking's end time arrived | | `scheduling.booking.reminder` | A [reminder](/docs/scheduling/reminders#webhooks-at-any-moment) you timed came due (`data.reminder`) | | `scheduling.calendar.connected` | A host [connected a calendar](/docs/scheduling/calendars) | | `scheduling.calendar.needs_reauth` | A host's calendar lost access: they aren't offered until it's back | | `scheduling.calendar.disconnected` | A host disconnected a calendar | | `scheduling.out_of_office.created` | A host was [marked as away](/docs/scheduling/out-of-office). Ids and times only: never why | | `scheduling.out_of_office.updated` | A host's time away changed | | `scheduling.out_of_office.deleted` | A host's time away was removed | | `scheduling.out_of_office.started` | A host's time away began | | `scheduling.out_of_office.ended` | A host's time away ended | | `risk.assessment.review` | A [risk assessment](/docs/risk) decided `review` | | `risk.assessment.reviewed` | Feedback resolved a `review` | | `hook_endpoint.disabled` | coss.com disabled one of your [Hooks](/docs/hooks/delivery#failing-endpoints-are-disabled) applications' endpoints after its deliveries failed for 5 days | ### Sub-account events [#sub-account-events] A [sub-account](/docs/email/subaccounts)'s own reputation changes go to its environment's endpoints (live only). `data.subaccount_id` and `data.uid` name it. | Type | Sent when | | --------------------------------- | --------------------------------------------------------------------------- | | `subaccount.reputation_warning` | Its bounce or complaint rate crossed the warning threshold | | `subaccount.reputation_recovered` | The warning cleared | | `subaccount.paused` | Its live sending was paused (a rate, or content screening: `data.trigger`) | | `subaccount.reinstated` | You reinstated it | ### Organization events [#organization-events] These concern the whole organization, so every **live** environment's endpoints receive them (sandbox endpoints don't). `data.organization_id` names the organization. | Type | Sent when | | --------------------------------- | --------------------------------------------------------------------------------------- | | `domain.dmarc_report_received` | A [DMARC](/docs/email/dmarc) aggregate report about a domain arrived (a summary, no rows) | | `account.reputation_warning` | A reputation check (bounces, complaints, content) crossed its warning threshold | | `account.reputation_recovered` | The warning cleared | | `account.suspended` | Live sending was suspended | | `account.reinstated` | The suspension was lifted | | `account.marketing_paused` | The marketing stream's bounce or complaint rate paused marketing sends (`data.marketing`) | | `account.marketing_reinstated` | The marketing pause was lifted | | `billing.invoice_finalized` | An invoice was issued (`data.invoice`, without lines) | | `billing.invoice_paid` | An invoice was paid in full | | `billing.invoice_payment_failed` | Charging an invoice failed (`data.failure.message`); it is retried | | `billing.invoice_voided` | An open invoice was voided | | `billing.plan_changed` | The plan changed or a change was scheduled or undone (`change`, `plan`, `effective_at`) | | `billing.usage_threshold_reached` | Usage reached an alert threshold of the month's credit or Free's allowance (`percent`) | | `billing.hold_placed` | Live sending was paused for billing (`reason`: `delinquent`, `spend_limit`, `credit_limit` or `admin`) | | `billing.hold_lifted` | That pause ended | | `billing.credit_granted` | A credit was added (`data.credit`) | | `billing.budget_threshold_reached` | A member's, project's or API key's spend reached an alert threshold of its monthly budget (`scope`, `target_id`, `percent`) | | `billing.budget_hold_placed` | Its budget is used up: its live sending is paused (`scope`, `target_id`) | | `billing.budget_hold_lifted` | That pause ended (a new month, or a higher budget) | See [Plans and billing](/docs/billing#billing-api-and-events) for what they mean and how to read the rest of an organization's billing. The request body is a JSON event. Payloads describe the email (`email_id`, `from`, `to`, `subject`, `tags`, `category`) but never include its content, headers, cc or bcc; `email.received` events likewise only name the received email (`received_email_id`) and who sent it to whom. `sms.*` events never include the text either: read it with `coss.sms.get()` or `coss.sms.received.get()`. `sign_request.*` events never include documents or what signers filled in. Events are rendered in the endpoint's [API version](/docs/api-reference/versioning#webhooks), named in `api_version`. ```json { "id": "evt_01k7c8m4q2f3e9v6t5r1n0p8yz", "object": "event", "type": "email.delivered", "api_version": "2026-10-10", "created_at": "2026-10-10T12:00:01.000Z", "data": { "email_id": "email_01k7c8m4q2f3e9v6t5r1n0p8yz", "from": "Acme ", "to": ["user@example.com"], "subject": "Welcome", "tags": [], "category": null, "sandbox": false, "recipient": "user@example.com", "occurred_at": "2026-10-10T12:00:00.000Z", "delivery": { "smtp_response": "250 2.0.0 OK" } } } ``` ## Verifying requests [#verifying-requests] Requests are signed with [Standard Webhooks](https://www.standardwebhooks.com) headers: `webhook-id`, `webhook-timestamp` and `webhook-signature`. Always verify them before trusting the body. With the SDK, use [`verifyWebhook`](/docs/sdk/webhooks). ## Testing locally [#testing-locally] Your development server isn't reachable from the internet, so register no endpoint for it: run [`coss listen --forward-to localhost:3000/webhooks`](/docs/cli#receive-webhooks-locally), which receives the environment's events and forwards them to your server, signed with a secret of its own that you verify the same way. To try a handler without making the real thing happen, send a **test event** with [`coss trigger`](/docs/cli#trigger-test-events) or the API: a sample event of that type, sent to the environment's subscribed endpoints and open listeners exactly like a real one (same body, signature, retries and log lines). Test events are for sandbox environments only, and of every type except the live-only `domain.*`, `account.*` and `billing.*`. Nothing in the body marks them as tests, and the ids in the sample are made up: pass real ones in `data` if your handler looks them up. ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // ---cut--- const { data } = await coss.webhookEvents.test({ type: "email.bounced", data: { recipient: "ada@example.com" }, }); console.log(data?.event.id, data?.endpoints, data?.listeners); ``` ## Rolling the secret [#rolling-the-secret] Roll an endpoint's secret in the dashboard (**Roll secret** on the endpoint) or through the API to replace it, for example on a schedule or after it may have leaked. For a grace period (a day by default, up to a week) every request carries two signatures, one per secret, in `webhook-signature`, so a receiver verifying with either one keeps accepting requests while you deploy the new secret. Choose `0` to stop the old secret at once. ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); declare const endpointId: string; // ---cut--- const { data: rolled } = await coss.webhookEndpoints.rollSecret(endpointId, { previous_secret_expires_in: 60 * 60, // the old secret keeps signing for an hour }); const newSecret = rolled?.secret; // deploy it before rolled?.previous_secret_expires_at ``` Rolling again during the grace period stops the older secret immediately. The SDK never retries a roll: if the response is lost, roll again and deploy that secret. ## Delivery and retries [#delivery-and-retries] - Respond with any `2xx` status within 10 seconds to acknowledge an event. - Failed deliveries are retried 7 times over about 28 hours (5 s, 5 min, 30 min, 2 h, 5 h, 10 h, 10 h). - Events can arrive out of order: sort by `data.occurred_at` (every event has it). - An event can arrive more than once: deduplicate by `id` (equal to the `webhook-id` header). - Events about an email or text message sent with a `traceparent` header carry it in `data.traceparent` and as the request's own `traceparent` header (see [Tracing](/docs/api-reference/tracing)). ## Delivery logs [#delivery-logs] Every event sent to an endpoint is logged as a delivery, with each HTTP attempt (status code, duration, error and the first 1 KB of your response) and the payload as sent. Find them on the endpoint's page in the dashboard, or list them through the API — newest first, filtered by `status` or `event_id`: ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); const endpointId = "whep_…"; // ---cut--- const { data: failed } = await coss.webhookEndpoints.deliveries.list(endpointId, { status: "failed", }); // After fixing your receiver, send a failed event again. for (const delivery of failed?.data ?? []) { await coss.webhookEndpoints.deliveries.retry(endpointId, delivery.id); } ``` A retry makes one more attempt within seconds, signed with the endpoint's current secret and sent to its current URL. Deleting an endpoint deletes its delivery log, and deliveries are deleted 30 days after the event (see [data retention](/docs/data-retention)). # Environments and API keys (/docs/environments) ## Organizations and projects [#organizations-and-projects] Everything in coss.com belongs to an **organization**. Its people are owners, admins or members (see [members and roles](/docs/members-and-roles)). An organization has any number of **projects**, and each project has two **environments**: | Environment | Mode | Key prefix | Sends email | | ------------- | --------- | ------------ | ------------------------------------------------ | | `production` | `live` | `coss_live_` | Yes, from your organization's verified domains | | `development` | `sandbox` | `coss_test_` | No. Emails are recorded with `sandbox: true` | ## API keys [#api-keys] An API key belongs to exactly one environment, and everything it creates or reads lives in that environment. A key can only read emails sent from its own environment. ### Personal keys [#personal-keys] A key is either an **organization key**, for production servers, staging and shared jobs, or a **personal key** assigned to one member: what a personal key sends counts as that member's spend, so developers can experiment with their own keys and you can see (and cap) what each of them costs. - Owners and admins create both kinds, and can assign a personal key to any member. - Members create personal keys for themselves in environments an owner or admin has opened to them (the switch on the environment's API keys page). New projects open their development environment and keep production closed; closing an environment leaves existing keys working. - `coss login` and `coss init` create personal keys of the member who approves them. - A personal key works only while its owner is a member: it is revoked when they leave or are removed (also by directory sync), and refused while their account is banned. - Organization-wide permissions (managing domains, reading billing and the audit log) work on a personal key only while its owner's role allows them in the dashboard. Everything else in its environment is available to it, so opening an environment gives members write access to it through their keys. ### Permissions [#permissions] When you create a key in the dashboard, you choose what it can do: | Access | Can | | ------------------ | ------------------------------------------------------------------------------------ | | **Full access** | Everything, including the permissions of products coss.com adds later | | **Sending access** | Only `email:send`: send, schedule and cancel emails through the API, the SDK or SMTP | | **Read only** | Every `read` permission below | | **Custom** | The permissions you check | Keys with sending access, read-only access or custom permissions are **restricted**. A restricted key keeps exactly the permissions it was created with: it never gains new ones, even when coss.com adds products. Give each server or job the narrowest key that does its work: an application that only sends email needs only sending access. A request the key isn't allowed to make fails with `403` `permission_error` (`insufficient_permissions`), and the message names the permission it needed. Any key can read its own environment and access with `GET /v1/environment` (`coss.environment.get()`: `api_key.access` and `api_key.permissions`) and revoke itself. To change what a key can do, create a new key and revoke the old one. | Resource | Permissions | Covers | | --- | --- | --- | | Emails | `email:send`, `email:read` | Send, schedule and cancel emails (API, SDK and SMTP), change tracking and content storage settings; read sent and received emails, their events and those settings. | | Templates | `emailTemplate:create`, `emailTemplate:read`, `emailTemplate:update`, `emailTemplate:delete`, `emailTemplate:publish` | Manage email templates and publish their versions. | | Received emails | `receivedEmail:delete` | Delete received emails (reading them needs Emails: Read). | | Inboxes | `inbox:create`, `inbox:read`, `inbox:update`, `inbox:delete`, `inbox:send` | Create, rename and delete inboxes; read their threads and messages, send and reply from them. | | Domains | `domain:create`, `domain:read`, `domain:verify`, `domain:delete` | Add, verify and remove sending domains; read them and dedicated IPs. | | Suppressions | `suppression:create`, `suppression:read`, `suppression:delete` | Manage the suppression list. | | Contacts | `contact:create`, `contact:read`, `contact:update`, `contact:delete` | Manage contacts, audiences, segments and topics. | | Broadcasts | `broadcast:create`, `broadcast:read`, `broadcast:update`, `broadcast:delete`, `broadcast:send` | Manage broadcasts and send them. | | Sub-accounts | `subaccount:create`, `subaccount:read`, `subaccount:update`, `subaccount:delete` | Manage sub-accounts (your users' own domains, suppressions, quotas and reputation) and reinstate paused ones; read them and their stats. | | Reputation | `reputation:read` | Read the organization's sending reputation. | | SMS | `sms:send`, `sms:read` | Send, schedule and cancel text messages; read sent and received messages, their events and the organization's numbers. | | SMS suppressions | `smsSuppression:create`, `smsSuppression:read`, `smsSuppression:delete` | Manage the SMS suppression list. | | Signature requests | `sign:create`, `sign:read`, `sign:update`, `sign:delete`, `sign:send` | Upload documents, create, send and cancel signature requests; read them, their signers and audit trails. | | Verifications | `verify:send`, `verify:check`, `verify:read`, `verify:update` | Start, check and cancel verifications (one-time codes by SMS or email); read them; change Verify's settings. | | Forms | `form:create`, `form:read`, `form:update`, `form:delete` | Create and change forms; read their submissions and files, release submissions held as spam and delete them. | | Scheduling | `scheduling:create`, `scheduling:read`, `scheduling:update`, `scheduling:delete` | Manage hosts, event types and settings; read availability; create, change and cancel bookings. | | Webhooks | `webhook:create`, `webhook:read`, `webhook:update`, `webhook:delete` | Manage webhook endpoints and listeners and send test events; read deliveries. | | Logs | `log:read` | Read the environment's logs. | | Log drains | `logDrain:create`, `logDrain:read`, `logDrain:update`, `logDrain:delete` | Manage log drains. | | Audit log | `audit:read` | Read the organization's audit log. | | Risk | `risk:assess`, `risk:read`, `risk:feedback`, `risk:update` | Assess events and run lookups, report feedback, read assessments and change risk settings and rate limits. | | Risk lists | `riskList:create`, `riskList:read`, `riskList:delete` | Manage allow and block lists. | | Risk rules | `riskRule:create`, `riskRule:read`, `riskRule:update`, `riskRule:delete` | Manage risk rules. | | Hooks | `hook:create`, `hook:read`, `hook:update`, `hook:delete`, `hook:send` | Manage Hooks applications, event types and endpoints; send messages. | | Billing | `billing:read` | Read the plan, usage, invoices and credits. | Keys are secrets. Call coss.com from your server, never from a browser: the SDK refuses to run where a `document` global exists unless you opt in with `dangerouslyAllowBrowser`. Creating a live key requires a verified email address on your account. ## Sandbox behaviour [#sandbox-behaviour] Sandbox keys accept any `from` address and never deliver anything. Delivery events are simulated the way the Amazon SES mailbox simulator behaves, so you can test failure handling: | Recipient | Simulated events | Recipient status | | ------------------------------------------ | ------------------------------------------------- | ---------------- | | any address outside `simulator.amazonses.com` | `email.delivered` | `delivered` | | `bounce@simulator.amazonses.com` | `email.bounced` (permanent) | `bounced` | | `complaint@simulator.amazonses.com` | `email.delivered`, then `email.complained` | `complained` | | `suppressionlist@simulator.amazonses.com` | `email.bounced` (on the suppression list) | `suppressed` | Every sandbox email also gets `email.sent`. Every other product works in a sandbox too, and nothing is billed unless the table says so: | Product | In a sandbox | Testing | | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | | [Marketing email](/docs/email/broadcasts) | Broadcasts and other marketing sends are simulated like any email above. | The table above | | [Inboxes](/docs/inboxes) | Every inbox can send, and nothing is delivered. Simulate received mail from the dashboard; real mail to one is received. | [Testing inboxes](/docs/inboxes/testing) | | [SMS](/docs/sms) | Any `from` number works, nothing is sent, and the simulator's numbers produce each delivery outcome. | [SMS simulator](/docs/sms/testing) | | [Verify](/docs/verify) | The code is always zeros, and nothing reaches a phone or mailbox. The fraud guard still runs. | [Testing Verify](/docs/verify/testing) | | [Sign](/docs/sign) | Requests complete on the real signing page, which says it's a test. Emails go to the dashboard, not to signers. | [Testing Sign](/docs/sign/testing) | | [Forms](/docs/forms) | Posts are screened, stored and delivered, and emails go to the dashboard. `http://localhost` is allowed while you develop. | [Testing Forms](/docs/forms/testing) | | [Scheduling](/docs/scheduling) | Everything works as live, with simulated calendars available. Nobody is emailed. | [Testing Scheduling](/docs/scheduling/testing) | | [Hooks](/docs/hooks) | Messages are delivered for real to your endpoints' URLs, under lower limits. | [Testing Hooks](/docs/hooks/testing) | | [Risk](/docs/risk) | Assessments work as live with their own memory, and test inputs trigger each reason. | [Testing Risk](/docs/risk/testing) | Real mail a sandbox environment receives, at an inbox or any of its addresses, is billed as [received email](/docs/email/receiving#limits-and-retention). # Introduction (/docs) coss.com puts every product behind a single API key and a single SDK: - [Email](/docs/email/sending): transactional and marketing email from your own domains, and email you receive. - [Inboxes](/docs/inboxes): email addresses for AI agents, with conversations kept as threads. - [SMS](/docs/sms): text messages from your own registered numbers, and their replies. - [Sign](/docs/sign): e-signatures in your product, embedded or by email. - [Verify](/docs/verify): one-time codes by SMS or email, behind a fraud guard. - [Forms](/docs/forms): hosted form endpoints for your site, screened for spam. - [Scheduling](/docs/scheduling): let your users be booked, with calendars and double-booking handled. - [Hooks](/docs/hooks): webhooks you send to your customers, delivered and retried for you. - [Risk](/docs/risk): abuse checks for sign-ups, logins, payments and posts. What every product shares (webhooks, logs, members and single sign-on, reputation, billing) is under [Platform](/docs/webhooks), and the SDKs, framework integrations, CLI and MCP server under [SDKs and tools](/docs/sdk). You create an organization, add a project, and call every product with the same key and the same client: ```ts import { Coss } from "coss"; const coss = new Coss({ apiKey: process.env.COSS_API_KEY }); await coss.email.send({ from: "Acme ", to: "user@example.com", subject: "Welcome", html: "

Hi there

", }); ``` Start with the [Quickstart](/docs/quickstart), then find your product below. Each section has its own sidebar; the [API reference](/docs/api-reference) has every endpoint, grouped the same way. ## Sections [#sections] - [Get started](/docs): What coss.com is, your first email, and the keys every product shares. [Migrating](/docs/migrate) - [Email](/docs/email): Transactional and marketing email from your own domains, and email you receive. [Sending and receiving](/docs/email/sending), [Deliverability](/docs/email/domains), [Tracking](/docs/email/delivery), [Marketing](/docs/email/contacts) - [Inboxes](/docs/inboxes): Email addresses for AI agents: conversations kept as threads, replies from the same address. [Overview](/docs/inboxes), [Threads and messages](/docs/inboxes/threads), [Testing](/docs/inboxes/testing) - [SMS](/docs/sms): Text messages from your own registered numbers, and the replies they receive. [Overview](/docs/sms), [Sending SMS](/docs/sms/sending), [Numbers and registration](/docs/sms/senders), [Receiving SMS](/docs/sms/receiving), [Testing SMS](/docs/sms/testing), [Countries and pricing](/docs/sms/countries-and-pricing) - [Sign](/docs/sign): E-signatures in your product: embedded or by email, with an audit trail and a sealed copy. [Overview](/docs/sign), [Embedded signing](/docs/sign/embedded-signing), [Email signing](/docs/sign/email-signing), [Fields and anchors](/docs/sign/fields-and-anchors), [Templates](/docs/sign/templates), [Completion and the audit trail](/docs/sign/completion-and-audit-trail), [Testing](/docs/sign/testing) - [Verify](/docs/verify): One-time codes by SMS or email, behind a fraud guard that stops SMS pumping. [Overview](/docs/verify), [SMS codes](/docs/verify/sms), [Email codes](/docs/verify/email), [Fraud guard](/docs/verify/fraud-guard), [Testing](/docs/verify/testing) - [Forms](/docs/forms): Hosted form endpoints for your site, screened by Risk and delivered to webhooks, email and contacts. [Overview](/docs/forms), [HTML forms](/docs/forms/html-forms), [JavaScript](/docs/forms/javascript), [Hosted pages](/docs/forms/hosted-pages), [Spam filtering](/docs/forms/spam-filtering), [Double opt-in](/docs/forms/double-opt-in), [Destinations](/docs/forms/destinations), [File uploads](/docs/forms/file-uploads), [Testing](/docs/forms/testing) - [Scheduling](/docs/scheduling): Availability and bookings for your users, from the team behind Cal.com. [Overview](/docs/scheduling), [Hosts and availability](/docs/scheduling/hosts), [Out of office](/docs/scheduling/out-of-office), [Holidays](/docs/scheduling/holidays), [Reassigning](/docs/scheduling/reassigning), [Calendars](/docs/scheduling/calendars), [Calendar delegation](/docs/scheduling/delegation), [Your own OAuth apps](/docs/scheduling/oauth-apps), [Zoom](/docs/scheduling/zoom), [Bookings](/docs/scheduling/bookings), [Pools and groups](/docs/scheduling/pools-and-groups), [Routing](/docs/scheduling/routing), [Embedding](/docs/scheduling/embedding), [Notifications](/docs/scheduling/notifications), [Reminders](/docs/scheduling/reminders), [Privacy](/docs/scheduling/privacy), [Testing](/docs/scheduling/testing) - [Hooks](/docs/hooks): Webhooks as a service: send each event once, and coss.com delivers it to your customers' endpoints. [Overview](/docs/hooks), [Portal](/docs/hooks/portal), [Receiving messages](/docs/hooks/receiving), [Delivery, retries and limits](/docs/hooks/delivery), [Testing](/docs/hooks/testing) - [Risk](/docs/risk): Decide whether a sign-up, login, payment or post looks like abuse, and why. [Assessments](/docs/risk), [Signals](/docs/risk/checkout), [Building blocks](/docs/risk/lookups), [Review and tuning](/docs/risk/lists-and-feedback) - [Platform](/docs/webhooks): What every product shares: webhooks, logs, members and sign-in, reputation, billing and retention. [Events and logs](/docs/webhooks), [Team and sign-in](/docs/members-and-roles), [Reputation](/docs/reputation), [Account](/docs/support), [Compliance](/docs/hipaa) - [SDKs and tools](/docs/sdk): The TypeScript SDK, the SDKs of six more languages, framework integrations, the CLI and the MCP server. [TypeScript SDK](/docs/sdk), [Other languages](/docs/sdks), [Integrations](/docs/integrations), [CLI and agents](/docs/agents) - [API reference](/docs/api-reference): Every endpoint of the HTTP API, with SDK and HTTP examples you can run. [Email](/docs/api-reference/emails/list-emails), [Inboxes](/docs/api-reference/inboxes/list-inboxes), [Marketing](/docs/api-reference/contacts/list-contacts), [SMS](/docs/api-reference/sms/list-sms), [Sign](/docs/api-reference/signature-requests/list-sign-requests), [Verify](/docs/api-reference/verifications/list-verifications), [Forms](/docs/api-reference/forms/list-forms), [Scheduling](/docs/api-reference/scheduling-hosts/list-scheduling-hosts), [Hooks](/docs/api-reference/hooks-applications/list-hook-applications), [Risk](/docs/api-reference/risk/list-risk-assessments), [Platform](/docs/api-reference/environment/get-environment) # Overview (/docs/migrate) Moving from another provider doesn't mean rebuilding your account by hand. The dashboard's **Import** page (an environment's **Developers** pages) reads your old account through its API and brings what you choose into that environment: | Provider | Domains | Templates | Contacts and lists | Suppressions | Webhook endpoints | | --------------------------------- | ------- | --------- | ------------------ | ------------ | ----------------- | | [Resend](/docs/migrate/resend) | Yes | Yes | Yes | Where your account has Resend's suppression API | Yes | | [SendGrid](/docs/migrate/sendgrid) | Yes | Yes | Yes | Yes | Yes | | [Postmark](/docs/migrate/postmark) | With an account token | Yes | Postmark keeps none | Yes | Yes | Nothing changes in your old account: an import only reads it. Imports run in the dashboard only. There is no API, SDK or CLI for them, so your old provider's key never passes through your own code. ## How an import runs [#how-an-import-runs] 1. **Connect.** Choose the provider and paste an API key. coss.com checks it with one or two requests to the provider. Each organization can check only a limited number of keys a day. 2. **coss.com reads your account.** This usually takes seconds. With large contact lists it can take a few minutes, because some providers have no way to count contacts other than listing them. 3. **Choose.** The page shows what was found. Pick the kinds to import and, for domains, which ones. Starting an import needs the same permissions as creating those things yourself: domains, templates (create and publish), contacts, suppressions and webhooks. 4. **Import.** The import runs in the background, and the page follows its progress. You can leave it and come back. Imports go at a pace that stays well within your old provider's rate limits, which your live sending there shares. 5. **Next steps.** When the import is done, its report lists what was imported, what was already there, what was skipped and why, and what's left for you to do. You can cancel an import at any time. Whatever it imported up to then stays. ## Your old provider's key [#your-old-providers-key] The key is stored encrypted, only for the import. It is deleted as soon as the import finishes or is canceled. An import you never start is deleted, key included, after 24 hours. Revoke the key at your old provider once you're done. Import reports are kept for 90 days (see [data retention](/docs/data-retention)). What an import created is yours, like anything you create yourself. ## What each kind becomes [#what-each-kind-becomes] - **Domains** are added to the organization, so every environment can send from them. Each one needs coss.com's DNS records before it verifies (see [domains](/docs/email/domains)). Where your DNS provider supports it, **Connect DNS** on the domain's page adds them in one click. coss.com's DKIM records sit next to your old provider's, so you can keep sending through the old provider until you switch. An organization can have only a few domains waiting for verification at once. If you import more than that, verify some and import the rest in a second import. - **Templates** are converted to [coss.com's template language](/docs/email/templates). A template that converts exactly is published, ready to send. One that uses something coss.com templates don't have (a formatting helper, a partial, a comparison) is left as a **draft**, with the parts to fix marked in the report. coss.com variable names can't contain dots, so nested data is flattened: `{{user.name}}` becomes `{{user_name}}`, and the report lists every rename. Your sends then pass `user_name`, because coss.com refuses variables a template doesn't declare. - **Contacts** come with their names, custom fields and topic choices; lists become [audiences](/docs/email/audiences-and-segments). Custom fields become contact properties with lower-case keys (`Company Size` becomes `company_size`, and a name coss.com uses itself, like `email`, gets the provider's name in front: `sendgrid_email`). Imports never re-subscribe a contact who unsubscribed, and never turn a topic opt-out into an opt-in. A value coss.com can't read (say, a date in another format) is left out, and the contact is still imported. Your plan's contact limit applies: past it, the rest of the contacts aren't imported, but the other kinds still are. - **Suppressions** keep their reason (bounce, complaint, unsubscribe or manual) and their date, so nobody who bounced, complained or unsubscribed gets your email again. See [suppressions](/docs/email/suppressions). - **Webhook endpoints** keep their URL, and their events are mapped to [coss.com's events](/docs/webhooks#events). They are created **disabled**, each with a new signing secret: your handler still expects the old provider's payloads and signatures. Update it to coss.com's events, verify the [Standard Webhooks signature](/docs/webhooks#verifying-requests) with the endpoint's secret, then enable the endpoint. An endpoint none of whose events exist on coss.com is skipped. ## Importing again [#importing-again] Run another import whenever you like, for example to pick up contacts added since the last one. An import finds what's already there by its name and leaves it alone: a domain of the same name, a template with the same alias, a custom field, topic or audience with the same key or name, a webhook endpoint with the same URL. Contacts are matched by address. Their names and custom fields are updated, and their subscription is never changed back to subscribed. ## Switching your code [#switching-your-code] Once your domains verify, point your code at coss.com. Each provider's page shows how its calls map: [Resend](/docs/migrate/resend#switch-your-code), [SendGrid](/docs/migrate/sendgrid#switch-your-code) and [Postmark](/docs/migrate/postmark#switch-your-code). If your app sends through a mail library or a framework mailer, an [integration](/docs/integrations) may only need a configuration change. # From Postmark (/docs/migrate/postmark) Start an import from the dashboard's **Import** page (see the [overview](/docs/migrate)) with a Postmark token: - An **account token** (Postmark's API Tokens page) imports domains as well, and lets you choose which server to import. coss.com reads that server's own token from Postmark on each run and never stores it. - A **server token** imports only its server, without domains. Each import brings one server into one environment. To bring over several servers (say, production and staging), import each into its own environment. Postmark keeps no contacts, lists or custom fields, so there are none to import. ## What's imported [#whats-imported] | Postmark | coss.com | | ---------------------------- | ---------------------------------------------------------------------------- | | Domains | [Domains](/docs/email/domains) of the organization, to verify with coss.com's DNS records | | Templates (with their layouts) | [Templates](/docs/email/templates), with the same alias | | Suppressions of every stream | [Suppressions](/docs/email/suppressions), with their dates | | Webhooks, the inbound webhook | Disabled [webhook endpoints](/docs/webhooks) with new secrets | **Not imported:** layouts as templates of their own (each template gets its layout merged in), inbound rules, message streams' settings, server and account tokens, and webhooks' basic auth credentials and custom headers (coss.com signs its requests instead). ### Suppressions [#suppressions] Suppressions of transactional and broadcast streams are imported; inbound streams are skipped: | Postmark reason | Transactional stream | Broadcast stream | | ------------------------------------- | ------------------------------------ | -------------------------------------------------- | | Hard bounce | Every email (`*`), reason `bounce` | Every email (`*`), reason `bounce` | | Spam complaint | Every email (`*`), reason `complaint`| Every email (`*`), reason `complaint` | | Manual, by the recipient (unsubscribed) | Every email (`*`), reason `unsubscribe` | Marketing email (`stream:marketing`), reason `unsubscribe` | | Manual, by you or Postmark | Every email (`*`), reason `manual` | Marketing email (`stream:marketing`), reason `manual` | Postmark's broadcast streams match coss.com's [marketing stream](/docs/email/streams). ## Templates [#templates] Postmark templates use Mustachio. The import merges each template into its layout (at `{{{ @content }}}`) and converts it to coss.com's template language. Postmark's suggested template model, the data a template expects, tells loops from objects and text from numbers: | Mustachio | coss.com | | ---------------------------------------- | -------------------------------------------------------- | | `{{name}}`, `{{{html}}}`, `{{& html}}` | `{{name}}`, `{{{html}}}` | | `{{company.name}}` | `{{company_name}}` (the report lists every rename) | | `{{#each items}}{{name}}{{/each}}` | `{{#each items}}{{name}}{{/each}}`, a list of objects | | `{{#items}}…{{/items}}` over a list | `{{#each items}}…{{/each}}` | | `{{#name}}…{{/name}}` over a value | `{{#if name}}…{{/if}}` | | `{{^name}}…{{/name}}` | `{{#if name}}{{else}}…{{/if}}` | | `../name` in a loop | The top-level `{{name}}` | | `{{! comment }}` | Dropped | | `{{{ pm:unsubscribe }}}` | `{{{unsubscribe_url}}}` in a link's `href`, else a link to it | `{{{unsubscribe_url}}}` is filled on [marketing sends](/docs/email/streams). A template that converts exactly is published. These are left in the draft as they were, for you to rewrite before you publish it: partials, changed delimiters, sections over an object (their fields become separate variables, shown even when the object is missing), loops inside loops, lists of plain values (`{{.}}`: each item becomes an object with a `value` field) and `{{#name}}` over a number (coss.com treats `0` as true). A template keeps its Postmark alias when it is a valid coss.com alias (lower-case letters, digits, `-` and `_`; aliases are lower-cased). One without an alias gets one made from its name. ## Webhooks [#webhooks] Each webhook becomes an endpoint subscribed to the coss.com events its enabled triggers map to: | Postmark trigger | coss.com events | | -------------------- | --------------------------------------------------------------- | | Delivery | `email.delivered` | | Bounce | `email.bounced` (permanent) and `email.delivery_delayed` (temporary) | | Spam complaint | `email.complained` | | Open | `email.opened` | | Click | `email.clicked` | | Subscription change | `email.unsubscribed` (reactivations have no coss.com event) | Postmark's webhooks belong to a message stream; coss.com's endpoints get the whole environment's events. The server's inbound webhook becomes an endpoint for `email.received`, which carries the message's details, not the whole message (fetch it [through the API](/docs/email/receiving)); mail reaches it once you [set up receiving](/docs/email/receiving). The payloads differ from Postmark's, and requests are signed with the endpoint's new secret, so update your handler before you enable an endpoint (see [verifying requests](/docs/webhooks#verifying-requests)). ## Domains and DNS [#domains-and-dns] coss.com's records (DKIM CNAMEs and the `send` subdomain for bounces) don't collide with Postmark's (`…pm._domainkey` and the `pm-bounces` Return-Path). Add them and keep sending through Postmark while they verify. ## Switch your code [#switch-your-code] A template send with the `postmark` library: ```ts await client.sendEmailWithTemplate({ From: "hello@acme.com", To: "ada@example.com", TemplateAlias: "welcome", TemplateModel: { name: "Ada", company: { name: "Acme" } }, MessageStream: "outbound", }); ``` On coss.com, the template keeps its alias and nested data uses the renamed variables. coss.com returns errors instead of throwing them: ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // reads COSS_API_KEY // ---cut--- const { data, error } = await coss.email.send({ from: "hello@acme.com", to: "ada@example.com", template_id: "welcome", variables: { name: "Ada", company_name: "Acme" }, }); ``` For a broadcast stream, send with `stream: "marketing"`: marketing email goes to one recipient per send and needs your [postal address](/docs/email/topics-and-preferences#your-postal-address). # From Resend (/docs/migrate/resend) Start an import from the dashboard's **Import** page (see the [overview](/docs/migrate)) with a Resend API key that has **full access**. A sending-only key can't read your account, and the import refuses it. Resend shares one rate limit between all of a team's keys, your live sending included, so imports read your account at a fraction of it. Contacts are the slow part. Resend returns a contact's custom properties and topic choices one contact at a time, so with properties or topics an import brings over a few thousand contacts an hour. ## What's imported [#whats-imported] | Resend | coss.com | | ------------------------------- | ---------------------------------------------------------------------------- | | Domains | [Domains](/docs/email/domains) of the organization, to verify with coss.com's DNS records | | Templates | [Templates](/docs/email/templates), with the same alias | | Contacts | [Contacts](/docs/email/contacts), unsubscribed ones still unsubscribed | | Contact properties | Contact properties (`string` and `number`, fallbacks kept) | | Segments | [Audiences](/docs/email/audiences-and-segments) with the same members | | Topics | [Topics](/docs/email/topics-and-preferences), with each contact's choices | | Suppressions | [Suppressions](/docs/email/suppressions) for every email, same reason and date | | Webhooks | Disabled [webhook endpoints](/docs/webhooks) with new secrets | **Not imported:** broadcasts, API keys, a template's `from` and reply-to addresses (pass them with each send; the report notes which templates had them), domains' open and click tracking settings (see [tracking](/docs/email/tracking)), and webhook signing secrets. ### Suppressions [#suppressions] Resend's suppression API isn't available to every account. Where it is, bounces, complaints and manual entries become suppressions for every email (scope `*`) with the same reason. Where it isn't, the import says so: export the list from Resend's dashboard and import the CSV on the **Suppressions** page ([importing](/docs/email/suppressions#importing-and-exporting)). Contacts who unsubscribed are imported as `unsubscribed` contacts, which marketing email skips. ### Topics [#topics] A topic's key, which is what a send's `category` names, is made from its name in lower case: `Product updates` becomes `product_updates`. Its default subscription and visibility are kept, and so is each contact's opt-in or opt-out. ## Templates [#templates] Resend templates fill `{{{VARIABLE}}}` placeholders. The import converts them to coss.com's template language and declares every variable the Resend template had: - `{{{NAME}}}` stays raw in the HTML and becomes `{{NAME}}` in the subject and text, which are never HTML-escaped anyway. - A variable's type (`string` or `number`) is kept. Its fallback becomes its default; one without a fallback is required, as it was in Resend. `{{{NAME|fallback}}}` becomes a default too. - Names keep their case, so you keep sending `FIRST_NAME`. A name with dots is flattened: `{{{order.id}}}` becomes `{{order_id}}`. - `{{{UNSUBSCRIBE_URL}}}` (and `{{{RESEND_UNSUBSCRIBE_URL}}}`) becomes `{{{unsubscribe_url}}}`, which coss.com fills on [marketing sends](/docs/email/streams). - `FIRST_NAME`, `LAST_NAME` and `EMAIL` came from the contact on Resend's broadcasts. Here they are ordinary variables: pass them when you send. A template whose placeholders all convert is published. Anything else is left as a draft, with what to fix listed in the report. A template keeps its Resend alias when it is a valid coss.com alias (lower-case letters, digits, `-` and `_`); otherwise the alias is made from its name. ## Webhooks [#webhooks] Resend's email and contact events have the same names on coss.com: `email.sent`, `email.delivered`, `email.delivery_delayed`, `email.bounced`, `email.complained`, `email.failed`, `email.opened`, `email.clicked`, `email.scheduled`, `email.suppressed`, `email.received`, `contact.created`, `contact.updated` and `contact.deleted`. `contact.topics.updated` becomes `contact.unsubscribed` and `contact.updated`. Domain, suppression, topic and inbox events have no coss.com counterpart, and the report lists them as left out. The payloads differ from Resend's, and requests are signed with the endpoint's new secret, so update your handler before you enable an endpoint (see [verifying requests](/docs/webhooks#verifying-requests)). ## Domains and DNS [#domains-and-dns] coss.com's DKIM records don't collide with Resend's, so add them and keep sending through Resend while they verify. Both use the domain's `send` subdomain for bounces (its MX and SPF records): compare the `send` records coss.com shows with Resend's, and change any that differ when you switch your sending over. ## Switch your code [#switch-your-code] coss.com's SDK returns `{ data, error }` like Resend's and takes the same fields, in snake case (`reply_to`, `scheduled_at`): ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // reads COSS_API_KEY // ---cut--- const { data, error } = await coss.email.send({ from: "Acme ", to: "ada@example.com", reply_to: "support@acme.com", subject: "Your receipt", html: "

Thanks for your order.

", }); ``` Send an imported template by its alias, with its variables: ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // ---cut--- const { data, error } = await coss.email.send({ from: "Acme ", to: "ada@example.com", template_id: "welcome", variables: { FIRST_NAME: "Ada" }, }); ``` Topic choices apply to sends that name the topic's key as their `category`. # From SendGrid (/docs/migrate/sendgrid) Start an import from the dashboard's **Import** page (see the [overview](/docs/migrate)) with a SendGrid API key. A restricted key works: give it read access to everything you want to import. If the key can't read something, the import shows that kind as unavailable instead of failing. Keys of EU regional subusers are recognized and read from SendGrid's EU API. ## What's imported [#whats-imported] | SendGrid | coss.com | | ---------------------------- | ---------------------------------------------------------------------------- | | Authenticated domains | [Domains](/docs/email/domains) of the organization, to verify with coss.com's DNS records | | Dynamic and legacy templates | [Templates](/docs/email/templates), the active version, with the template id as alias | | Marketing contacts | [Contacts](/docs/email/contacts) with their names and custom fields | | Custom fields | Contact properties: Text, Number and Date become `string`, `number` and `date` | | Lists | [Audiences](/docs/email/audiences-and-segments) with the same members | | Unsubscribe groups | [Topics](/docs/email/topics-and-preferences); their members are opted out | | Bounces, invalid emails, spam reports, global unsubscribes | [Suppressions](/docs/email/suppressions), with their dates | | Event webhooks, Inbound Parse | Disabled [webhook endpoints](/docs/webhooks) with new secrets | **Not imported:** segments, Single Sends and automations, reserved contact fields other than the names (address, phone and so on), blocks (they're temporary), link branding, subusers, API keys, inactive template versions and webhook signing secrets. Contacts come out of SendGrid's contact export, which SendGrid prepares in the background. The import waits for it, which can take a few minutes for large lists. Each list's members come from an export of their own. ### Suppressions [#suppressions] | SendGrid list | coss.com suppression | | ----------------------- | ------------------------------------------ | | Bounces | Every email (`*`), reason `bounce` | | Invalid emails | Every email (`*`), reason `bounce` | | Spam reports | Every email (`*`), reason `complaint` | | Global unsubscribes | Every email (`*`), reason `unsubscribe` | | Unsubscribe group members | An opt-out of the group's topic for contacts; for other addresses, a suppression for the topic's category, reason `unsubscribe` | Global unsubscribes suppress every email, transactional included, as they did in SendGrid. ### Unsubscribe groups [#unsubscribe-groups] Each unsubscribe group becomes a topic that everyone gets until they opt out (`opt_in` by default), shown in the [preference center](/docs/email/topics-and-preferences#the-preference-center). Its key is made from its name in lower case (`Weekly digest` becomes `weekly_digest`); the report lists each group's key. Where you passed `asm.groupId`, pass the key as the send's `category`. ## Templates [#templates] Dynamic templates are Handlebars. The import converts them to coss.com's template language, using each version's test data to tell text from numbers and lists from objects: | Handlebars | coss.com | | -------------------------------------------- | ------------------------------------------------------ | | `{{name}}`, `{{{html}}}` | The same | | `{{user.name}}` | `{{user_name}}` (the report lists every rename) | | `{{insert name "default=there"}}` | `{{name}}`, declared with the default `there` (a default applies to every use on coss.com, so a template that also uses `name` without it stays a draft) | | `{{#if x}}…{{else if y}}…{{else}}…{{/if}}` | Nested `{{#if}}` blocks | | `{{#unless x}}…{{/unless}}` | `{{#if x}}{{else}}…{{/if}}` | | `{{#each items}}{{this.name}}{{/each}}` | `{{#each items}}{{name}}{{/each}}`, a list of objects | | `../name` and `@root.name` in a loop | The top-level `{{name}}` | | `{{!-- comment --}}` | Dropped | | `{{{unsubscribe}}}`, `<%asm_group_unsubscribe_raw_url%>`, `<%asm_global_unsubscribe_raw_url%>` | `{{{unsubscribe_url}}}` | | `{{{unsubscribe_preferences}}}`, `<%asm_preferences_raw_url%>` | `{{{preferences_url}}}` | | `{{Sender_Address}}` | `{{{mailing_address}}}`, your [postal address](/docs/email/topics-and-preferences#your-postal-address) | A template that converts exactly is published. These are left in the draft as they were, for you to rewrite before you publish it: other helpers (`formatDate`, `equals`, `notEquals`, `greaterThan`, `lessThan`, `and`, `or`, `length` and your own), sub-expressions, `@index`, `@first` and `@last`, partials, loops inside loops, `~` whitespace control (removed: check the spacing it trimmed, such as inside a link), `{{#with}}` (its fields become separate variables), lists of plain values (each item becomes an object with a `value` field) and `{{#if}}` over a number (coss.com treats `0` as true). The other `Sender_*` tags are removed: coss.com prints the whole postal address as `{{{mailing_address}}}`. The unsubscribe and address placeholders are filled on [marketing sends](/docs/email/streams). Legacy templates are always imported as drafts. `<%body%>` and `<%subject%>` become `{{{body}}}` and `{{subject}}`, but their substitution tags (like `-name-`) use delimiters each sender chose, so replace them with variables yourself. A template SendGrid generated the plain-text part for is imported without one: coss.com generates it from the HTML when it sends. ## Webhooks [#webhooks] Each event webhook becomes an endpoint subscribed to the coss.com events its enabled events map to: | SendGrid event | coss.com events | | ----------------------- | ------------------------------------------------------- | | `processed` | `email.sent` | | `delivered` | `email.delivered` | | `deferred` | `email.delivery_delayed` | | `bounce` | `email.bounced` (permanent bounces only) | | `dropped` | `email.suppressed` and `email.failed` | | `spam_report` | `email.complained` | | `open`, `click` | `email.opened`, `email.clicked` | | `unsubscribe` | `email.unsubscribed` | | `group_unsubscribe` | `email.unsubscribed` and `contact.unsubscribed` | | `group_resubscribe` | `contact.updated` | | `account_status_change` | `account.suspended`, `account.reinstated` and `account.reputation_warning` | An Inbound Parse URL becomes an endpoint for `email.received`. That event carries the message's details, not the whole message (fetch it [through the API](/docs/email/receiving)), and mail reaches it once you [set up receiving](/docs/email/receiving) for the hostname. The payloads differ from SendGrid's, and requests are signed with the endpoint's new secret, so update your handler before you enable an endpoint (see [verifying requests](/docs/webhooks#verifying-requests)). ## Domains and DNS [#domains-and-dns] coss.com's records (DKIM CNAMEs and the `send` subdomain for bounces) don't collide with SendGrid's (`em…`, `s1._domainkey`, `s2._domainkey`). Add them and keep sending through SendGrid while they verify. ## Switch your code [#switch-your-code] A dynamic template send in `@sendgrid/mail`: ```ts await sgMail.send({ from: "hello@acme.com", to: "ada@example.com", templateId: "d-2c214ac919e84170b1b8d5e9e7da6a72", dynamicTemplateData: { user: { name: "Ada" }, total: 42 }, asm: { groupId: 12345 }, }); ``` On coss.com, the template keeps its id as its alias, nested data uses the renamed variables, and the group becomes a category. coss.com returns errors instead of throwing them: ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // reads COSS_API_KEY // ---cut--- const { data, error } = await coss.email.send({ from: "hello@acme.com", to: "ada@example.com", template_id: "d-2c214ac919e84170b1b8d5e9e7da6a72", variables: { user_name: "Ada", total: 42 }, category: "weekly_digest", }); ``` A send with its own content takes `subject`, `html` and `text`, and `reply_to`, `cc`, `bcc`, `attachments` and `scheduled_at` like any [send](/docs/email/sending). # Quickstart (/docs/quickstart) ### Create an API key [#create-an-api-key] In the dashboard, open your project's **Development** environment and create an API key. A new organization starts with a project and opens there. Development keys start with `coss_test_`: emails sent with them are recorded but never delivered, so you can experiment freely. See [Environments and API keys](/docs/environments). ```bash export COSS_API_KEY=coss_test_... ``` Or, in your project's directory, let the [CLI](/docs/cli#set-a-project-up) do this step and the next: `npx coss-cli init` asks you to approve a development key for the project in the dashboard (creating your account, organization and project on the way if you're new), writes it to `.env.local` (Next.js) or `.env` as `COSS_API_KEY` and installs the SDK. Building with a coding agent? See [Coding agents](/docs/agents). ### Install the SDK [#install-the-sdk] ```package-install coss ``` ### Send an email [#send-an-email] The client reads `COSS_API_KEY` from the environment when you don't pass `apiKey`. ```ts twoslash title="send.ts" import { Coss } from "coss"; const coss = new Coss(); const { data, error } = await coss.email.send({ from: "Acme ", to: "user@example.com", subject: "Hello from coss.com", html: "

It works!

", }); if (error) { console.error(error.code, error.message); } else { console.log(data.id, data.status); // ^? } ``` Every method returns `{ data, error }` and never throws for API or network failures. The same email from one of the [other SDKs](/docs/sdks), which read `COSS_API_KEY` too: ```python # pip install cosscom from coss import Coss client = Coss() email = client.email.send( from_="Acme ", to=["user@example.com"], subject="Hello from coss.com", html="

It works!

", ) print(email.id, email.status) ```
```go // go get github.com/cosscom/coss-go client := cossclient.NewClient() email, err := client.Email.Send(context.Background(), &coss.SendEmailBody{ Body: &coss.SendEmailRequest{ From: "Acme ", To: &coss.SendEmailRequestTo{StringList: []string{"user@example.com"}}, Subject: coss.String("Hello from coss.com"), HTML: coss.String("

It works!

"), }, }) ```
```ruby # bundle add coss require "coss" client = Coss::Client.new email = client.email.send_( from: "Acme ", to: ["user@example.com"], subject: "Hello from coss.com", html: "

It works!

" ) puts email.id, email.status ```
```php // composer require coss/coss $client = new Coss\Coss(); $email = $client->email->send(new Coss\Email\Requests\SendEmailBody([ 'body' => new Coss\Types\SendEmailRequest([ 'from' => 'Acme ', 'to' => ['user@example.com'], 'subject' => 'Hello from coss.com', 'html' => '

It works!

', ]), ])); echo $email->id, ' ', $email->status; ```
```java // implementation("com.coss:coss:0.1.0") Coss client = Coss.builder().build(); Email email = client.email().send(SendEmailRequest.builder() .from("Acme ") .to(SendEmailRequestTo.of(Arrays.asList("user@example.com"))) .subject("Hello from coss.com") .html("

It works!

") .build()); ```
```csharp // dotnet add package Coss var client = new Coss.CossClient(); var email = await client.Email.SendAsync(new Coss.SendEmailBody { Body = new Coss.SendEmailRequest { From = "Acme ", To = new[] { "user@example.com" }, Subject = "Hello from coss.com", Html = "

It works!

", }, }); ```
### Follow delivery [#follow-delivery] Each recipient has its own delivery status. Fetch the email again, or [subscribe to webhooks](/docs/webhooks) to be told when it changes. ```ts twoslash import { Coss } from "coss"; const coss = new Coss(); // ---cut--- const { data: email } = await coss.email.get("email_01k7c8m4q2f3e9v6t5r1n0p8yz"); for (const recipient of email?.recipients ?? []) { console.log(recipient.address, recipient.status); } ```
When you are ready to deliver real email, [verify a domain](/docs/email/domains) and switch to a key from the **Production** environment. # Coding agents (/docs/agents) Give your agent one prompt: ```text Add coss.com to this project: read https://coss.com/llms.txt, get a development key with `npx coss-cli init --agents`, and build and test with it. ``` From there the agent reads what it needs from the docs, asks you to approve a development key in your browser, installs the SDK and tests its code with that key. Nothing it sends is delivered until you switch to a production key yourself. ## What agents read [#what-agents-read] - **[/llms.txt](/llms.txt)** starts with a short brief (how to get a key, how the SDK reports errors, how to test webhooks), then lists the guides and says where each product's API operations are. - **`/docs//llms.txt`**, such as [/docs/sign/llms.txt](/docs/sign/llms.txt), lists a product's guides with a summary of each, and its API operations. [/docs/api-reference/llms.txt](/docs/api-reference/llms.txt) lists every operation. - **Every docs page is Markdown** at its URL plus `.md`: [/docs/email/sending.md](/docs/email/sending.md). The HTML pages point to it too (``), and each has a **Copy Markdown** button for pasting it into a chat yourself. - **API reference pages** list each operation's method and URL, parameters, request body, responses and errors, with examples for the TypeScript SDK, HTTP and the [other SDKs](/docs/sdks): [/docs/api-reference/emails/send-email.md](/docs/api-reference/emails/send-email.md). The [OpenAPI 3.1 document](https://api.coss.com/openapi.json) describes the same API. - **[/llms-full.txt](/llms-full.txt)** is every guide in one file, with a short entry per API operation. It's large: agents usually do better fetching the pages they need. ## Development keys [#development-keys] `npx coss-cli init`, run in the project, gets the agent a key without you copying one around: it opens the dashboard, you check the code and approve a key for that project (development environments only), and the [CLI](/docs/cli#set-a-project-up) writes it to `.env.local` (Next.js) or `.env` as `COSS_API_KEY` and installs the `coss` package. Where no browser can open (over SSH, in a container or an agent's cloud sandbox), it prints a link instead and waits for the code that page shows, typed into the terminal: run it yourself there. Development keys work with every API and never deliver anything; emails and SMS get simulated outcomes, events and webhooks (see [sandbox behaviour](/docs/environments#sandbox-behaviour)). So the agent can run what it writes, and `coss listen` forwards the resulting webhooks to its local handler. `npx coss-cli init` adds a short coss.com section to the project's `AGENTS.md` (or `CLAUDE.md` when there is no `AGENTS.md`), so later sessions know where the docs are and how to test without reading this again. `--no-agents` skips that. It also prints the one next step for the key, and the drop-in when the project already uses a mail library. ## Claude Code plugin [#claude-code-plugin] The coss.com plugin gives Claude Code a skill for building with coss.com (loaded when a task involves it) and the [MCP server](/docs/mcp): ```text /plugin install coss --marketplace cosscom/coss ``` On Claude Code before 2.1.275, add the marketplace first: `/plugin marketplace add cosscom/coss`, then `/plugin install coss@coss`. It asks for an API key for the MCP server. Use a development key (`coss_test_…`), or leave it empty: the server's docs tools work without one. Every product's tools together take up a lot of an agent's context. To offer only the ones you use, set the plugin's optional **MCP toolsets** to a comma-separated list such as `email,sms` ([the toolsets](/docs/mcp)). Left empty, the server offers every tool. ## Cursor, Codex and other agents [#cursor-codex-and-other-agents] The same skill installs into Cursor, Codex, GitHub Copilot, Windsurf and other agents with the [skills CLI](https://github.com/vercel-labs/skills): ```sh npx skills add cosscom/coss ``` Add the [MCP server](/docs/mcp) as well to let the agent search these docs, look up emails and SMS, explain why one wasn't delivered, and set up and read marketing, Verify, Sign, Forms, Scheduling, Hooks and Risk. An agent that can't start a local process can use the [hosted server](/docs/mcp#hosted-server) at `https://api.coss.com/mcp`, with its key in a header. # CLI (/docs/cli) The `coss` command line works with one environment at a time, like an API key does. Install it with Homebrew, the install script or npm: ```sh brew install cosscom/tap/coss # macOS and Linux, with shell completions curl -fsSL https://raw.githubusercontent.com/cosscom/coss/main/packages/cli/install.sh | sh npm install -g coss-cli # Node.js 22+ coss login ``` Or run any command with `npx coss-cli ` without installing it (`npx coss` is the SDK, not the CLI). - **Homebrew and the install script** install a standalone executable, which needs no Node.js: each release's [GitHub release](https://github.com/cosscom/coss/releases) (`coss-cli@`) has one for macOS, Linux (glibc and musl) and Windows, arm64 and x64, with a `SHA256SUMS`. - **The install script** picks the archive for your machine, checks it against `SHA256SUMS` and installs `coss` into `~/.local/bin` (set `COSS_INSTALL_DIR` for another directory, `COSS_VERSION` for another version). - **Alpine** and other musl systems need `libstdc++` (`apk add libstdc++`). - **macOS** executables are signed with coss.com's Developer ID and notarized by Apple (since 0.3.0), so one you download with a browser runs without a Gatekeeper warning. - **Windows**: download `coss-cli--windows-x64.zip` from the release, or use npm. ## Sign in [#sign-in] `coss login` opens the dashboard in your browser. Check that the page shows the same verification code as your terminal, pick the environment the CLI should work in (a development environment is the default), and approve: the CLI gets a new API key of that environment, named after your machine, and saves it. It is your [personal key](/docs/environments#personal-keys): what it sends counts as your spend. ```sh coss login coss whoami # Acme / Default / Development (sandbox) ``` - **No browser on that machine** (over SSH, the default there): `coss login --no-browser` prints a link to open anywhere you're signed in; paste the code the page shows back into the terminal. - **Members** sign in to environments open to personal keys (new projects' development environments are). Elsewhere, ask an owner or admin for a key and run `coss login --manual`, which asks for the key (or reads it from stdin: `echo "$KEY" | coss login --manual`). - **Several environments**: save each under a profile (`coss login --profile prod`), then pass `--profile prod` or set `COSS_PROFILE=prod`. `coss profiles list` shows the saved profiles (`--json`: one object per profile, never its key) and `coss use prod` makes one the default. - **CI and scripts**: set `COSS_API_KEY`; it wins over saved profiles. No flag takes a key, since command lines are visible to other processes on the machine. `coss logout` removes the saved key and revokes it if `coss login` created it (`--revoke` also revokes a key you pasted; `--all` signs every profile out). Keys are saved in `~/.config/coss/config.json` (`$XDG_CONFIG_HOME`, or `%APPDATA%` on Windows), readable only by you. `coss open` opens the environment in the dashboard: `coss open logs`, `coss open webhooks`, `coss open api-keys`, `coss open domains`, or an organization page (`coss open members`, `coss open billing`). `coss open --help` lists every page, each product's included (`coss open risk-rules`, `coss open scheduling-hosts`); `--print` (or `--json`) prints the URL instead. ## Set a project up [#set-a-project-up] `coss init`, in a project's directory, gets it ready to send: ```sh cd my-app coss init ``` - It asks the dashboard for a new **development key for the project** (approved like `coss login`, offering only sandbox environments, and named after the project) and writes it as `COSS_API_KEY` to `.env.local` in a Next.js project, `.env` otherwise, or the file `--env-file` names. This key is the project's, not the CLI's. A file that already has a key keeps it unless you pass `--force`; it warns when git doesn't ignore the file. - It installs the `coss` package with the project's package manager (from its lockfile: bun, pnpm, yarn or npm); `--no-install` skips that. - `--product ` ends with that product's step instead of email's: what it still needs, or with a development key how to try it (`email`, `sms`, `verify`, `sign`, `forms`, `scheduling`, `inboxes`, `hooks`, `risk` or `marketing`). - It adds a short section on coss.com to the project's `AGENTS.md` (its `CLAUDE.md` when it has no `AGENTS.md`): where the docs are for agents, what the development key does, and how to test. `--agents` is the default. Running it again updates that section. `--no-agents` skips it. See [Coding agents](/docs/agents). - It prints the one next step for this key (a from address that will succeed, or the DNS still missing) and, when the project already uses one, the Nodemailer, Better Auth, Auth.js, Laravel, Rails or Django drop-in. `--json` includes that report as `setup`. - `--no-browser` works as with `coss login`; `--json` prints what it did as one object. ## Receive webhooks locally [#receive-webhooks-locally] coss.com can't reach `localhost`, so `coss listen` fetches the environment's events and forwards each one to your local server, exactly as an [endpoint](/docs/webhooks) would receive it: ```sh coss listen --forward-to localhost:3000/webhooks # Ready! Listening to Acme / Default / Development (sandbox), forwarding to http://localhost:3000/webhooks. # COSS_WEBHOOK_SECRET=whsec_… # Saved COSS_WEBHOOK_SECRET in .env.local (API version 2026-10-10) ``` Requests are signed with that secret. An existing `COSS_WEBHOOK_SECRET` in the project's env file is kept, so the handler's secret does not change; otherwise `coss listen` writes the profile's secret, or a new one, into the same file as `COSS_API_KEY`. Verify requests as you would in production: ```ts twoslash title="app/webhooks/route.ts" import { verifyWebhook } from "coss"; export async function POST(request: Request) { // In development, the secret `coss listen` printed; in production, the endpoint's. const event = await verifyWebhook( await request.text(), request.headers, process.env.COSS_WEBHOOK_SECRET!, ); console.log(event.type, event.id); return new Response("ok"); } ``` - Only events created while it runs are forwarded, oldest first; the `webhook-id` header is the event's id, as in production. `--events email.delivered,email.bounced` subscribes to fewer. - Each forward shows its status in the terminal and in the environment's [log](/docs/logs) (`webhook.forward`). A failed forward isn't retried: [trigger](#trigger-test-events) it again. - Without `--forward-to`, events are only printed (`--print-json` shows their bodies, `--json` prints one JSON object per event). - `--header "Authorization: Bearer dev-token"` adds a header to every forwarded request (repeatable), for a local server that expects one. - Events render in your organization's API version unless you pass `--api-version`. - `domain.*`, `account.*` and `billing.*` events only reach live environments. Listening to a live environment, with its real events, needs `--live`. - An environment has at most 5 listeners at once. One that stops polling (your laptop sleeps) closes after 10 minutes, and `coss listen` opens a new one when it wakes up: events in between are missed. ## Trigger test events [#trigger-test-events] With `coss listen` running, `coss trigger` sends a test event of any type, so you can work on a handler without making the real thing happen: ```sh # terminal 1 coss listen --forward-to localhost:3000/webhooks # terminal 2 coss trigger email.bounced # ✔ email.bounced evt_01k7c8m4r0c2b8w9y3d5f6g7h8 → 0 endpoints, 1 listener coss trigger contact.unsubscribed -F contact.email=ada@example.com coss trigger risk.assessment.review --data '{"user_id":"u_42","score":0.91}' ``` The event is a realistic sample of its type, sent to the environment's subscribed [endpoints](/docs/webhooks) and open listeners exactly like a real one: same body, signature, retries and log lines, with nothing marking it as a test. Its ids are made up, so pass real ones for a handler that looks them up: `--data` takes a JSON object merged over the sample's `data`, and `-F name=value` (`--field`) sets one field, with dotted names reaching into objects (`-F bounce.sub_type=NoEmail`) and values read as JSON when they parse (`@path` reads a file). Unknown fields are refused. `--json` prints the event that was sent. - Test events are for development environments (sandbox keys) only, and of every type except the live-only `domain.*`, `account.*` and `billing.*`. Tab completes the types. - To run an email through the real pipeline instead (sending, the provider, then its events), send it to the mailbox simulator: `coss emails send --simulate bounced`. ## Webhook endpoints and deliveries [#webhook-endpoints-and-deliveries] ```sh coss webhooks list coss webhooks add https://example.com/webhooks --events email.delivered,email.bounced coss webhooks deliveries whep_01k7c8m4q2f3e9v6t5r1n0p8yz --status failed coss webhooks retry whep_01k7c8m4q2f3e9v6t5r1n0p8yz whdel_01k7c8m4q2f3e9v6t5r1n0p8yz ``` `coss webhooks list` shows the environment's endpoints with their URL, state (enabled, failing, disabled) and event types. `coss webhooks add ` creates one. Its signing secret is returned once and written to the project env file as `COSS_WEBHOOK_SECRET` (a previous value is replaced, so `coss listen` signs with the same secret). `--description` stores a note, `--events` limits the types (the default is every event, including ones added later), and `--force` creates another endpoint when that URL already has one. Without `--force` the existing endpoint is left as it is. Creation is not retried. `coss webhooks deliveries ` lists an endpoint's deliveries, newest first, with the last status code and error; filter with `--status pending|succeeded|failed` or `--event `, and show up to `--limit 100` (default 20). `coss webhooks retry ` sends a finished delivery once more, within seconds. Each takes `--json`. ## Send test emails [#send-test-emails] ```sh coss emails send --to you@example.com coss emails send --simulate bounced --wait ``` With a development key nothing is delivered, but every event and webhook a real send has still happens. `--simulate delivered|bounced|complained|suppressed` sends to the [mailbox simulator](/docs/environments), which produces that outcome in development and production alike; `--wait` follows the email until it's known and prints its events, so with `coss listen` running you see the matching webhooks arrive. It waits up to 60 seconds (`--timeout `). The default sender for development keys is `coss.com CLI `; production keys need `--from` on a verified domain. Also: `--subject`, `--text`/`--text-file`, `--html`/`--html-file`, `--template ` with `--var name=value`, `--cc`, `--bcc`, `--reply-to`, `--category`, `--tag name=value` and `--json`. ## Find and debug emails [#find-and-debug-emails] ```sh coss emails list --recipient-status bounced --since 1d coss emails diagnose email_01k7c8m4q2f3e9v6t5r1n0p8yz coss emails diagnose --to ada@example.com ``` `coss emails list` shows the environment's emails, newest first, with where each one stands: its status until it was handed to the provider, then its recipients' (`delivered`, `2 delivered, 1 bounced`). Filter by `--to`, `--status`, `--recipient-status`, free text (`-q`), `--category`, `--batch ` and creation time (`--since`, `--until`); `--limit` sets how many (20 by default, read page by page). `--json` prints one email per line. `coss emails get ` shows one email: sender, recipients and their statuses, its failure, tracking counts and attachments (`--text` or `--html` prints that body alone). `coss emails events ` lists its events, with what the receiving server answered. `coss emails diagnose ` explains the outcome: a verdict, what each recipient's status means (a hard bounce and the server's reason, the suppression entry that skipped an address, a delay, a failure and its cause), account problems that affect it (an unverified domain, reputation, a billing hold) and the next steps, as commands to run. `--to
` diagnoses the newest email to that address. It's the same diagnosis as the SDK's `coss/diagnose` and the MCP server's `diagnose_email`, and each product has one (`coss sms diagnose`, `coss verify diagnose`, `coss sign diagnose`, `coss forms diagnose`, `coss hooks diagnose`, `coss scheduling diagnose`). ## Scheduled emails [#scheduled-emails] `coss emails cancel ` cancels an email scheduled for later. `coss emails reschedule --at