POST /v1/send
Envia email via API key
- Access: Team member
- Service:
https://mail-api.axuz.net
Accepted authentication
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.
Parameters
No parameters.
Request body
application/json · Required
| Name | Type | Required | Description |
|---|---|---|---|
from | string<email> | yes | |
to | array<string<email>> | yes | |
cc | array<string<email>> | no | |
bcc | array<string<email>> | no | |
reply_to | string | no | |
subject | string | yes | |
html | string | no | |
text | string | no | |
headers | object | no | |
attachments | array<MailSendAttachment> | no | |
attachments[].filename | string | yes | |
attachments[].content_base64 | string<byte> | yes | |
attachments[].content_type | string | no |
{
"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"
}
]
}Responses
201
Aceito para entrega
| Name | Type | Required | Description |
|---|---|---|---|
message_id | string<uuid> | yes | |
status | string | yes |
enum: |
internal | boolean | yes | |
external | boolean | yes |
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.
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes | |
layer | string | yes | Camada que negou. enum: |
limit | integer | yes | Teto da camada que negou. |
used | integer | yes | Consumido na janela quando negou. |
retry_after | integer | yes | Segundos até a próxima vaga (mínimo 1). |
message | string | yes |
500
Erro interno. Tente de novo com backoff; reporte o X-Request-Id.
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
503
External send disabled (não conta como uso)
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes | |
status | string | yes |
Examples
"Try it" is turned off in this reference. Use the examples with your test credential.
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())