Get your API key
Getting started

Quickstart

In a few minutes you'll have a live address that receives mail at your webhook and sends with one API call. Every step works three ways — click through the dashboard, ask the AI assistant, or call the API. Pick a tab in any box below and the whole page follows along.

1. Get your API key

Every call below authenticates with one key. Create a free account and grab your key from the dashboard.

Your API key
Log in to show your API key

2. Get a domain

Every address lives on a domain MailKite handles the mail for. You have three ways to get one:

  • Bring a domain you already own — use myapp.ai or a subdomain like mail.myapp.ai, then publish the DNS records MailKite gives you (step 2).
  • Register a new domain — search for one and buy it right inside MailKite; we wire up the DNS automatically, so you can skip step 2.
  • Use a free MailKite subdomain — grab myapp.<base> on a zone we run and start instantly, with no DNS to configure.

The example below adds myapp.ai. MailKite returns the DNS records to publish (a registered or free MailKite domain comes pre-configured).

add a domain
const res = await mk.createDomain({ domain: "myapp.ai" });
Install Docs →
response
{
"domain": { "id": "dom_…", "domain": "myapp.ai", "status": "pending" },
"dns": [
{ "type": "MX", "name": "myapp.ai", "value": "mx.mailkite.dev", "priority": 10 },
{ "type": "TXT", "name": "myapp.ai", "value": "v=spf1 include:mailkite.dev ~all" },
{ "type": "TXT", "name": "mailkite._domainkey.myapp.ai", "value": "v=DKIM1; k=rsa; p=…" },
{ "type": "TXT", "name": "_dmarc.myapp.ai", "value": "v=DMARC1; p=none;" }
]
}
Install Docs →

See Domains & DNS for registering, bringing your own domain, and the free subdomains in full.

3. Publish the DNS records

Add the four records to your DNS provider. MX enables receiving; SPF and DKIM let your outbound mail pass authentication and land in the inbox; DMARC ties it together. Then verify:

verify a domain
await mk.verifyDomain("dom_…");
Install Docs →

A domain flips to verified as soon as its MX record resolves to mx.mailkite.dev. We keep checking the rest in the background.

4. Point a webhook — optional

Only needed if you want to receive mail at this domain. Skip it if you're just sending. To receive, tell MailKite where to POST inbound mail — any HTTPS endpoint works (and http://localhost while developing).

point a webhook
await mk.setWebhook("dom_…", { url: "https://myapp.ai/hooks/mailkite" });
Install Docs →

Every message to any address on the domain now arrives at your endpoint as JSON. Fire a test event from the dashboard or with POST /api/domains/:id/webhook/test, then read Inbound webhooks to learn the payload — and verify the signature so you only trust real events.

5. Send your first email

Use the key from step 1 (mk_live_…) to send. The from address must be on a verified domain.

send a message
import { MailKite } from "mailkite";

const mk = new MailKite(process.env.MAILKITE_API_KEY);

const { id, status } = await mk.send({
from: "hello@myapp.ai",
to: "ada@example.com",
subject: "Your invoice #1042",
html: "<p>Thanks! Receipt attached.</p>",
});
Install Docs →

You'll get back a 202 Accepted with a message id. That's it — you're sending and receiving over your own authenticated domain, with no mail server to run.

Next steps