API Keys Explained: Scope, Restrictions and Safer Website Integration
What should you check before putting an API key into a website? Understand what it identifies, what it permits and where it may be exposed.
1:47 · No narration: the video shows each step as text on screen, and every step is written out below, with buttons that jump the video to it.
Prefer YouTube? Watch this video on our YouTube channel (opens in a new tab).
The six points in the video
This is a silent video. The headings, explanations and labels below reproduce the information on screen.
-
Step 1: Know which service issued it
A key is used with the API or service that recognises it.
On-screen labels: Issuing provider; Intended API; Correct project.
-
Step 2: Understand its actual powers
Keys differ; check the permissions and billing implications.
On-screen labels: Allowed operations; Account scope; Usage implications.
-
Step 3: Apply supported restrictions
Limit the key to suitable APIs and allowed callers where supported.
On-screen labels: API restrictions; Caller restrictions; Minimum access.
-
Step 4: Keep private keys off the page
A credential embedded in browser code can be inspected by visitors.
On-screen labels: Public browser code; Private server credential; Provider-approved setup.
-
Step 5: Monitor relevant usage
Review activity and investigate unexpected patterns.
On-screen labels: Usage reports; Unexpected requests; Responsible owner.
-
Step 6: Plan a controlled replacement
If a key is exposed, follow provider guidance to replace and revoke it.
On-screen labels: Replacement key; Updated integration; Old key revoked.
A practical check for your business
Record the service, permissions and owner of each API credential without putting the secret into ordinary handover notes. Review rotation and recovery with the provider and test the integration after a change.
Sources and further detail
Common questions
What should you check before putting an API key into a website?
Understand what it identifies, what it permits and where it may be exposed. Use the provider rules for the key and the environment.
Go further
More video tips
All 205 videos →
Software Dependencies Explained: The Other Code Your Website Uses
Dependencies, explained.
What Is a Package Manager? Installing and Tracking Website Dependencies
Package managers, explained.