Aller au contenu

Account management

Connect mailboxes, read your usage and watch account health from code.

The same API keys, with three extra permissions: email.manage, account.usage and account.health, all off by default. WhatsApp accounts are managed with whatsapp.manage — see the WhatsApp page.

Rules worth knowing

  • Delete means deactivate. Through the API, DELETE switches an account off: sending is refused, polling stops, nothing is erased. PATCH with is_active: true brings it back. Permanent deletion is only available in the dashboard.
  • Scope. email.manage needs at least one SMTP account bound to the key, or “all SMTP accounts” — pick the latter to create the very first one. An account outside the key's bindings answers 403 ACCOUNT_NOT_AUTHORIZED. A key bound to specific accounts is bound to the accounts it creates.
  • Connection first. An SMTP or IMAP account is saved only once its connection test succeeds (SMTP_CONNECTION_FAILED, IMAP_CONNECTION_FAILED). The host must be a public mail server (INVALID_HOST otherwise).
  • Plan limits apply as in the dashboard: creating beyond your plan's SMTP account limit returns 403.
  • Passwords are accepted, stored encrypted, and never returned. Request fields are snake_case, responses camelCase, like the rest of the API.

Endpoints

MethodPathPermission
GETany email binding
POSTemail.manage
GETemail.manage
PATCHemail.manage
DELETEemail.manage
POSTemail.manage
GETemail.manage
POSTemail.manage
PATCHemail.manage
DELETEemail.manage
POSTemail.manage
GETemail.manage
POSTemail.manage
GETaccount.usage
GETaccount.health

Connect a mailbox (SMTP)

POST /api/v1/smtp-accounts

Request

json
{
  "success": true,
  "data": {
    "id": "7c1f…",
    "name": "Support",
    "host": "smtp.example.com",
    "port": 587,
    "username": "support@example.com",
    "fromEmail": "support@example.com",
    "fromName": "Example Support",
    "tls": false,
    "dailyLimit": null,
    "hourlyLimit": null,
    "unsubscribeFooter": false,
    "isActive": true,
    "backupSmtpAccountId": null,
    "createdAt": "2026-10-16T09:00:00.000Z",
    "updatedAt": "2026-10-16T09:00:00.000Z",
    "imap": null
  }
}

Receive e-mail (IMAP)

POST /api/v1/smtp-accounts/:id/imap

One IMAP side per SMTP account. Incoming mail then reaches the inbox, the AI agents and your webhooks; polling starts immediately.

bash
curl -X POST https://sendy.cloud/api/v1/smtp-accounts/SMTP_ACCOUNT_ID/imap \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "host": "imap.example.com", "port": 993, "username": "support@example.com", "password": "app-password" }'

Usage

GET /api/v1/account/usage

The counters the monthly quota is enforced on, and how many accounts you have against your plan. limit: null means unlimited.

json
{
  "success": true,
  "data": {
    "period": "2026-10",
    "plan": { "name": "Starter", "slug": "starter" },
    "monthly": {
      "emails":    { "used": 3200, "limit": 10000 },
      "whatsapp":  { "used": 140,  "limit": 1000 },
      "sms":       { "used": 0,    "limit": 500 },
      "aiCredits": { "used": 87,   "limit": 500 }
    },
    "resources": {
      "smtpAccounts":     { "used": 2, "limit": 2 },
      "whatsappAccounts": { "used": 1, "limit": 1 },
      "smsGateways":      { "used": 0, "limit": 1 },
      "aiAgents":         { "used": 1, "limit": 1 }
    }
  }
}

Health

GET /api/v1/account/health

One entry per SMTP account within the key's scope, with a summary status: error (open critical incident or last SMTP check down), warning (open warning, blacklist listing, SPF/DKIM/DMARC not passing, IMAP failing), inactive or ok.

json
{
  "success": true,
  "data": {
    "smtpAccounts": [
      {
        "id": "7c1f…",
        "name": "Support",
        "fromEmail": "support@example.com",
        "isActive": true,
        "status": "warning",
        "smtp": { "status": "up", "responseTimeMs": 182, "error": null, "checkedAt": "2026-10-16T08:55:00.000Z" },
        "imap": { "isActive": true, "lastPolledAt": "2026-10-16T08:58:12.000Z", "consecutiveFailures": 0 },
        "dns": { "domain": "example.com", "spf": "pass", "dkim": "missing", "dmarc": "pass", "checkedAt": "2026-10-16T03:00:00.000Z" },
        "blacklist": { "listedOn": [], "totalChecked": 12, "checkedAt": "2026-10-16T06:00:00.000Z" },
        "warmup": null,
        "alerts": []
      }
    ]
  }
}