Misar IO Docs

Accounts

Connect and manage IMAP/SMTP email accounts for sending and inbox sync

Accounts

Email accounts are the verified sender mailboxes used in the from field of outbound emails. Each account stores IMAP/SMTP credentials and is associated with the authenticated user's session.

Account endpoints use session authentication (dashboard cookie), not API key auth. To send email programmatically via API key, use POST /api/v1/send referencing an already-connected account.


Endpoints

| Method | Path | Description | |--------|------|-------------| | GET | /api/accounts | List connected accounts | | POST | /api/accounts | Connect a new account | | DELETE | /api/accounts/:id | Disconnect an account |


GET /api/accounts

List all email accounts connected to the authenticated user.

curl https://api.misar.io/mail/accounts \
  -H "Cookie: sb-access-token=YOUR_SESSION"

Response

{
  "success": true,
  "accounts": [
    {
      "id":          "550e8400-e29b-41d4-a716-446655440000",
      "email":       "[email protected]",
      "name":        "Your Name",
      "imap_host":   "imap.yourdomain.com",
      "imap_port":   993,
      "smtp_host":   "smtp.yourdomain.com",
      "smtp_port":   587,
      "sync_status": "syncing",
      "is_default":  true,
      "created_at":  "2026-01-15T10:00:00Z"
    }
  ]
}

sync_status values

| Value | Meaning | |-------|---------| | pending | Credentials saved, initial sync not yet started | | syncing | Actively syncing inbox | | synced | Up to date | | error | IMAP connection failed — check credentials |


POST /api/accounts

Connect a new IMAP/SMTP email account. Credentials are verified on connection before saving.

curl -X POST https://api.misar.io/mail/accounts \
  -H "Cookie: sb-access-token=YOUR_SESSION" \
  -H "Content-Type: application/json" \
  -d '{
    "email":     "[email protected]",
    "name":      "Your Display Name",
    "imap_host": "imap.yourdomain.com",
    "imap_port": 993,
    "smtp_host": "smtp.yourdomain.com",
    "smtp_port": 587,
    "username":  "[email protected]",
    "password":  "your-email-password"
  }'

Request Fields

| Field | Type | Required | Notes | |-------|------|----------|-------| | email | string | ✓ | The email address of the account | | name | string | — | Display name for outgoing emails | | imap_host | string | ✓ | IMAP server hostname | | imap_port | number | ✓ | Usually 993 (TLS) or 143 (STARTTLS) | | smtp_host | string | ✓ | SMTP server hostname | | smtp_port | number | ✓ | Usually 587 (STARTTLS) or 465 (TLS) | | username | string | ✓ | IMAP/SMTP login username | | password | string | ✓ | IMAP/SMTP login password or app password |

Response

{
  "success": true,
  "account": {
    "id":          "550e8400-e29b-41d4-a716-446655440000",
    "email":       "[email protected]",
    "sync_status": "pending"
  }
}

Errors

| Code | Reason | |------|--------| | 400 | IMAP or SMTP credentials verification failed | | 409 | This email address is already connected | | 403 | Account quota reached for your plan |


DELETE /api/accounts/:id

Disconnect an account and stop inbox sync. Does not delete any emails already synced.

curl -X DELETE https://api.misar.io/mail/accounts/550e8400-e29b-41d4-a716-446655440000 \
  -H "Cookie: sb-access-token=YOUR_SESSION"

Response

{ "success": true }

Errors

| Code | Reason | |------|--------| | 404 | Account not found or does not belong to authenticated user | | 403 | Cannot disconnect the only remaining default account while active campaigns exist |