Authentication

Every request carries an API key and its secret. A key belongs to one firm and acts only on that firm's connected mailboxes, or on the ones chosen for it.

Headers

HeaderDescription
api-keyYour API key (starts with fob_mail_)
api-secretYour API secret
curl "https://mail.finopsbricks.com/api/v1/whoami" \
  -H "api-key: fob_mail_xxxxxxxxxxxx" \
  -H "api-secret: xxxxxxxxxxxxxxxx"

Creating a key

Firm admins create keys:

  1. Open Settings → API keys in your firm.
  2. Click Create new API key and name it after the automation that will use it.
  3. Pick a permission preset, and All mailboxes or the mailboxes it may use.
  4. Optionally set an expiry date.
  5. Copy the secret. It is shown once.

Permission presets

PresetCan
Read onlyList mailboxes, read threads and messages, download attachments and raw messages
Read and labelAlso set a thread's status, assignee and labels, and create labels
Read, label and sendAlso reply and send new mail from the client's mailbox
CustomYour own matrix (below)

Permissions are a matrix of resources and actions. Replying and sending are messages:create.

Resourcereadcreateedit
mailboxeslist, show——
threadslist, show—status, assignee, labels
messageslist, show, raw, attachmentsreply, send—
labelslistcreate—

Mailboxes

A key uses every mailbox of the firm, or only the mailboxes chosen when it was created. A thread, message or attachment in any other mailbox answers 404 NOT_FOUND, the same as an id that doesn't exist. GET /api/v1/whoami lists the key's mailboxes.

Acting as the key

What a key does shows in the firm's Activity under the key's name. A thread assigned to the key has assignee: "api_key:<id>"; pass assignee=me to filter or assign by the calling key.

Errors

StatusCodeWhen
401UNAUTHORIZEDMissing, wrong or expired credentials
403FORBIDDENAPI key lacks threads:edit permission (names the missing permission)