/General
Authentication
Your API Token
Every request to /v1 and v2 needs your API token, sent in the Authorization header:
curl "https://api.bnm.gov.my/v2/currency-converter?from=USD&to=MYR" \
-H "Authorization: Bearer <your-api-token>"To get a token, sign in on these pages with your email address and create one. Tokens start with kijang_. You can hold up to 10 at a time, named so you can tell them apart, and delete any of them whenever you like.
A missing, unknown or deleted token returns 401 with the error invalid_token.
The Legacy Route
v1 is also served at its original paths, /public/... with the header Accept: application/vnd.BNM.API.v1+json, without a token. That route is being retired (see Versioning): move to /v1/... with a token.
Guard your Token
- Do not commit tokens to public repositories. Use environment variables or a secrets manager instead.
- Call the API from your server, not from code that runs in a browser: anyone with DevTools open can read a browser’s requests.
- If a token is compromised, delete it and create a new one. A deleted token stops working at once.
The console on these pages keeps your token in the current browser tab only, and forgets it when the tab is closed.