How to rotate a Resend API key
Resend keys never expire and an account can hold many at once, so rotation is create, deploy, check, delete. The parts people get wrong are giving an app a full-access key when it only sends mail, and deleting the old key before every service has stopped using it. Resend's last-used date and Logs page solve the second problem if you know where to look.
How to rotate Resend keys with Keysquid
Automatic Keysquid creates, verifies, distributes and revokes Resend keys on a schedule, with no one in the loop. Sending-access (or full-access) API keys, optionally limited to one domain.
Setup, as the app shows it:
- Create a full-access Resend key for Keysquid only. Your app gets sending-access keys.
- Writes to: API key (default variable RESEND_API_KEY), in every platform and secret store you map it to.
- Interval: from every 1 hour to every 4 weeks, subject to your plan’s minimum.
- Inventory: Keysquid lists every Resend key the connection can see, including keys it doesn’t manage, with names and last use.
Every rotation runs in the same order: create the new key, verify it, write it everywhere, redeploy where a platform needs it, and only then revoke the previous key after a grace period. If any write fails, everything written so far is restored and the new key is revoked. The value is encrypted to the agent you run, so Keysquid’s servers never see it.
Under the hood: Resend keys in detail
Everything below is what Keysquid handles for you on every rotation. It’s here so you know exactly what happens to your keys, and in case you ever need to do a step by hand.
- Where
- Dashboard → API Keys (resend.com/api-keys) → Create API Key. Name (up to 50 characters), permission, optional domain.
- Shown once
- Resend shows the key value only at creation. It can't be viewed again afterwards, only replaced.
- Permissions
full_access(every resource) orsending_access(send email only). Sending access can be limited to one domain.- Overlap
- Yes: keys are independent, so old and new both work until you delete the old one.
- Expiry
- None. Resend keys stay valid until deleted. Resend suggests rotating at least every 90 days.
- Usage
- The API Keys page shows when each key was last used; the API returns
last_used_at. Logs can be filtered by key. - Format
- Keys start with
re_and are sent asAuthorization: Bearer re_.... - Keysquid
- Automatic: sending-access keys by default, optionally limited to one domain, and the old key deleted.
Sending access or full access?
Resend has two permission levels and nothing in between. Most apps only call the send endpoint, so the replacement key should almost always be sending access, even if the key you’re replacing was full access. Your code doesn’t change: both kinds authenticate the same way.
| Permission | What it can do | Use it for |
|---|---|---|
| Sending access, one domain | Send email only, and only from the one domain you pick | Production apps. One key per service and domain. |
| Sending access, all domains | Send email from any verified domain on the account | An app that sends from several domains |
| Full access | Create, read, update and delete any resource: domains, contacts, API keys, webhooks | Only the tool that manages keys or domains |
Permission levels as described in Resend's API reference and dashboard docs. The domain limit is only available on sending-access keys.
Resend’s own leaked-key guide gives the practical reason: a sending-only key can’t read your contacts. A full-access key in an app server means a leak exposes your audience lists and lets the holder create new keys that survive your rotation.
You can edit a key’s permission in the dashboard (More options → Edit API key). That’s fine for tightening a key you trust. It’s not a substitute for rotation: if the value may have been seen, downgrading it still leaves a working key in someone else’s hands.
Rotate a key in the Resend dashboard
- Open API Keys and note the old key’s name, permission and domain. Match them (or narrow them) on the new key.
- Click Create API Key. Give it a name that says which service and when, for example
web-app 2026-12. - Choose Sending access and, if the service sends from one domain, pick that domain.
- Copy the key into your secret store straight away. Resend won’t show it again.
- Replace
RESEND_API_KEYin every environment that uses the old key and redeploy. - Send a test email, then open Logs, filter by the new key and confirm requests are arriving.
- Wait until the old key’s last-used time stops moving, then delete it: More options → Remove API key.
Step 7 is the one that saves you. Because Resend keys never expire, it’s common to find one key shared by a web app, a cron job and a preview environment nobody remembers. If the old key is still being used an hour after you deployed, something you didn’t update is still sending with it. Filter Logs by the old key to see the request and its User-Agent, which usually names the SDK and points to the service.
Rotate a key with the API
The API Keys endpoints need a full-access key. Keep that key out of your apps; use it only from the machine or tool that rotates.
# 1. Create a sending-access key limited to one domain
curl -s https://api.resend.com/api-keys \
-H "Authorization: Bearer $RESEND_ADMIN_KEY" -H "Content-Type: application/json" \
-d '{"name":"web-app 2026-12","permission":"sending_access","domain_id":"'"$DOMAIN_ID"'"}' | jq -r '.id, .token'
# 2. Deploy the new token, send a test, then check when the old key was last used
curl -s https://api.resend.com/api-keys -H "Authorization: Bearer $RESEND_ADMIN_KEY" \
| jq '.data[] | {id, name, created_at, last_used_at}'
# 3. Delete the old key once last_used_at stops changing
curl -s -X DELETE "https://api.resend.com/api-keys/$OLD_KEY_ID" -H "Authorization: Bearer $RESEND_ADMIN_KEY"A successful delete returns {"object":"api_key","id":"...","deleted":true}. The list endpoint returns every key in one response unless you pass limit (1 to 100) with after or before for paging. The API can rename a key but can’t change its permission or domain; that’s a dashboard-only edit. The domain_id is the ID of a verified domain from the Domains API, not the domain name.
If a Resend key leaked
- Delete the key first. Resend says deletion revokes it immediately. Then create a replacement and deploy it; a short gap in sending is better than mail sent in your name.
- Open Logs, filter by the leaked key and the time window, and check the Emails page for messages you didn’t send. Resend keeps 30 days of activity and logs full request bodies, but not source IP addresses.
- If it was a full-access key, look for API keys, webhooks or domains you didn’t create and remove them.
- Watch Metrics for a few weeks. Resend may pause sending if bounces go above 4% or spam complaints above 0.08%.
- Find where it leaked using the first 10 minutes after a key leak, and check your site with the website leak scanner.
By hand vs. with Keysquid
By hand
- Create a key with the right permission and domain, and copy it once.
- Update every environment that uses it.
- Watch the old key’s last-used time, then delete it.
- Remember to do it again in 90 days, because the key never expires.
With Keysquid
- Keysquid creates a sending-access key, limited to the domain you set.
- It writes the key to every platform you mapped and redeploys.
- It deletes the old key after the grace period.
- It lists every key on the account with its last-used date, so stray keys stand out.
What Keysquid does on every rotation
You give Keysquid one full-access key, used only to create, list and delete keys. Your apps get sending-access keys, optionally limited to one domain ID, on the schedule you set. Because Resend has no expiry of its own, a schedule is the only thing that stops a key living for years. Keysquid can’t change a key’s permission after creation (the API doesn’t allow it) and doesn’t touch webhooks or domains.
Frequently asked questions
Can I rotate a Resend API key without downtime?
Yes. An account can hold several keys and both work at once. Create the new key, deploy it everywhere, confirm it in Logs, and delete the old key only when its last-used time stops changing.
Do Resend API keys expire?
No. Resend keys stay valid until you delete them. Resend recommends rotating at least every 90 days and deleting keys that haven't been used for 30 days.
What is the difference between full access and sending access?
Full access can create, read, update and delete any resource, including other API keys. Sending access can only send email, and can be limited to one domain.
Can I see a Resend API key again after creating it?
No. The value is shown once at creation. If you lose it, create a new key and delete the old one.
Can I change a key's permission through the API?
No. The API can only rename a key. Permission and domain can be edited in the dashboard, or you can create a new key with the permission you want.
How do I find which service still uses an old Resend key?
Check the key's last-used time on the API Keys page, then filter Logs by that key. Each request shows the endpoint, time and User-Agent, which usually identifies the SDK and the service.