This guide sends your first email through the API: first with a test key that never delivers anything, then for real from your own domain.
1. Create an API key
In the app, open Developers › API keys and click Create API key.
- Mode: choose Test for now. Test keys accept real requests but never deliver: the outcome is simulated.
- Permission: Sending access can only send emails. Full access can also read the email log and manage keys.
The key is shown once. Store it as an environment variable, for example ROBUSTEMAIL_API_KEY. Test keys start with rb_test_, live keys with rb_live_.
2. Send a test email
Send a POST request to /api/v2/emails with your key in the Authorization header:
curl -X POST https://robustemail.com/api/v2/emails \
-H "Authorization: Bearer $ROBUSTEMAIL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "Acme <hello@acme.com>",
"to": "delivered@sandbox.robustemail.dev",
"subject": "Hello from the API",
"html": "<p>It works!</p>"
}'
The response holds the email’s ID:
{ "id": "6adc79043cbea" }
Open Developers › Emails in the app to see the email and its simulated events. Try bounced@sandbox.robustemail.dev or complained@sandbox.robustemail.dev to see other outcomes. See Test mode and sandbox.
3. Verify your sending domain
Live emails must come from a domain you have verified. Open Sending › Sending domains, add your domain and publish the DNS records shown. See Verify your domain.
4. Go live
Create a Live key and send to a real address on a verified domain:
const res = await fetch("https://robustemail.com/api/v2/emails", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.ROBUSTEMAIL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
from: "Acme <hello@acme.com>",
to: "jane@example.com",
subject: "Welcome to Acme",
html: "<h1>Welcome!</h1><p>Thanks for signing up.</p>",
}),
});
console.log(await res.json()); // { id: "..." }
Next steps
- Send email: every field, including cc, bcc, attachments and tags.
- Idempotency: retry safely without sending twice.
- Send a batch: up to 100 emails in one request.
- Guides for Node.js, Python, PHP, Laravel, Next.js and Go.