Get started
Quickstart
Send your first email with the API.
Send a transactional email in four steps. You'll need a connected provider and a verified sending domain — see Connect a provider if you haven't done that yet.
Create an API key
In the dashboard, open Settings → API keys and create a key. Copy it now —
it's shown once. Keys are prefixed aem_.
Author and publish a template
Create a template (e.g. slug welcome) and publish it. Only published
templates can be sent. Templates use your company's brand and can reference
variables like {firstName}. See Create a template.
Send it
curl https://sendandretain.com/api/v1/emails \
-H "Authorization: Bearer $AEM_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: welcome-jane-1" \
-d '{
"to": "[email protected]",
"template": "welcome",
"props": { "firstName": "Jane" }
}'const res = await fetch("https://sendandretain.com/api/v1/emails", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AEM_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": "welcome-jane-1",
},
body: JSON.stringify({
to: "[email protected]",
template: "welcome",
props: { firstName: "Jane" },
}),
});
const data = await res.json();
console.log(data); // { id: "msg_3aF9c1", status: "sent" }import os, requests
res = requests.post(
"https://sendandretain.com/api/v1/emails",
headers={
"Authorization": f"Bearer {os.environ['AEM_KEY']}",
"Idempotency-Key": "welcome-jane-1",
},
json={
"to": "[email protected]",
"template": "welcome",
"props": {"firstName": "Jane"},
},
)
print(res.json()) # {'id': 'msg_3aF9c1', 'status': 'sent'}Check delivery
The send returns a message id. Look up its status and event timeline with a
full-scope key:
curl https://sendandretain.com/api/v1/emails/msg_3aF9c1 \
-H "Authorization: Bearer $AEM_FULL_KEY"