company logo

Mails.ai Help Center

Go to mails.ai
All collectionsGetting startedSend your first email

Send your first email

Make an API key and send. No agent to create first, no domain to add, no DNS to publish.

Mails.ai — Send your first email

You do not have to set anything up before your first send: signup gave you an agent called hello. Create a key and put that name in the from field. On a paid plan, a new name there creates another agent on first use.

The API keys page with two live keys and one test key

1. Make a key

Open API keys in the dashboard and press New API key. A live key starts mk_live_; a test key starts mk_test_. The full key is shown once — copy it then.

2. Send

Bash
curl -X POST https://api.mails.ai/v1/messages \
  -H "Authorization: Bearer mk_live_..." \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "hello",
    "to": "[email protected]",
    "subject": "Demo confirmation",
    "body_text": "Confirmed for Tuesday at 2pm ET."
  }'

You get 201 with the new message's id, its status and its from: the agent that sent it, by its API address hello@<your-workspace>.mails.ai. Recipients see the mail from hello.<your-workspace>@send.mails.ai. GET /v1/messages/{id} returns the whole message. [email protected] is our test address: nothing is delivered, and moments later a real reply lands in your agent's inbox, so you see the reply half work before you mail a customer.

Or use an SDK

JavaScript
// npm install @mailsai/sdk    (ESM — use import, not require)
import { createClient } from "@mailsai/sdk";

const mails = createClient();            // reads MAILS_API_KEY

const sent = await mails.send({
  from: "hello",
  to: "[email protected]",
  subject: "Demo confirmation",
  body: "Confirmed for Tuesday at 2pm ET.",
});
console.log(sent.from);                  // hello@<your-workspace>.mails.ai

There is a Python SDK too: pip install mailsai. To drive mails.ai from Claude, ChatGPT or Cursor instead, add https://api.mails.ai/mcp as a connector and sign in. There is nothing to install.

Create an API key
Did this answer your question?
😞
😐
😁