Docs
· APIs
API de correo
POST https://sushell.com/api/v1/mail — envío transaccional con sh_.
Base URL: https://sushell.com
La API de correo envía mensajes transaccionales (OTP, avisos, recibos) usando el SMTP de Sushell. Solo funciona con una clave sh_… y un plan API de correo activo (pago confirmado).
Requisitos
- Contrata el producto API de correo en el panel.
- Crea una clave en Panel ? Claves API.
- Autentica cada request con Bearer.
Autenticación
Authorization: Bearer sh_tu_clave
Content-Type: application/json
Endpoints
Health check
GET https://sushell.com/api/v1/ping
Respuesta
{ "ok": true, "service": "sushell-mail", "user_id": 12 }
Enviar correo
POST https://sushell.com/api/v1/mail
| Campo | Tipo | Requerido | Descripción | ||
|---|---|---|---|---|---|
to | string | sí | Destino | ||
subject | string | sí* | Asunto (1–200). *No hace falta si usas template | ||
html | string | sí* | Cuerpo HTML | ||
text | string | no | Texto plano | ||
template | string | no | otp \ | notification \ | receipt |
vars | object | no | Variables de plantilla | ||
idempotency_key | string | no | Evita duplicados |
Ejemplo cURL
curl -X POST "https://sushell.com/api/v1/mail" \
-H "Authorization: Bearer sh_..." \
-H "Content-Type: application/json" \
-d '{
"to": "[email protected]",
"template": "otp",
"vars": { "code": "482915", "name": "Ana" },
"idempotency_key": "otp-ana-20261015"
}'
Ejemplo JavaScript (fetch)
const res = await fetch("https://sushell.com/api/v1/mail", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SUSHELL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
to: "[email protected]",
subject: "Bienvenido",
html: "<p>Tu cuenta está lista.</p>",
}),
});
const data = await res.json();
Ejemplo PHP
$ch = curl_init("https://sushell.com/api/v1/mail");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("SUSHELL_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"to" => "[email protected]",
"subject" => "Hola",
"html" => "<p>Mensaje</p>",
]),
CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
Errores
| HTTP | error_code | Qué hacer |
|---|---|---|
| 401 | — | Revisa la clave sh_ |
| 402 | payment_required | Renueva / paga el plan |
| 429 | quota_exceeded | Cupo mensual u horario agotado |
Importante: guarda el estado del envío en tu base de datos. Sushell no es tu CRM.
Inicia sesión para indicar si este artículo te sirvió.