Every dashboard action is an MCP tool your agent can call.Read the docs
Python email API

Send product email from Python. Sync or async, with one trace.

Send transactional email and publish lifecycle events from sync and async Python services with the Send & Retain API.

Use the Python SDK, requests, or httpx without changing the API contract.

Server quickstart
Python

One request, complete trace

Request

POST /api/v1/emails

Authorization: Bearer aem_…

Idempotency-Key: welcome-8f21

{ "to": "[email protected]", "template": "welcome" }

202 Accepted

{ "id": "msg_7ca31", "status": "queued" }

RuntimeServer process
RequestPOST /api/v1/emails
Result202 · queued
Credentials stay server-side

[ 01 / 04 ]Client contract

Fit email into the Python service you already run.

Use the official Python client

Install with pip or uv, or call the same HTTP API directly with httpx or requests.

Send typed payloads

Sender, recipients, template, and props as plain typed values — no dashboard coupling.

Handle delivery events

Read the raw request body for signature verification before your framework deserialises it.

[ 02 / 04 ]Server quickstart

Queue one email from Python.

One call, one message ID, one delivery timeline.

Use an async HTTP client when this runs inside an async framework.

send_welcome.py
response = requests.post(
    "https://sendandretain.com/api/v1/emails",
    headers={"Authorization": f"Bearer {os.environ['AEM_KEY']}",
             "Idempotency-Key": f"welcome-{user.id}"},
    json={"to": user.email, "template": "welcome"}, timeout=10,
)
response.raise_for_status()

Accepted response

{ "id": "msg_7ca31", "status": "queued" }

[ 03 / 04 ]Quickstart

Choose the execution model your service already uses.

01

Reuse one HTTP client

Load the key from server configuration and share a requests session or async client.

02

Call from the right boundary

Queue inline for simple services or from Celery, RQ, or your existing worker for retried work.

03

Keep the accepted ID

Attach the message identifier to your job or domain event for later delivery checks.

Production checklist

  • Secrets stay server-side
  • Timeout and retry policy
  • Idempotent webhook handler
  • Structured error logging

Questions people ask us

Queue your first Python email.

Pick sync or async, keep the accepted ID, and verify the delivery outcome.