Postmark uses a Server API token (per server, found on the server's API Tokens tab) for sending, and an Account API token (Account section → API Tokens) for account-level actions. Requests send them in the X-Postmark-Server-Token or X-Postmark-Account-Token header.
Postmark key types
| Type | Prefix | Secret? | Scope | Expiry |
|---|---|---|---|---|
| Server API token Up to 3 per server. Visible to Account Owners and Admins for all servers, and to Server Admins for their servers. | — | Yes | Sends messages, checks sent messages and uses the Bounce API; also the default SMTP credential | — |
| Account API token Only the Account Owner and Account Admins can use it. | — | Yes | Creates servers and adds Sender Signatures or Domains | — |
| SMTP token (Access Key and Secret Key) The Secret Key is not shown again after the page reloads; if lost, generate a new SMTP token in the stream's Settings tab. | — | Yes | SMTP sending for one Outbound Stream | — |
How to create a Postmark key
- Sign in to Postmark and open Servers, then pick a server.
- Open the API Tokens tab to see the Server API token.
- For the Account API token, open API Tokens in the Account section.
Limiting what the key can do
Postmark scopes by token type and by server: a Server token only works on its own server. Which people can see which token depends on role (Account Owner, Account Admin, Server Admin). The articles researched describe no finer-grained permissions.
How to rotate a Postmark key
- Open the server's API Tokens tab.
- Use the additional token slot (up to 3 per server) to introduce a new token, update callers, then retire the old one.
The Postmark article confirms the 3-token limit but does not describe the exact regenerate or delete controls; check the API Tokens tab.
How to revoke a Postmark key
- Open the server's API Tokens tab and remove or regenerate the exposed token there.
If your Postmark key leaked
- Replace the exposed token from the server's API Tokens tab.
- Update every deployment and secret store.
- Check the server's activity for messages you did not send.
Environment variables and CLI
Postmark's SDKs and docs read the key from POSTMARK_SERVER_TOKEN.
Things that catch people out
- Server and Account tokens go in different headers and are not interchangeable.
- The value
POSTMARK_API_TESTin the server token header sends test emails that are not delivered. - The official MCP server is meant for local development use and reads
POSTMARK_SERVER_TOKENfrom a.envfile.
Common Postmark authentication errors
Request does not contain a valid Server or Account token, or the wrong token type was used for the endpoint.
The token is missing or wrong, or a Server token was used on an Account endpoint (HTTP 401, Postmark error code 10).
Recent incidents that put Postmark keys at risk
If you were affected by one of these, rotate your Postmark keys using the rotation steps above.
- Fake postmark-mcp npm package silently BCC'd every email sent through it to an outside server 2025-09-25
Using your Postmark key with AI agents
A coding agent that can read your .env file or your shell history can read the key, and anything in its context can end up in logs, transcripts or a prompt-injected request. The safer pattern is to keep the key in a credential broker that performs the authenticated step for the agent and hands back only the result.
BotPassword works this way. For a Postmark key, these intents fit:
| Intent | What BotPassword does |
|---|---|
run_with | Runs a command with the key injected as an environment variable or a 0600 temporary file, never on the command line, and redacts the key from the output. |
http_request | Makes an authenticated API call after checking the destination against the hosts this key may be sent to. The response comes back with credential-shaped values redacted, and one that holds the key itself is refused. |
rotate | Partly built: creates a new key, stores it as pending, verifies it, promotes it, then revokes the old key after a grace period. Today it works for Cloudflare tokens and AWS IAM keys you have set up, and an agent can start it only under a grant with autopilot; other providers cannot be rotated through their API yet. |
store_secret | Saves a value the agent already holds as a new vault item. |
Postmark also publishes its own MCP server. Whatever server the agent uses, keep the credential it authenticates with out of the agent's context.
Set it up in your agent: Aider · Amp · Claude Code · Claude Desktop · Cline · OpenAI Codex CLI · all agents
Frequently asked questions
Where do I find my Postmark server API token?
Open Servers, choose a server and open its API Tokens tab. Account Owners, Admins and Server Admins can see it.
What is the difference between Postmark Server and Account API tokens?
A Server token sends messages and uses the Bounce API for one server. An Account token creates servers and adds sender signatures or domains.
Is there a Postmark test API token?
Yes. Using POSTMARK_API_TEST as the server token sends test emails that are not delivered.
Can an AI agent use my Postmark key without seeing it?
Yes, if the key never enters the agent's context. Instead of pasting the key into a chat or leaving it in a .env file the agent can read, keep it in a credential broker that injects it into the command or request on the agent's behalf. BotPassword does this with run_with, http_request, store_secret, so the agent gets the result and never the value.