API Key Security for Developers: A Practical Checklist
A leaked API key can drain a balance or expose customer data. Here is a practical checklist for storing, using, rotating and monitoring keys.

An API key is a password for software. Whoever holds your key can make requests as you, spend your balance and sometimes see data your customers trust you with. Most key leaks are not clever attacks. They are mistakes: a key pasted in a public repository, shipped inside a mobile app, or shared in a group chat. This checklist helps you avoid them.
This is general guidance. See also the IdentifyOrg API reference and SDKs.
1. Keep keys on the server
Never place a secret key in:
- a mobile app (it can be extracted from the package);
- front-end JavaScript (anyone can read it);
- a public or shared code repository;
- screenshots, documentation or support tickets.
Call the API from your backend. Let your app talk to your own server, which holds the key.
2. Store keys properly
- Use environment variables or a secrets manager.
- Keep a
.envfile out of version control with a.gitignoreentry. - Restrict who can read production secrets.
- Do not put keys in build logs. Mask them in your CI system.
- Do not email keys or paste them into chat. If you must share, use a secure channel and rotate afterwards.
3. Separate environments
- Use different keys for development, staging and production.
- Use the test environment for building and demos.
- Never use production keys on a developer's laptop.
- Never use real customer data in tests. See data protection for startups.
4. Principle of least privilege
If your provider lets you create keys with limited permissions or IP restrictions, use them. A key that can only run NIN checks cannot move money. Create separate keys for different services or teams so that a leak is contained and traceable.
5. Rotate regularly
- Set a rotation schedule, such as every few months.
- Rotate immediately when someone with access leaves, or you suspect exposure.
- Support two keys at once during rotation so that you can switch without downtime.
- Remove old keys after the switch.
6. Monitor usage
- Watch for sudden spikes in requests or spend.
- Alert on requests from unfamiliar locations or at odd hours.
- Review the usage dashboard weekly.
- Set balance alerts and spending limits where available.
- Log request references, but not secrets or full personal data. See identity verification API for developers.
7. Protect your own endpoints
Your server is the gate. If your endpoint that triggers a paid verification is public, attackers can use it to run up your bill:
- authenticate users before allowing checks;
- rate limit per user and per IP;
- block automated abuse with bot checks on public forms;
- add per-user daily caps;
- validate input before calling the API.
8. Handle webhooks securely
- Verify the signature on every webhook.
- Use HTTPS endpoints.
- Respond quickly and process asynchronously.
- Ignore duplicate events.
See webhooks.
9. Have a leak response plan
If a key leaks:
- Revoke or rotate it immediately.
- Check usage logs for unauthorised calls.
- Assess whether personal data could have been accessed. If so, follow your breach response plan.
- Remove the key from repositories, including history. Deleting a file is not enough; the key is still in the history. Treat it as compromised.
- Find the root cause and fix the process.
- Tell your provider if you see suspicious activity.
10. Educate the team
- New developers get a short briefing on secrets.
- Use a pre-commit scanner that blocks keys from being committed.
- Run periodic scans of repositories.
- Keep documentation examples free of real keys.
Quick checklist
- [ ] Keys only on the server.
- [ ] Stored in a secrets manager or environment variables.
- [ ] Separate keys per environment.
- [ ] Least privilege and restrictions in place.
- [ ] Rotation schedule set.
- [ ] Usage monitoring and alerts.
- [ ] Your endpoints rate limited.
- [ ] Webhook signatures verified.
- [ ] Leak plan written.
- [ ] Secret scanning in CI.
A scenario
A startup's developer pushes a project to a public repository with a production key in a config file. Within hours, automated scanners find it and attackers run thousands of checks. The startup's alert on unusual spend fires, the key is revoked within minutes, and the team rotates all keys, adds a secret scanner and moves keys to environment variables. The loss is small because of the alert.
Making secrets management a habit
Tools help, but habits matter more. Make secret handling a normal part of your team's routine.
Onboard properly. When a developer joins, give them access to test keys first and add production access only when needed. When they leave, rotate anything they could see.
Review access quarterly. List who can read production secrets and remove anyone who no longer needs it.
Scan automatically. Add a secret scanner to your repositories and your continuous integration pipeline so that committed keys are caught before they spread.
Practise a leak drill. Once a year, pretend that a key has leaked and walk through the steps: revoke, rotate, check logs, notify. You will discover gaps, such as a service that cannot restart without downtime or a key that nobody knows how to replace.
Document where each key is used. A simple register of keys, their purpose, their owner and their last rotation date makes audits and incident response far easier.
Frequently asked questions
Can I put a key in a mobile app if I obfuscate it?
No. Obfuscation delays attackers; it does not stop them.
How often should I rotate?
At least a few times a year, and whenever there is any doubt.
What if I cannot restrict keys?
Wrap the API in your own backend and enforce limits there.
Build on a secure footing. Create keys, test safely and go live with IdentifyOrg's API.





Comments
Questions and corrections welcome. Be kind; links are limited to keep spam out.