Quickstart

Send your first email with exx.sh. Create an API key, send a test to yourself, read its SMTP transcript, then verify your domain and send from it.

This page takes you from a new account to an email sent from your own domain. You send a first test before touching DNS, so you can see a delivery and its transcript right away.

You need an exx.sh account (sign in at app.exx.sh with an email link, GitHub or Google) and, for the last two steps, access to your domain's DNS records.

Create an API key

In the dashboard, open API keys and create a key with full access. The key is shown once, so put it in your environment straight away:

export EXX_API_KEY=exx_...

Every example below reads the key from EXX_API_KEY. API keys and authentication explains the two kinds of key.

Install an SDK

npm install @exx.sh/sdk

To follow along with plain HTTP instead, curl is enough.

Send a test to yourself

Until your domain is verified, send from onboarding@mail.exx.sh. This sandbox sender reaches only the owners of your organization, up to 100 emails a day, so put your own sign-in address in to:

curl -X POST https://api.exx.sh/emails \
  -H "Authorization: Bearer $EXX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "onboarding@mail.exx.sh",
    "to": "you@example.com",
    "subject": "Hello from exx.sh",
    "text": "It works."
  }'

The answer is the email's id:

{ "id": "01a1b246-b422-7615-a9b9-09d31765fc52" }

An answer of 200 means exx.sh stored and queued the email. Delivery happens right after, as how delivery works describes.

Read what happened

Open Emails in the dashboard and select the email. Each recipient has its delivery attempts, and each attempt has its SMTP transcript: the MX host that answered, the TLS version and policy, and every reply up to the final 250.

The API returns the same attempts:

curl https://api.exx.sh/emails/$EMAIL_ID/attempts \
  -H "Authorization: Bearer $EXX_API_KEY"

Add and verify your domain

Open Domains, add the domain you want to send from (for example acme.com), and add the records the dashboard lists at your DNS provider: two DKIM records and a return-path record, all CNAMEs, and an optional DMARC record. exx.sh checks them on its own; Verify asks for a check now. The domains guide explains each record and every status.

Mail can only leave from a verified domain, so wait until the domain shows verified.

Send from your domain

Change from to an address on your domain. The same email in each language:

import { Exx } from "@exx.sh/sdk";

const exx = new Exx(process.env.EXX_API_KEY);

const { data, error } = await exx.emails.send({
  from: "Acme <hello@acme.com>",
  to: ["delivered@example.com"],
  subject: "Your sign-in link",
  html: "<p>Click the link to sign in.</p>",
  text: "Click the link to sign in.",
  tags: [{ name: "category", value: "sign_in" }],
});

if (error) {
  // error.name is the API's error name, e.g. "validation_error" or "rate_limit_exceeded".
  console.error(`${error.name}: ${error.message}`);
  process.exit(1);
}
console.log(data.id);

Each sample prints the email's id, or the API's error name and message when the request was refused.

If something goes wrong

AnswerCauseFix
401 missing_api_keyThe request has no Authorization headerCheck that EXX_API_KEY is set in the shell or process that sends
401 validation_error, "API key is invalid"The key is mistyped or revokedCopy the key again, or create a new one
403 validation_error, "The acme.com domain is not verified"The from domain is not verified yetFinish the domain step, or send from the sandbox sender
429 daily_quota_exceededA new organization's daily cap is low during its first daysWait for the next UTC day; rate limits and quotas lists the caps

Errors and limits lists every error the API returns.

Next

On this page