Tokenmaildocs
Dashboard

DocsTokenmail

API keys and scopes

A Tokenmail key starts with tokenmail_ and works on api.tokenmail.dev. It has a set of actions; anything outside them gets 403 api_key_action_forbidden. Make keys on the dashboard's API keys page or with the CLI; the secret is shown once.

$ tokenmail api-key create agent --preset inbox             # inboxes and mail, and send
$ tokenmail api-key create reader --preset inbox-read --ttl 30d
$ tokenmail api-key create script --actions inbox.read,inbox.write
$ tokenmail api-key create admin --preset admin          # everything, including new keys
$ tokenmail api-key list                                 # scope, expiry, last use
$ tokenmail api-key rotate key_3f2a9c1d8e7b              # new secret, same id and scope
$ tokenmail api-key revoke key_3f2a9c1d8e7b
$ tokenmail api-key actions                              # every action
ActionCan
inbox.readList inboxes and read their mail
inbox.writeCreate, change and delete inboxes, their messages, labels, drafts, domains, lists and forwarding (creating can add a paid seat)
inbox.sendSend, reply and forward (not on yet)
account.readThe account, limits, usage and key lists
account.adminBilling, webhooks and API keys
* (--preset admin)Everything
  • Presets: inbox (inbox.read, inbox.write, inbox.send, account.read), inbox-read (inbox.read, account.read) and admin (everything).
  • Keys expire after 90 days by default, at most 365, or --ttl never. Expired: 401 api_key_expired.
  • A key can't create a key with more actions or a longer life than its own. Full access needs --preset admin.
  • Revoking stops a key at once.
  • Rotating stops the old secret at once. An expired key can't be rotated (409 api_key_expired). For no downtime: create, deploy, then revoke.
  • The CLI reads TOKENMAIL_API_KEY (and TOKENMAIL_API_URL) before its saved sign-in.