Consuming an API Key-protected API
API Key authentication is the simplest inbound authentication method on APEX. It is suitable for read-only, non-sensitive APIs.
Before continuing, ensure you have:
Making the API call
Pass your API key in the x-apex-apikey request header on every call.
GET /agency/api
Host: public.api.gov.sg
x-apex-apikey: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxThat’s it — no additional token generation is required.
The API publisher may also allow the API key to be passed as a query parameter. Check with the publisher if you are unsure of the expected format.
Key rotation
API keys are long-lived and should be rotated periodically to reduce the risk of exposure. To rotate a key:
- Generate a new API key from your application in the APEX Portal.
- Update your application to use the new key.
- Deactivate the old key once it is no longer in use.