REST API
Use Fluxmail from local scripts and applications through the versioned JSON API.
Fluxmail exposes a REST API at /api/v1 alongside its MCP endpoint. It uses the same connected mailboxes, permissions, and plan limits as MCP.
Start locally
Complete the quickstart, then create an API key and start the HTTP server:
fluxmail apikey create \
--name local-script
fluxmail serveCopy the fmk_... key when Fluxmail displays it. The local base URL is http://localhost:8977/api/v1.
Pass the key as a bearer token. For example, list the accounts available to the key:
export FLUXMAIL_API_KEY='fmk_...'
curl http://localhost:8977/api/v1/accounts \
-H "Authorization: Bearer $FLUXMAIL_API_KEY"Use the returned account ID in mailbox routes. If you expose the HTTP server outside your computer, protect it with HTTPS and a firewall or reverse proxy.
Administrative access
Routes under /api/v1/admin accept a member session or API key. A session must belong to a current administrator. An API key must belong to a current administrator and include the capability for the requested operation:
| Capability | Access |
|---|---|
admin.accounts | Connect or reauthorize mailboxes and update IMAP settings. |
admin.api_keys | List, create, update, and revoke API keys. |
admin.members | Manage members, invitations, roles, statuses, and sessions. |
admin.audit | Read security audit events. |
admin.license | Read license status and activate a license key. |
The first member is the initial administrator. Administrators can use their CLI session directly. Create an administrative API key only when automation needs these routes:
fluxmail apikey create \
--name instance-admin \
--profile full \
--admin admin.accounts \
--admin admin.api_keys \
--admin admin.members \
--admin admin.audit \
--admin admin.licenseRemote administrative requests require HTTPS. Requests from the local computer can use HTTP.
If a reverse proxy terminates TLS and connects to Fluxmail from a non-loopback address, set FLUXMAIL_TRUST_PROXY=1. Enable it only when the proxy overwrites forwarded headers and prevents clients from reaching Fluxmail directly.
Endpoint reference
| Endpoint | Description |
|---|---|
| Log in with a member email and password | Log in with a member email and password |
| Enroll a member | Enroll a member |
| Redeem a password reset | Redeem a password reset |
| Get the authenticated member | Get the authenticated member |
| Update the current member profile | Update the current member profile |
| Revoke the current member session | Revoke the current member session |
| Change the current member password | Change the current member password |
| List current member sessions | List current member sessions |
| Revoke a member session | Revoke a member session |
| List API keys owned by the current member | List API keys owned by the current member |
| Create an API key for the current member | Create an API key for the current member |
| Revoke an API key owned by the current member | Revoke an API key owned by the current member |
| Connect or reauthorize a mailbox account | Connect or reauthorize a mailbox account |
| Remove a mailbox account owned by the current member | Remove a mailbox account owned by the current member |
| Update folder settings for an owned IMAP mailbox | Update folder settings for an owned IMAP mailbox |
| List members | List members |
| Create and invite a member | Create and invite a member |
| Update a member | Update a member |
| Remove a member | Remove a member |
| Issue a member invitation | Issue a member invitation |
| Issue a member password reset | Issue a member password reset |
| List a member's sessions | List a member's sessions |
| Revoke a member's session | Revoke a member's session |
| List all mailbox account metadata | List all mailbox account metadata |
| Update mailbox ownership and access | Update mailbox ownership and access |
| Remove a mailbox account | Remove a mailbox account |
| List security audit events | List security audit events |
| Create or reauthorize a connection | Create or reauthorize a Gmail, Outlook, or IMAP connection. Requires admin.accounts. |
| Test an IMAP connection | Test IMAP and SMTP settings without saving an account. Requires admin.accounts. |
| Update IMAP folders | Update the folder overrides for an IMAP account. Requires admin.accounts. |
| List API keys | List API key metadata without returning plaintext secrets. Requires admin.api_keys. |
| Create an API key | Create an API key and return its plaintext secret once. Requires admin.api_keys. |
| Update an API key | Update the permissions or mailbox scope of an API key. Requires admin.api_keys. |
| Revoke an API key | Revoke an API key. Requires admin.api_keys. |
| Get OAuth application status | Get safe OAuth application metadata without returning client secrets. Requires admin.accounts. |
| Configure an OAuth application | Save an OAuth application in encrypted instance settings. Requires admin.accounts. |
| Reset an OAuth application | Remove a stored OAuth application. Requires admin.accounts. |
| Get license status | Get license status and usage without returning the configured license key. Requires admin.license. |
| Deactivate a license | Release the stored license and return this instance to Personal limits. Requires admin.license. |
| Activate a license | Validate and activate a Fluxmail license key. Requires admin.license. |
| Get API information | Return the Fluxmail version and the URL of the OpenAPI document. |
| Get server status | Return provider and mailbox status for the accounts available to the API key. |
| List accounts | List the email accounts available to the API key. |
| List folders | List folders in an email account. |
| List labels | List Gmail user labels or Outlook categories in an email account. |
| List messages | List and filter messages in an email account. |
| Get a message | Get one message by its provider ID. |
| Get a thread | Get a complete email thread by its provider ID. |
| Create a draft | Create a new draft or a reply draft in an email account. |
| Replace a draft | Replace the full content of an existing draft. |
| Delete a draft | Delete an existing draft from an email account. |
| Send or schedule a message | Send a message now or schedule it for a specified time. |
| List scheduled sends | List scheduled messages in an email account. |
| Cancel a scheduled send | Cancel a pending scheduled send and keep its provider draft. |
| Forward a message | Forward a message to one or more recipients. |
| Modify messages | Apply one mailbox action to a batch of messages. |
| Download an attachment | Download one attachment as raw bytes. |
Common behavior
- JSON responses put results in
data. Paginated responses providemeta.nextPageToken. - Send and forward requests require an
Idempotency-Keyheader. Their endpoint pages explain safe retries. - API keys use the profiles and capabilities described in Permissions.
- Errors return an
errorobject with a stablecodeandmessage.
OpenAPI schema
The OpenAPI 3.1 schema is public:
curl http://localhost:8977/api/v1/openapi.json \
-H "Authorization: Bearer $FLUXMAIL_API_KEY"Use the schema or the endpoint pages for request parameters, JSON bodies, and response details.
Last updated