Разработчикам · API reference
Документация API
Технический справочник по HTTP API Sendarix, аутентификации и типичным паттернам интеграции. Обзор продукта: Email API.
# Send a transactional email: from, to, subject, body curl -sS -X POST 'https://app.sendarix.com/v1/email/send' \ -H 'Content-Type: application/json' \ -H 'X-API-Key: YOUR_API_KEY' \ -H 'Idempotency-Key: otp_8842' \ -d '{"from":"no-reply@yourdomain.com","to":"user@example.com","subject":"Your sign-in code","text":"Your code is 482913"}'
// Node 18+ (built-in fetch) const res = await fetch("https://app.sendarix.com/v1/email/send", { method: "POST", headers: { "Content-Type": "application/json", "X-API-Key": process.env.SENDARIX_API_KEY, "Idempotency-Key": "otp_8842" }, body: JSON.stringify({ from: "no-reply@yourdomain.com", to: "user@example.com", subject: "Your sign-in code", text: "Your code is 482913" }) }); console.log(await res.json()); // message_id, status, request_id, sx_trace_id
# Drop-in SMTP — сохраните интеграцию и получите control plane host: smtp.sendarix.net port: 587 (STARTTLS) username: "YOUR_SMTP_USERNAME" # dashboard › SMTP password: "YOUR_SMTP_PASSWORD"
Аудит возможностей (эта платформа)
Приведённые ниже числа отражают то, что приложение сегодня отдаёт интеграторам. Любой язык с HTTPS + JSON может вызывать эти endpoints; на странице шесть готовых к копированию стеков примеров.
4
Поверхности интеграции
6
Языки примеров
6
Паттерны использования
Surfaces: (1) Transactional send REST, (2) Deliverability Intel REST, (3) SMTP relay (protocol, not JSON), (4) Outbound engagement webhooks (you receive signed HTTPS POSTs from Sendarix). Older /v1 endpoints for alerts, message lookup, domains, events, suppressions and usage are retired and return 410.
Поверхности интеграции
| Поверхность | Механизм | База / вход |
|---|---|---|
| Транзакционная отправка | POST JSON, API-ключ аккаунта | POST /v1/email/send |
| Retired v1 endpoints | Return 410 with code API_KEYS_RETIRED | /v1/send, /v1/alerts/ingest, /v1/email/{id}, /v1/domains, /v1/events, /v1/suppressions, /v1/reports/usage |
| Deliverability Intel | GET/POST JSON, API-ключ workspace deliverability | /api/deliverability/v1/* (7 маршрутов) |
| SMTP relay | SMTP AUTH (хост, порт, логин, пароль из дашборда) | См. SMTP Relay |
| Engagement webhooks | Ваш HTTPS endpoint принимает подписанные POST | Настройка в приложении → Webhooks |
Аутентификация
- Send API key: header
X-API-Key: …orAuthorization: Bearer …. Keys in the query string are not accepted. Each key belongs to one sending domain and service, andfrommust use that domain. - API-ключ deliverability: заголовок
X-API-Key(область workspace; для Intel / монитора доставляемости). - Идемпотентность (send): опциональный заголовок
Idempotency-Keyдля безопасных повторов.
Create and revoke keys in the dashboard under Developers › API keys. How many keys you can create depends on your plan (see Pricing).
Send API
POST https://app.sendarix.com/v1/email/send
Поля JSON body (обязательны, если не указано иное):
from— required; an address on the domain the API key belongs toto— строка или массив адресовsubjecttextand/orhtml— optional strings; send at least one so the message has a body- Optional:
reply_to(one address),headers(up to 20; onlyList-Unsubscribe,List-Unsubscribe-Post,List-Id,In-Reply-To,References,Auto-Submitted,Precedence),metadata(up to 20 keys) - Not supported:
cc,bccandattachmentsare rejected with422 UNSUPPORTED_FIELD. There are no template or routing-policy fields; build the subject and body in your application.
to takes one address or a list of up to 50. Duplicates are removed, and each address is checked against suppressions, routed and sent as its own message. The response then adds results, recipient_count and accepted_count.A single-recipient send returns 200 with message_id, status, request_id and sx_trace_id. A suppressed address returns status: "suppressed" and is not sent. If the outcome cannot be confirmed, the API returns 202 with status: "unknown". With Idempotency-Key (up to 64 characters) a retry returns the stored result; the same key with a different body returns 409.
Retired endpoints
POST /v1/send, POST /v1/alerts/ingest and the older /v1 lookup endpoints return 410 API_KEYS_RETIRED.
Send with POST /v1/email/send or SMTP. Use the dashboard for logs and suppressions, and signed webhooks for delivery events. Remove calls to retired endpoints from existing integrations.
Deliverability Intel API
База: /api/deliverability/v1/. Endpoints: workspaces, clients, domains, blacklist status, генерация отчётов. Все требуют API-ключ workspace deliverability.
GET | /workspaces |
GET | /clients |
POST | /clients |
GET | /domains |
POST | /domains |
GET | /blacklists/status |
POST | /reports/generate |
SMTP relay и inbound-style вебхуки
SMTP — стандартная передача с учётными данными из дашборда, для legacy и MTA. Engagement webhooks — исходящие от Sendarix на ваш URL для событий доставки и вовлечённости (payload и безопасность — на продуктовой странице).
Inbound webhooks провайдера (например Postal) — инфраструктурные endpoints, не цели интеграции клиента.
Send API — примеры (6 языков)
Замените YOUR_API_KEY и адреса. Один JSON для всех стеков.
# Bash — транзакционная отправка
curl -sS -X POST 'https://app.sendarix.com/v1/email/send' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Idempotency-Key: order-10042-reset' \
-d '{
"from": "noreply@example.com",
"to": "user@example.com",
"subject": "\u0421\u0431\u0440\u043e\u0441 \u043f\u0430\u0440\u043e\u043b\u044f",
"text": "\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u044d\u0442\u0443 \u0441\u0441\u044b\u043b\u043a\u0443 \u0434\u043b\u044f \u0441\u0431\u0440\u043e\u0441\u0430 \u043f\u0430\u0440\u043e\u043b\u044f.",
"html": "<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u044d\u0442\u0443 \u0441\u0441\u044b\u043b\u043a\u0443 \u0434\u043b\u044f \u0441\u0431\u0440\u043e\u0441\u0430 \u043f\u0430\u0440\u043e\u043b\u044f.</p>"
}'// Node 18+ (global fetch)
const res = await fetch('https://app.sendarix.com/v1/email/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'YOUR_API_KEY',
'Idempotency-Key': 'order-10042-reset',
},
body: JSON.stringify({
from: 'noreply@example.com',
to: 'user@example.com',
subject: "Сброс пароля",
text: "Используйте эту ссылку для сброса пароля.",
html: "<p>Используйте эту ссылку для сброса пароля.<\/p>",
}),
});
console.log(await res.json());# Python 3
import json, urllib.request
req = urllib.request.Request(
'https://app.sendarix.com/v1/email/send',
data=json.dumps({
'from': 'noreply@example.com',
'to': 'user@example.com',
'subject': "Сброс пароля",
'text': "Используйте эту ссылку для сброса пароля.",
'html': "<p>Используйте эту ссылку для сброса пароля.<\/p>",
}).encode(),
headers={
'Content-Type': 'application/json',
'X-API-Key': 'YOUR_API_KEY',
'Idempotency-Key': 'order-10042-reset',
},
method='POST',
)
with urllib.request.urlopen(req) as r:
print(r.read().decode())<?php
$ch = curl_init('https://app.sendarix.com/v1/email/send');
$payload = json_encode([
'from' => 'noreply@example.com',
'to' => 'user@example.com',
'subject' => 'Сброс пароля',
'text' => 'Используйте эту ссылку для сброса пароля.',
'html' => '<p>Используйте эту ссылку для сброса пароля.</p>',
]);\ncurl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-API-Key: YOUR_API_KEY',
'Idempotency-Key: order-10042-reset',
],
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);// Go
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
body, _ := json.Marshal(map[string]any{
"from": "noreply@example.com",
"to": "user@example.com",
"subject": "Сброс пароля",
"text": "Используйте эту ссылку для сброса пароля.",
"html": "<p>Используйте эту ссылку для сброса пароля.<\/p>",
})
req, _ := http.NewRequest("POST", "https://app.sendarix.com/v1/email/send", bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Idempotency-Key", "order-10042-reset")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
}# Ruby — net/http
require 'json'
require 'net/http'
uri = URI('https://app.sendarix.com/v1/email/send')
req = Net::HTTP::Post.new(uri)
req['Content-Type'] = 'application/json'
req['X-API-Key'] = 'YOUR_API_KEY'
req['Idempotency-Key'] = 'order-10042-reset'
req.body = {
from: 'noreply@example.com',
to: 'user@example.com',
subject: "Сброс пароля",
text: "Используйте эту ссылку для сброса пароля.",
html: "<p>Используйте эту ссылку для сброса пароля.<\/p>",
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |h| h.request(req) }
puts res.body Паттерны использования (6)
- Одноразовая отправка — один POST на сообщение, без idempotency header.
- Идемпотентный retry — тот же
Idempotency-Key+ body при сбоях сети. - Bearer auth — замените
X-API-KeyнаAuthorization: Bearer YOUR_API_KEY. - HTML + text — оба для multipart-alternative там, где поддерживается.
- Several recipients — put up to 50 addresses in
toand compareaccepted_countwithrecipient_count. - Автоматизация deliverability — poll или изменение Intel под
/api/deliverability/v1/*с workspace-ключом.
См. также
Чувствуйте себя как дома.
Выберите тариф. Добавьте домен. Соберите свою почту в одном месте.