API keys
An API key lets another system send messages and update contacts for one WhatsApp number. Only admins can create and revoke keys.
How do I create an API key?
- In KiliChat, choose the WhatsApp number at the top of the left sidebar.
- Click API & webhooks (under Manage).
- In the API keys card, click New key.
- Under What's it for?, type a name like
Shopify store,Zoho CRMorWebsite form. - Click Create key.
- Copy the key with Copy and store it safely, for example in your server's environment settings.
- Click I've saved it.
The key is shown only once
KiliChat keeps only a scrambled (hashed) copy, so nobody can show it to you again. If you lose it, revoke it and make a new one.
How do I use the key?
Send it with every request, in either header:
Authorization: Bearer kc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX-API-Key: kc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxCheck it works:
curl https://app.kilichat.com/api/v1/number \
-H "Authorization: Bearer YOUR_API_KEY"{ "id": "…", "name": "Lakshmi Silks", "phone": "919876543210" }In Node.js (18 or later, which has fetch built in):
const res = await fetch("https://app.kilichat.com/api/v1/number", {
headers: { Authorization: `Bearer ${process.env.KILICHAT_API_KEY}` },
});
console.log(await res.json());How many keys can I have?
Up to 10 active keys per WhatsApp number. Make one key per system, so you can turn off just one if needed. If you hit the limit you'll see "A number can have up to 10 keys. Revoke one you no longer use."
How do I tell my keys apart?
The API keys table shows each key's Name, the first few characters (like kc_AbC12…), when it was Created and by whom, and when it was Last used.
How do I revoke a key?
Click Revoke next to it and confirm "Revoke "…"? Anything using it stops working straight away." Requests with that key then get 401 with "This API key isn't valid or has been revoked".
Revoke a key straight away if it may have leaked, for example if it was pasted into a chat or committed to a code repository, and make a new one.
Does a key work for all my numbers?
No. Each key belongs to the number it was created for. If your business has several WhatsApp numbers in KiliChat, make a key for each.
How do I keep keys safe?
- Use keys only on your server, never in a website's front-end code or a mobile app, where anyone could read them.
- Store them in environment variables or a secrets manager, not in your code.
- Give each system its own key.
- Revoke keys you no longer use.