Documentação
O Autometa Mailer implementa a API REST do Resend. Se você já usa o Resend, basta trocar a base URL e a API key.
1. Use o SDK oficial do Resend
Nenhuma mudança de código: só aponte a base URL para o Autometa Mailer.
Defina as variáveis de ambiente da sua aplicação:
RESEND_API_KEY=re_xxxxxxxxx # sua API key do Autometa Mailer RESEND_BASE_URL=https://mailer.autometa.com.br/api
Node.js / TypeScript:
import { Resend } from "resend";
const resend = new Resend(process.env.RESEND_API_KEY);
const { data, error } = await resend.emails.send({
from: "Acme <[email protected]>",
to: ["[email protected]"],
subject: "Olá!",
html: "<strong>Funciona!</strong>",
});Python (resend):
import resend
resend.api_key = "re_xxxxxxxxx"
resend.api_url = "https://mailer.autometa.com.br/api" # ou env RESEND_API_URL
resend.Emails.send({"from": "Acme <[email protected]>", "to": ["[email protected]"], "subject": "Olá", "html": "<p>Oi</p>"})PHP (resend/resend-php): Resend::client('re_xxx', 'mailer.autometa.com.br/api') · Laravel: RESEND_BASE_URL.
2. Ou chame a REST API diretamente
curl -X POST 'https://mailer.autometa.com.br/api/emails' -H 'Authorization: Bearer re_xxxxxxxxx' -H 'Content-Type: application/json' -H 'Idempotency-Key: pedido-123' -d '{
"from": "Acme <[email protected]>",
"to": ["[email protected]"],
"subject": "Pedido confirmado",
"html": "<p>Seu pedido foi confirmado!</p>",
"tags": [{ "name": "categoria", "value": "pedido" }],
"scheduled_at": "in 10 min"
}'Se você publicar o app em um subdomínio api. (ex.: api.seudominio.com), as rotas também funcionam sem o prefixo /api, exatamente como api.resend.com.
Endpoints suportados
Webhooks
Mesmo formato de payload e assinatura Svix do Resend.
import { Webhook } from "svix";
const wh = new Webhook(process.env.WEBHOOK_SECRET); // whsec_...
const event = wh.verify(rawBody, {
"svix-id": req.headers["svix-id"],
"svix-timestamp": req.headers["svix-timestamp"],
"svix-signature": req.headers["svix-signature"],
});
// event.type: email.sent | email.delivered | email.bounced | email.opened | email.clicked ...Limites e erros
Erros seguem o formato do Resend: { "statusCode": 422, "name": "validation_error", "message": "..." }
Códigos: missing_api_key (401), invalid_api_key (403), restricted_api_key (401), validation_error (422/403), not_found (404), rate_limit_exceeded, daily_quota_exceeded, monthly_quota_exceeded (429).
O rate limit por segundo e as cotas diária/mensal dependem do seu plano.