Fluxmail

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 serve

Copy 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:

CapabilityAccess
admin.accountsConnect or reauthorize mailboxes and update IMAP settings.
admin.api_keysList, create, update, and revoke API keys.
admin.membersManage members, invitations, roles, statuses, and sessions.
admin.auditRead security audit events.
admin.licenseRead 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.license

Remote 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

EndpointDescription
Log in with a member email and passwordLog in with a member email and password
Enroll a memberEnroll a member
Redeem a password resetRedeem a password reset
Get the authenticated memberGet the authenticated member
Update the current member profileUpdate the current member profile
Revoke the current member sessionRevoke the current member session
Change the current member passwordChange the current member password
List current member sessionsList current member sessions
Revoke a member sessionRevoke a member session
List API keys owned by the current memberList API keys owned by the current member
Create an API key for the current memberCreate an API key for the current member
Revoke an API key owned by the current memberRevoke an API key owned by the current member
Connect or reauthorize a mailbox accountConnect or reauthorize a mailbox account
Remove a mailbox account owned by the current memberRemove a mailbox account owned by the current member
Update folder settings for an owned IMAP mailboxUpdate folder settings for an owned IMAP mailbox
List membersList members
Create and invite a memberCreate and invite a member
Update a memberUpdate a member
Remove a memberRemove a member
Issue a member invitationIssue a member invitation
Issue a member password resetIssue a member password reset
List a member's sessionsList a member's sessions
Revoke a member's sessionRevoke a member's session
List all mailbox account metadataList all mailbox account metadata
Update mailbox ownership and accessUpdate mailbox ownership and access
Remove a mailbox accountRemove a mailbox account
List security audit eventsList security audit events
Create or reauthorize a connectionCreate or reauthorize a Gmail, Outlook, or IMAP connection. Requires admin.accounts.
Test an IMAP connectionTest IMAP and SMTP settings without saving an account. Requires admin.accounts.
Update IMAP foldersUpdate the folder overrides for an IMAP account. Requires admin.accounts.
List API keysList API key metadata without returning plaintext secrets. Requires admin.api_keys.
Create an API keyCreate an API key and return its plaintext secret once. Requires admin.api_keys.
Update an API keyUpdate the permissions or mailbox scope of an API key. Requires admin.api_keys.
Revoke an API keyRevoke an API key. Requires admin.api_keys.
Get OAuth application statusGet safe OAuth application metadata without returning client secrets. Requires admin.accounts.
Configure an OAuth applicationSave an OAuth application in encrypted instance settings. Requires admin.accounts.
Reset an OAuth applicationRemove a stored OAuth application. Requires admin.accounts.
Get license statusGet license status and usage without returning the configured license key. Requires admin.license.
Deactivate a licenseRelease the stored license and return this instance to Personal limits. Requires admin.license.
Activate a licenseValidate and activate a Fluxmail license key. Requires admin.license.
Get API informationReturn the Fluxmail version and the URL of the OpenAPI document.
Get server statusReturn provider and mailbox status for the accounts available to the API key.
List accountsList the email accounts available to the API key.
List foldersList folders in an email account.
List labelsList Gmail user labels or Outlook categories in an email account.
List messagesList and filter messages in an email account.
Get a messageGet one message by its provider ID.
Get a threadGet a complete email thread by its provider ID.
Create a draftCreate a new draft or a reply draft in an email account.
Replace a draftReplace the full content of an existing draft.
Delete a draftDelete an existing draft from an email account.
Send or schedule a messageSend a message now or schedule it for a specified time.
List scheduled sendsList scheduled messages in an email account.
Cancel a scheduled sendCancel a pending scheduled send and keep its provider draft.
Forward a messageForward a message to one or more recipients.
Modify messagesApply one mailbox action to a batch of messages.
Download an attachmentDownload one attachment as raw bytes.

Common behavior

  • JSON responses put results in data. Paginated responses provide meta.nextPageToken.
  • Send and forward requests require an Idempotency-Key header. Their endpoint pages explain safe retries.
  • API keys use the profiles and capabilities described in Permissions.
  • Errors return an error object with a stable code and message.

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