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
| Header | Description |
|---|---|
api-key | Your API key (starts with fob_mail_) |
api-secret | Your 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:
- Open Settings → API keys in your firm.
- Click Create new API key and name it after the automation that will use it.
- Pick a permission preset, and All mailboxes or the mailboxes it may use.
- Optionally set an expiry date.
- Copy the secret. It is shown once.
Permission presets
| Preset | Can |
|---|---|
| Read only | List mailboxes, read threads and messages, download attachments and raw messages |
| Read and label | Also set a thread's status, assignee and labels, and create labels |
| Read, label and send | Also reply and send new mail from the client's mailbox |
| Custom | Your own matrix (below) |
Permissions are a matrix of resources and actions. Replying and sending are messages:create.
| Resource | read | create | edit |
|---|---|---|---|
mailboxes | list, show | — | — |
threads | list, show | — | status, assignee, labels |
messages | list, show, raw, attachments | reply, send | — |
labels | list | create | — |
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
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing, wrong or expired credentials |
| 403 | FORBIDDEN | API key lacks threads:edit permission (names the missing permission) |