WhatsApp API key: how to get it, use it and keep it safe
Your WhatsApp API key is the one secret that lets your server send messages through Koverage. Learn where to find it, how to send it, and where it must never go.
Find your WhatsApp API key and make the first call
The key lives at the top of the API docs in your Koverage dashboard. Copy it once, store it safely, then send it as a Bearer token.
- Open the API docs
Sign in to your Koverage dashboard and open the API docs page.
- Copy the key
Your key is shown at the top. Put it in an environment variable on your server. Do not paste it into code.
- Add the header
Send
Authorization: Bearer YOUR_API_KEYandContent-Type: application/jsonwith every request.
A sketch of the key area. Your real key never appears on this page.
Keep your WhatsApp API key on your server
Your server is the only safe place for the key. Browsers and apps talk to your server. Your server talks to Koverage.
Browser or app
Your website, your mobile app, your visitors.
No key hereYour server
Holds the key in an environment variable. Adds the Bearer header and calls Koverage.
Key lives hereSend message API
Checks the key and accepts the request.
Needs the keyNever do this: call Koverage straight from browser code or an app. The key would sit in code that every visitor can read.
Where can a WhatsApp API key live?
Tap Safe or Not safe for each place. You get the reason straight away.
- A variable on your server
Only your server process can read it. This is the standard place.
- A .env file that git ignores
It stays on your server. Add it to .gitignore so it is never committed.
- Your cloud’s secrets manager
It is built to hold keys, with access control.
- Your website’s JavaScript
Every visitor can open the browser tools and read it.
- Your mobile app code
Apps can be unpacked and read. Call your own server from the app instead.
- A public GitHub repository
Bots scan public repositories for keys.
- A chat message, email or screenshot
It spreads to people and tools you do not control.
Read the key from the environment, never from the file
Your code reads the key when it runs. The key itself is never typed into a file that you save or share.
Anyone who can read this file can use your key. Files get copied, committed and shared.
Check your WhatsApp API key header
Paste your Authorization header with a fake key. The checker finds the usual mistakes: angle brackets, quotes, a missing Bearer and extra spaces.
Use a fake key here. This checker runs in your browser and sends nothing anywhere. Never paste a live key into any website.
The life of a WhatsApp API key
A key is not set once and forgotten. You get it, store it, use it, and rotate it when you need to. Then every system gets the new key.
- 1Get
Open the API docs in your Koverage dashboard. The key is at the top of the page.
- 2Store
Put it in an environment variable or a secrets manager on your server.
- 3Use
Send it as a Bearer token in the Authorization header of every request.
- 4Rotate
Press Regenerate Key if the key leaks or if someone who knew it leaves.
- 5Update
Put the new key everywhere the old one was used. Send one test message.
If Koverage refuses your request
Work through these four checks in order. Most key problems are in the first two.
- 1Check the header format
Paste your header into the checker above. Look for angle brackets, quotes and a missing Bearer.
- 2Check you copied the whole key
Copy it again from the API docs. A key cut short, or with a space at the end, is refused.
- 3Check the key is current
If someone pressed Regenerate Key, the key you copied earlier may no longer work.
- 4Read the Error Codes page
It is in your dashboard docs, next to Conventions and Webhooks.
WhatsApp API key: your questions answered
Where do I find my WhatsApp API key?
Open the API docs in your Koverage dashboard. The key is shown at the top of the page, and a Regenerate Key button sits next to it.
How do I send the WhatsApp API key?
Add the header Authorization: Bearer YOUR_API_KEY to every request. Also add Content-Type: application/json. Replace YOUR_API_KEY with your real key.
Can I put the key in my website or mobile app?
No. Anyone can read code that runs in a browser or an app. Keep the key on your server. Your website or app should call your server, and your server should call Koverage.
Where should I store the key on my server?
Use an environment variable or a secrets manager. If you use a .env file, add it to .gitignore so it is never committed.
What does Regenerate Key do?
It creates a new key. Update every system that uses the key, then send one test message. Before you rotate on a live system, check in your dashboard what happens to the old key.
What should I do if my key leaks?
Regenerate the key, put the new key everywhere the old one was used, and check your recent messages in the dashboard.
Do I need phoneId with the key?
No. phoneId is optional. If you leave it out, the first phone ID on your account is used. Set it when you have more than one WhatsApp number.
My request is refused. What do I check?
Check the header format with the checker on this page, confirm you copied the whole key, and confirm the key was not regenerated since you copied it. Then read the Error Codes page in your dashboard docs.
Send your first message with your WhatsApp API key
Get the key from your dashboard, keep it on your server and call the send message API. Want to try it without code? Use the Postman collection.