Safe API keys for AI agents: one key per agent, one namespace

· 4 min read · QuickInbox team

  • Security
  • API keys
  • AI agents

An AI agent with an API key can do whatever the key allows. So the safest key for an agent is one that allows very little and can be switched off on its own.

Rule 1: one key per agent

Don't reuse the key your CI or your team uses. Make a new key on the API Keys page just for the agent, and name it clearly, for example "Claude Code - Sam's laptop". If anything looks wrong you revoke that key and nothing else breaks.

Rule 2: scope it to one namespace

A QuickInbox key made without a namespace works across the whole team. A key scoped to one namespace can only read mail for that namespace. Make a namespace for agent testing and limit the agent's key to it. A scoped key also can't create namespaces or keys or change team settings: those calls return 403.

Rule 3: keep the key out of shared files

  • VS Code: use a promptString input, so VS Code asks once and stores the key securely. See the VS Code setup.
  • Codex: use bearer_token_env_var and an environment variable. See the Codex setup.
  • Claude Code and Cursor: keep personal configs (user scope, ~/.cursor/mcp.json) out of the repository.

Rule 4: use read-only tools

The QuickInbox MCP tools can only create test addresses and read mail. They can't send email, change settings or manage keys. So even a confused agent can't do damage beyond reading test emails.

Rule 5: rotate and revoke

  • Revoke a key you no longer use. It stops working at once.
  • Rotate a key to get a new secret without changing its settings.
  • Check the API Keys page from time to time and delete keys nobody remembers making.

Never send real data to test inboxes

Test inboxes are for test accounts. Don't point real customer email, passwords or secrets at them, and don't use an agent's test address for an account you need to keep.

Related guides

Try it: the QuickInbox MCP server is included on every plan, including the free plan with 5,000 emails a month. Create a free account, make an API key and connect your agent in two minutes.

← All articles