For developers
Email API
Your website, shop or CRM sends email through Xenaxio – over HTTP or SMTP, from your company’s own mailboxes, with a copy in “Sent”. With templates, status per recipient, a suppression list and signed webhooks, like Resend or Postmark.
https://app.xenaxio.com/api/v1/emailsStart in five minutes
Create a key
As an admin: Administration → Email API → “Keys”. Choose a name, the sending mailbox (a shared mailbox like
noreply@, or a person’s own with their consent) and a lifetime. The keyxen_api_…is shown once.Send a message
POST https://app.xenaxio.com/api/v1/emailswith the key as a bearer token. The sender is the key's mailbox or one of its aliases on a verified domain.See the result
Status per recipient with
GET /emails/:id, events by webhook, and every message in “Outgoing email” with the key’s name.
curl
curl https://app.xenaxio.com/api/v1/emails \
-H "Authorization: Bearer xen_api_..." \
-H "Content-Type: application/json" \
-d '{
"from": "Acme Shop <[email protected]>",
"to": "[email protected]",
"subject": "Ihre Bestellung 1042",
"html": "<p>Vielen Dank für Ihre Bestellung!</p>",
"tags": { "kind": "order", "order": "1042" }
}'
# {"id":"8c0f9b0e-2a51-4d8b-9a55-3c1f6a1f2b7e"}
Node.js
const res = await fetch("https://app.xenaxio.com/api/v1/emails", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.XENAXIO_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": "order-1042-confirmation",
},
body: JSON.stringify({
from: "[email protected]",
to: ["[email protected]"],
template: "order-confirmation",
variables: { name: "Erika", order: { number: 1042, total: 89.9 } },
}),
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
console.log(body.id);
Python
import os, requests
res = requests.post(
"https://app.xenaxio.com/api/v1/emails",
headers={"Authorization": f"Bearer {os.environ['XENAXIO_API_KEY']}"},
json={
"from": "[email protected]",
"to": "[email protected]",
"subject": "Ihre Rechnung",
"text": "Im Anhang finden Sie Ihre Rechnung.",
"attachments": [{"filename": "rechnung.pdf", "content": pdf_base64}],
},
timeout=30,
)
res.raise_for_status()
print(res.json()["id"])
There is no SDK: any HTTP library will do. The description as an OpenAPI file: openapi.json.
Authentication and address
Every request carries Authorization: Bearer xen_api_…. The address is https://app.xenaxio.com/api/v1 or your company’s portal with /api/v1. A key sends from exactly one mailbox; with the right “read status” it may also read statuses and the suppression list. Only a hash of the key is stored; revoking takes effect at once.
Requests
| Method | Path | What |
|---|---|---|
POST | /emails | Send one message (Idempotency-Key optional). |
POST | /emails/batch | Up to 100 messages without attachments; one answer per message in data. |
GET | /emails/:id | Status per recipient (key with read right). |
GET | /emails?tag=kind:order&since=… | The company’s messages, newest first, 100 a page, continue with before=next. |
GET | /suppressions | The suppression list (key with read right). |
DELETE | /suppressions/:address | Allow an address again. |
GET | /templates | Templates with languages and variables. |
Fields of a message
| Field | Meaning |
|---|---|
from | "[email protected]" or "Company Ltd <[email protected]>" |
to · cc · bcc | One address or a list; at most 50 together. Bcc goes into the envelope only. |
reply_to | Address or list. |
subject · html · text | Subject and content; html and/or text. |
template · variables · locale | Instead of subject and content: a template’s key, its values and the language (de or en). subject overrides the template’s subject. |
attachments | [{ filename, content (base64), content_type? }], up to 10 MB together. |
headers | Only X-…, List-Unsubscribe and List-Unsubscribe-Post. |
tags | Up to 10 key–value pairs, for filtering and in webhooks. |
With an Idempotency-Key header a repeat within 24 hours returns the same id without sending again.
Status
Per recipient: queued, delivered, deferred, failed (with reason: no_mailbox, no_domain, mailbox_full, rejected_as_spam, unreachable, other) or suppressed.
curl https://app.xenaxio.com/api/v1/emails/8c0f9b0e-2a51-4d8b-9a55-3c1f6a1f2b7e -H "Authorization: Bearer xen_api_..."
{
"id": "8c0f9b0e-2a51-4d8b-9a55-3c1f6a1f2b7e",
"created_at": "2026-12-04T10:15:02.114Z",
"from": "[email protected]",
"status": "sent",
"tags": { "kind": "order", "order": "1042" },
"recipients": [
{ "address": "[email protected]", "state": "delivered", "at": "2026-12-04T10:15:04.000Z", "reply": "250 2.0.0 OK" },
{ "address": "[email protected]", "state": "failed", "reason": "no_mailbox", "reply": "550 5.1.1 User unknown" },
{ "address": "[email protected]", "state": "suppressed" }
]
}
Templates
The admin creates templates under Email API → “Templates”: key, subject, HTML and text, in German and/or English, with preview and test mail. Placeholders {{…}} use the flow expression language: paths like {{order.number}} and functions like round, upper, coalesce, add_days. {{format_number(order.total, 2)}} writes a number in the template’s language (1.234,50 or 1,234.50; two decimals unless given) and stands alone in its placeholder. Values are escaped in HTML; Xenaxio fills in {{company.name}} itself. If a variable is missing, the API answers 400 missing_variable. The company layout (logo and colour, or your own HTML with {{content}}) wraps the template when it uses it.
<p>Hallo {{name}},</p>
<p>vielen Dank für Ihre Bestellung {{order.number}} über {{format_number(order.total, 2)}} €.</p>
<p>{{coalesce(note, "")}}</p>
<p>Ihr Team von {{company.name}}</p>
{ "from": "[email protected]", "to": "[email protected]", "template": "order-confirmation", "locale": "de",
"variables": { "name": "Erika", "order": { "number": 1042, "total": 89.9 }, "note": null } }
SMTP with the key as the password
Programs that only speak SMTP (WordPress, a shop, a printer) sign in with the user name api and the key as the password. The same rules apply as over HTTP: sender, suppression list (recipients are refused at RCPT), daily limit, status and webhooks. The reply 250 Queued as <id> carries the id for GET /emails/:id.
| Setting | Value |
|---|---|
| Server | mail.xenaxio.com (on your own installation: the value on the Email API page) |
| Port | 2465 (SSL/TLS) or 2587 (STARTTLS) |
| User name | api |
| Password | your API key xen_api_… |
Webhooks
Under Email API → “Webhooks” the admin adds up to five HTTPS addresses and picks the events. By default the events of API messages are sent; with the option “All outgoing email of the company” also those of people (channel is then xenaxio or smtp). Message content is never sent.
| Event | Meaning |
|---|---|
email.sent | Taken into the mail server’s queue. |
email.delivered | The receiving server accepted the message. |
email.deferred | Turned away for now; the mail server keeps trying. |
email.bounced | Turned away for good, with reason and the server’s reply. With no_mailbox and no_domain the address goes on the suppression list. |
email.suppressed | Not sent: the address is on the suppression list. |
POST /xenaxio-events HTTP/1.1
webhook-id: msg_2f1c0d6e8a7b4c39a1e5f0b2c3d4e5f6
webhook-timestamp: 1796378104
webhook-signature: v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=
content-type: application/json
{
"type": "email.bounced",
"created_at": "2026-12-04T10:15:04.000Z",
"data": {
"email_id": "8c0f9b0e-2a51-4d8b-9a55-3c1f6a1f2b7e",
"queue_id": "1a2b3c4d",
"channel": "api",
"from": "[email protected]",
"to": ["[email protected]"],
"recipient": "[email protected]",
"reason": "no_mailbox",
"reply": "550 5.1.1 User unknown",
"tags": { "kind": "order", "order": "1042" }
}
}
Check the signature
The signature follows Standard Webhooks: HMAC-SHA256 over webhook-id.webhook-timestamp.body with the address’s secret (whsec_…, base64 after the prefix), base64-encoded after v1,. Check the raw body before you parse it as JSON, and drop timestamps older than five minutes. webhook-id stays the same on retries – use it to spot duplicates.
import { createHmac, timingSafeEqual } from "node:crypto";
// secret: "whsec_..." as shown once on the Webhooks tab; body: the raw request body (a string).
export function verify(secret, headers, body) {
const id = headers["webhook-id"];
const timestamp = headers["webhook-timestamp"];
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false; // older than 5 minutes
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
const expected = createHmac("sha256", key).update(`${id}.${timestamp}.${body}`).digest();
return headers["webhook-signature"].split(" ").some((part) => {
const [version, signature] = part.split(",");
const given = Buffer.from(signature ?? "", "base64");
return version === "v1" && given.length === expected.length && timingSafeEqual(given, expected);
});
}
import base64, hashlib, hmac, time
def verify(secret: str, headers, body: bytes) -> bool:
msg_id = headers["webhook-id"]
timestamp = headers["webhook-timestamp"]
if abs(time.time() - int(timestamp)) > 300:
return False
key = base64.b64decode(secret.removeprefix("whsec_"))
signed = f"{msg_id}.{timestamp}.".encode() + body
expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
return any(
part.startswith("v1,") and hmac.compare_digest(part[3:], expected)
for part in headers["webhook-signature"].split(" ")
)
Answer with a 2xx status within 10 seconds. Otherwise Xenaxio tries again after 1 minute, 5 minutes, 30 minutes, 2, 8 and 24 hours. If an address does not answer for three days, it is switched off and the admins get an email. Every delivery is in the log for 30 days, with “Send again”.
Errors
Errors always have the same shape: { "error": { "code", "message", "details"? } }. Messages are in English, codes are stable.
| HTTP | Code | Meaning |
|---|---|---|
| 400 | invalid_request | The request is not valid (field and reason are in the message). |
| 400 | missing_variable | A variable of the template is missing in variables; details.name names it. |
| 401 | unauthorized | The key is missing, unknown, revoked or expired. |
| 403 | forbidden | The key may only send, not read. |
| 403 | forbidden_sender | The sender is neither the key's mailbox nor one of its aliases. |
| 404 | email · suppression | The message or the suppression list entry does not exist. |
| 409 | idempotency_conflict | The same Idempotency-Key was used within 24 hours for a different message. |
| 413 | too_large | Attachments over 10 MB together (or variables over 100 KB). |
| 422 | invalid_from · domain_not_verified | Invalid sender, or its domain is not verified yet. |
| 422 | no_recipients · too_many_recipients | No recipients, or more than 50 (to, cc and bcc together). |
| 422 | header_not_allowed · too_many_tags | Only X-… and List-Unsubscribe(-Post); at most 10 tags. |
| 422 | suppressed | Every recipient is on the suppression list; details.addresses lists them. |
| 422 | template_not_found · template_locale_missing · template_error | Unknown template, no text in this language, or an expression does not fit the values (details.expression). |
| 422 | batch_too_large | More than 100 messages in a batch. |
| 429 | rate_limited · daily_limit | More than 10 requests a second per key, or the company's daily limit is reached. |
| 502 | send_failed | The mail server did not take the message; try again later. |
Limits
- 10 requests a second per key (
429 rate_limited) - 1,000 messages a day per company, protecting the shared sending IPs; more on request
- Up to 10 keys, 5 webhook addresses and 100 templates per company
- Only from the company’s verified domains
- No newsletters, no open or click tracking
What is stored and for how long is in the privacy policy.