Accounts & Autodetection
An account stores the IMAP and SMTP settings plus the encrypted password. Pigeon supports any standard IMAP/SMTP provider.
The account object
| Field | Description |
|---|---|
id |
Account ID used in other endpoints |
name |
Display name (defaults to the part of the email before @) |
email |
Mail address |
username |
IMAP/SMTP login (defaults to the email address) |
imapHost, imapPort, imapSecurity |
Incoming server; security is tls, starttls or none |
smtpHost, smtpPort, smtpSecurity |
Outgoing server; same security values |
sentMailbox |
Mailbox that receives sent copies (default Sent) |
createdAt |
Unix seconds |
unread |
Total unread messages across cached mailboxes |
Passwords are never returned by any endpoint. They are encrypted at rest with AES-256-GCM; see Security.
List accounts
Returns an array of account objects, each including the aggregated unread
count.
Create an account
POST /api/accounts
Required fields are email and password plus imapHost and smtpHost.
Defaults fill in the rest:
namedefaults to the part of the email before@,usernamedefaults toemailimapPort/smtpPortdefault to993/465imapSecurity/smtpSecuritydefault totlssentMailboxdefaults toSent(it is updated automatically when sync finds a mailbox flagged\Sent)
On success the response is 201 with the stored account (no password).
Validation rejects malformed email addresses, missing hosts, ports outside
1–65535 and security values other than tls, starttls, none.
Creating an account does not contact the mail server. Call sync to verify the credentials and fetch mailboxes.
Update an account
PUT /api/accounts/{id} replaces the account settings using the same body as
creation. Omit password to keep the existing one:
Returns the saved account. Sending a non-empty password re-encrypts and
replaces it.
Update the display name or password
PATCH /api/accounts/{id} updates the display name name and/or the stored
password and leaves every other field untouched:
Send at least one of name and password. Both are trimmed and must not be
empty; an unknown account returns 404. In the web UI under Settings →
Accounts you can edit each account’s display name; rotate its password in the
Security tab under Settings — the app syncs right after saving to verify the
new credential.
Delete an account
DELETE /api/accounts/{id} returns 204. Mailboxes and cached messages of the
account are deleted with it; the mail on the server is untouched.
Detect provider settings
GET /api/detect?email={address} finds IMAP/SMTP settings before you create
the account:
| Field | Description |
|---|---|
provider |
Provider name from the database, or the domain |
imap, smtp |
Host, port, security and login username |
helpUrl |
Provider help page, when known |
enableUrl |
Page explaining how to enable IMAP, when known |
source |
How the result was found: domain, mx or guess |
Detection resolves in three steps:
- Thunderbird ISPDB — a provider entry for the email domain
- MX records — map known mail exchangers to provider entries
- Guess —
imap.<domain>/smtp.<domain>on ports 993/465 with TLS
The endpoint performs DNS lookups for the MX step and can take a moment for
unknown domains. An invalid address returns 400.
Gmail requires two-step verification and an app-specific password. QQ Mail, 163 and several other Chinese providers require enabling IMAP in the provider’s web settings and using an app-specific password instead of the login password.