For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
contact@agentmail.ccDiscord
DocumentationAPI ReferenceKnowledge BaseChangelog
DocumentationAPI ReferenceKnowledge BaseChangelog
    • Introduction
  • Getting Started
    • What is AgentMail?
    • What can I do with an inbox?
    • Creating your first inbox
    • Getting your API key
  • Agent Patterns
    • Handling inbound emails
    • Allowlists & blocklists
    • Managing threaded conversations
    • Human-in-the-loop workflows
    • Pods for multi-tenant email
    • Using labels to track state
  • Domains & Deliverability
    • Custom domain setup
    • SPF, DKIM, and DMARC setup
    • Emails going to spam
    • Warming Up
    • MX record conflicts
  • Troubleshooting
    • API 403 error
    • Rate limits
    • Preventing duplicate sends
    • Domain not verifying
    • Emails bouncing
    • Why are my emails not showing up?
  • DNS Guides
    • Cloudflare
    • GoDaddy
    • Route 53 (AWS)
    • Namecheap
LogoLogo
contact@agentmail.ccDiscord
On this page
  • Steps
  • Using your API key
  • Scoped API keys
  • Free tier
Getting Started

How do I get my API key?

Create and manage your AgentMail API keys.
Was this page helpful?
Edit this page
Previous

How do I handle inbound emails with my agent?

Compare Webhooks and WebSockets for processing incoming emails.
Next
Built with

You need an API key to authenticate requests to the AgentMail API. API keys start with am_ and are created in the AgentMail Console.

Steps

  1. Go to the AgentMail Console
  2. Sign up or log in
  3. Navigate to the API Keys section in the left side of the dashboard
  4. Click Create New API Key
  5. Give it a descriptive name (e.g., “my-support-agent”)
  6. Copy the key immediately and store it securely

Your API key is only shown once when it is created. If you lose it, you will need to create a new one. Never commit API keys to version control or share them publicly.

Using your API key

Store your API key in an environment variable to keep it out of your source code:

Bash
$# .env file
$AGENTMAIL_API_KEY=am_your_key_here

Then initialize the SDK using the environment variable:

TypeScript
1import { AgentMailClient } from "agentmail";
2import "dotenv/config";
3
4const client = new AgentMailClient({
5 apiKey: process.env.AGENTMAIL_API_KEY,
6});
7
8// Test the connection by creating an inbox
9const inbox = await client.inboxes.create();
10console.log(`Connected! Created inbox: ${inbox.inboxId}`);

Scoped API keys

In addition to organization-level keys, you can create keys scoped to a single pod or inbox. Scoped keys restrict access so that the key can only operate on resources within that pod or inbox.

  • Pod-scoped keys: Create via POST /pods/{pod_id}/api-keys or client.pods.api_keys.create()
  • Inbox-scoped keys: Create via POST /inboxes/{inbox_id}/api-keys or client.inboxes.api_keys.create()

See the Multi-Tenancy guide for details.

Free tier

No credit card required to get started. The free tier includes:

FeatureLimit
Inboxes3
Emails per month3,000
Storage3 GB
API accessFull (REST, WebSockets, webhooks)
SDKsPython and TypeScript

To create more inboxes or send higher volumes, see the pricing page.