# Key security

> Keep API keys secret and recover quickly if one leaks.

- Store keys in environment variables or a secrets manager, never in source code.
- Call Sendtern from your server only. Browser and mobile code can be read by anyone.
- Use one key per environment and service, so revoking one doesn't break the rest.
- Prefer **Sending only** keys. Use Full access only for infrastructure tooling.

## If a key leaks

1. **Create a replacement**: Create a new key with the same permission on [API Keys](https://sendtern.com/dashboard/api-keys).

2. **Deploy it**: Update the environment variable everywhere the old key was used.

3. **Revoke the old key**: Revoke it. Requests using it fail with `401` immediately.

4. **Review activity**: Check [Emails](https://sendtern.com/dashboard/emails) for messages you didn't send.
