Get started

API keys

Every request carries an API key. The key tells QMessage which project, and so which WhatsApp number, the message is sent from.

Create a key

  1. 1

    Open your project

    Sign in to QMessage and open the project with the WhatsApp number you want to send from.
  2. 2

    Go to Manage → API keys

    Click Create API key and name it after the system that will use it, for example “Website” or “Shop orders”. The name helps you find the right key if you ever need to turn it off.
  3. 3

    Copy the key

    The full key is shown only once. Copy it and save it in your software’s settings. Keys start with qm_live_.

A key belongs to one project. It can send every API campaign in that project. You can make as many keys as you need, for example one per system.

Send the key

Use one of these three ways. The first is the safest and the one we recommend.

WhereHow
Authorization headerAuthorization: Bearer qm_live_…
X-Api-Key headerX-Api-Key: qm_live_…
In the request body"apiKey": "qm_live_…", as AiSensy’s API does
Header
Authorization: Bearer qm_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

If a request has more than one key, the Authorization header is used first, then X-Api-Key, then the body.

Keep it secret

  • Anyone with the key can send messages from your number and spend your wallet.
  • Use the key only on your server. Never put it in website code, a mobile app or anywhere a customer can see it.
  • Store it in your server’s settings or an environment variable, not in your code.
  • If a key may have leaked, revoke it straight away and create a new one.

Turn a key off

In Manage → API keys, click Revoke next to the key. It stops working at once: requests with it get status 401. Revoking can’t be undone. Create a new key instead.

The same page shows when each key was last used, and a list of recent API calls with their result, which helps when something isn’t working.

How fast you can send

Each key can make up to 20 requests a second. Above that, requests are refused with status 429. Wait a moment and send the request again.

Tip

Sending to a long list? Send the requests one after another, or a few at a time, instead of all at once. For a one-off message to many people, a normal campaign in QMessage is usually easier.
QMessage is a product of GatiQ Platforms LLP. Questions about the API? Write to qmessage@gatiq.in.