Skip to main content

API Tokens

AgentPost uses Bearer token authentication. The same tokens work for both the REST API and the MCP API.

Generate a token

  1. Log in to the AgentPost dashboard
  2. Go to Settings > API Tokens
  3. Click Create Token and give it a name
  4. Copy the token immediately — it is shown only once

Use the token

Include it in the Authorization header of every request:
curl https://agentpost.email/api/v1/domains \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Token security

  • Tokens grant full access to your account (mailboxes, messages, domains, sending)
  • Treat tokens like passwords — do not commit them to source control
  • Revoke compromised tokens immediately at Settings > API Tokens
  • Tokens do not expire, but you can revoke them at any time

Unauthenticated Requests

Requests without a valid token receive a 401 response:
{
  "message": "Unauthenticated."
}