Keeping API keys secure
A secret code that identifies your program to an API. Keep it in a separate file, out of the repository and shared code, because it is linked to your usage limits.
Understanding Keeping API keys secure in VCE Software Development U4O1
What it does: Adding the key file to .gitignore means git will not track it, so it stays out of the repository. The key is loaded at run time from the separate file, so the source code contains no secret. Anyone who sees the key can use it as if they were you, so keys must never appear in shared code. The key identifies who is making requests, so the provider can apply usage limits and monitor use. The old key remains in the commit history, so it must be treated as compromised and replaced. Keeping the key in its own file that is not committed stops it being shared when the code is pushed.
Common mistakes: This is not Python syntax. The key lives in a separate config.py file, so import it with: from config import API_KEY. Typing the key straight into this file means it gets shared and committed with the code. Import it from a separate file instead: from config import API_KEY.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 125–171) and word search (Modules 115–171).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
API keyFill in the Blanks
Spot the Error
Student with a class code? Join your class →