Quickstart
From signup to first sent email in five minutes.
1. Get an API key
In the dashboard at mailinfra.ru/emails open Project → API keys → Create key. Copy the displayed token — you can't retrieve it again.
mi_test_…— sandbox, no domain verification, no real delivery.mi_live_…— production, requires a verified domain.
Start with mi_test_… — it's the fastest way to validate the integration.
2. Send an email
All requests authenticate via the Authorization: Bearer <key> header.
- cURL
- Python
- TypeScript
curl -X POST https://api.mailinfra.ru/v1/emails \
-H "Authorization: Bearer mi_test_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"from": "hello@example.com",
"to": ["you@example.com"],
"subject": "Hello from MailInfra",
"html": "<p>Hello!</p>"
}'
import httpx
response = httpx.post(
"https://api.mailinfra.ru/v1/emails",
headers={"Authorization": "Bearer mi_test_xxxxxxxx"},
json={
"from": "hello@example.com",
"to": ["you@example.com"],
"subject": "Hello from MailInfra",
"html": "<p>Hello!</p>",
},
)
data = response.json()["data"]
print(data["id"], data["status"])
const res = await fetch("https://api.mailinfra.ru/v1/emails", {
method: "POST",
headers: {
Authorization: "Bearer mi_test_xxxxxxxx",
"Content-Type": "application/json",
},
body: JSON.stringify({
from: "hello@example.com",
to: ["you@example.com"],
subject: "Hello from MailInfra",
html: "<p>Hello!</p>",
}),
});
const { data } = await res.json();
console.log(data.id, data.status);
Response:
{
"data": {
"id": "018e1b7a-1111-7000-aaaa-111111111111",
"status": "SIMULATED",
"skipped_recipients": []
}
}
SIMULATED means sandbox — no real delivery. With mi_live_… and a verified domain you'll get QUEUED → DELIVERED.
3. Next steps
| Task | Guide |
|---|---|
All POST /v1/emails parameters | Send email → |
| Connect a domain for real delivery | DNS setup → |
| Jinja2 templates | Templates → |
| Receive delivery events | Webhooks → |
| Error codes and limits | Errors → |