POST /v1/send
Envia email via API key
- Acesso: Membro da equipe
- Serviço:
https://mail-api.axuz.net
Autenticação aceita
sessionCookie— Sessão plena Axuz (cookie de sessão da casa). Sessão restrita é 403 enrollment_required.bearerSession— JWT de acesso da sessão em `Authorization: Bearer`.
Rate-limited por chave. Gate mail:send scope obrigatório. Gate §37.15 (MAIL-04): destinatário externo com MAIL_EXTERNAL_SEND_ENABLED=false devolve 503 e NÃO conta contra mail_api_usage. Outros paths (2xx/400) contam.
Parâmetros
Sem parâmetros.
Corpo da requisição
application/json · Obrigatório
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
from | string<email> | sim | |
to | array<string<email>> | sim | |
cc | array<string<email>> | não | |
bcc | array<string<email>> | não | |
reply_to | string | não | |
subject | string | sim | |
html | string | não | |
text | string | não | |
headers | object | não | |
attachments | array<MailSendAttachment> | não | |
attachments[].filename | string | sim | |
attachments[].content_base64 | string<byte> | sim | |
attachments[].content_type | string | não |
{
"from": "pessoa@example.test",
"to": [
"pessoa@example.test"
],
"cc": [
"pessoa@example.test"
],
"bcc": [
"pessoa@example.test"
],
"reply_to": "string",
"subject": "string",
"html": "string",
"text": "string",
"headers": {},
"attachments": [
{
"filename": "string",
"content_base64": "string",
"content_type": "application/octet-stream"
}
]
}Respostas
201
Aceito para entrega
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
message_id | string<uuid> | sim | |
status | string | sim |
enum: |
internal | boolean | sim | |
external | boolean | sim |
400
Erro de validação (from inválido, allowed_from denied, folder miss, etc)
401
Chave ausente/inválida
403
Chave revogada ou scope mail:send ausente
429
Duas causas distintas, ambas com Retry-After: rate limit de API da chave (requisições/minuto, corpo {"error": ...}) ou teto de ENVIO F-019 (mensagens/janela, corpo SendRateLimit). O teto de envio NÃO conta como uso em mail_api_usage.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim | |
layer | string | sim | Camada que negou. enum: |
limit | integer | sim | Teto da camada que negou. |
used | integer | sim | Consumido na janela quando negou. |
retry_after | integer | sim | Segundos até a próxima vaga (mínimo 1). |
message | string | sim |
500
Erro interno. Tente de novo com backoff; reporte o X-Request-Id.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
503
External send disabled (não conta como uso)
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim | |
status | string | sim |
Exemplos
O "Try it" está desligado nesta referência. Use os exemplos com a sua credencial de teste.
curl
curl -sS -X POST 'https://mail-api.axuz.net/v1/send' \
-H "Authorization: Bearer $AXUZ_TOKEN" \
-H "Content-Type: application/json" \
-d '{"from":"pessoa@example.test","to":["pessoa@example.test"],"cc":["pessoa@example.test"],"bcc":["pessoa@example.test"],"reply_to":"string","subject":"string","html":"string","text":"string","headers":{},"attachments":[{"filename":"string","content_base64":"string","content_type":"application/octet-stream"}]}'Node.js
const res = await fetch("https://mail-api.axuz.net/v1/send", {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.AXUZ_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"from": "pessoa@example.test",
"to": [
"pessoa@example.test"
],
"cc": [
"pessoa@example.test"
],
"bcc": [
"pessoa@example.test"
],
"reply_to": "string",
"subject": "string",
"html": "string",
"text": "string",
"headers": {},
"attachments": [
{
"filename": "string",
"content_base64": "string",
"content_type": "application/octet-stream"
}
]
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(await res.json());Python
import os
import requests
res = requests.request(
"POST",
"https://mail-api.axuz.net/v1/send",
headers={
"Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
},
json={
"from": "pessoa@example.test",
"to": [
"pessoa@example.test",
],
"cc": [
"pessoa@example.test",
],
"bcc": [
"pessoa@example.test",
],
"reply_to": "string",
"subject": "string",
"html": "string",
"text": "string",
"headers": {},
"attachments": [
{
"filename": "string",
"content_base64": "string",
"content_type": "application/octet-stream",
},
],
},
timeout=30,
)
res.raise_for_status()
print(res.json())