# Resend API keys: find, store, rotate, and use them safely with AI agents

Source: https://botpassword.com/keys/resend
Last checked: 2026-10-25

Resend API keys are created on the API keys page of the dashboard (resend.com/api-keys). A key's value cannot be viewed or edited after creation, each key has a permission setting, and it can optionally be restricted to a domain.

## Key types

| Type | Prefix | Secret | Scope | Expiry |
|---|---|---|---|---|
| API key | `re_` | Yes | Permission set on the key (a sending-only key can only send emails); optionally restricted to a domain | Does not expire until removed |

## How to create a Resend key

1. Sign in to the Resend dashboard.
2. Open **API keys** (`resend.com/api-keys`) and create a key.
3. Choose its permission and, optionally, a domain restriction.
4. Copy the key. You cannot view its value after it has been created.

## Limiting what the key can do

Set the permission on each key and optionally restrict it to one domain; both can be edited later in the dashboard (**More options → Edit API key**). A key restricted to sending is rejected by other endpoints with `restricted_api_key`.

## How to rotate a Resend key

1. Create a new key with the same permission and domain restriction.
2. Update every app and secret store to use it.
3. Remove the old key (**More options → Remove API key**).

## How to revoke a Resend key

1. Open the API keys page.
2. Click **More options → Remove API key** on the key.

## If the key leaked

1. Remove the exposed key from the API keys page.
2. Create a replacement and update every deployment.
3. Review sent emails for messages you did not send.

## Environment variables

- `RESEND_API_KEY`

## Gotchas

- You cannot view or edit a key's value after it is created.
- The CLI resolves the key in this order: `--api-key` flag, `RESEND_API_KEY`, then saved credentials.
- The MCP server (`npx -y resend-mcp`) reads the key from `RESEND_API_KEY`.

## Using this key with AI agents (BotPassword)

- `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.
- `cli_login`: Lets git, Docker, the AWS CLI and kubectl log in through bpw's credential helper, so the token is fetched when the tool needs it and not written into its config. The helper hands the value to the tool, so the grant is always disclosing. Other tools use run_with; OAuth device logins are planned.
- `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.

## FAQ

### Where do I find my Resend API key?

Create or manage keys at `resend.com/api-keys`. The value is visible only when you create it.

### Can a Resend API key be limited to sending only?

Yes. Keys have a permission setting, and a sending-only key is rejected on other endpoints with the message "This API key is restricted to only send emails."

### How do I log in to the Resend CLI with an API key?

Run `resend login`, or set `RESEND_API_KEY` in CI. The environment variable takes priority over saved credentials.

### Can an AI agent use my Resend 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.

## Sources

- https://resend.com/docs/dashboard/api-keys/introduction
- https://resend.com/docs/api-reference/errors
- https://resend.com/docs/mcp-server
- https://resend.com/docs/cli
