Your agent

API keys

Take your agent to your website, your app or your channels: create, rotate and protect its keys.

An API key lets your own application talk to your agent. Each key belongs to a single agent and gives access to everything the agent can do: its systems, its documents and its long tasks.

What it's for

You don't need an API key to automate your systems: you connect them in Systems and talk to the agent from Qaalia Chat. The API key is for when you want to take your agent somewhere else:

  • Your own chat: a widget on your website or a chat screen inside your app, with your design (your server calls Qaalia with the key; the browser never sees it).
  • Your channels: a WhatsApp, Telegram or support bot that answers with your agent.
  • Your system asks it for work: for example, at the end of the day your system asks it to «generate the sales report» and the agent does it with its systems.
  • Events for triggers: your system reports that something happened and the agent gets to work.

How to send messages with it: API reference.

Create an API key

Choose the agent

In API Keys, select the agent the key will give access to.

Click Create api

Write a name that identifies the system (for example, «Online store»), an optional descriptionand when it should expire.

Copy the key

The full key starts with qlk_live_and is shown only once. Store it in an environment variable on your server; afterwards, in the dashboard you'll only see its prefix.

.env
QAALIA_API_KEY="qlk_live_tu_clave"

Expiration

You can create keys with no expiration or that expire in 1 hour, 1 day, 7, 30, 90 or 180 days, or 1 year. An expired key stops working instantly; from its card you can renew it when you need it again.

Use the API key

Send it in the Authorization header of every request:

Authorization: Bearer qlk_live_tu_clave
An API key gives full access to your agent. Use it only from your server and never include it in the code of a web page or a mobile app.

Multiple API keys per agent

Create one key for each application that talks to your agent: your website, your app, your WhatsApp bot. That way you can deactivate one without affecting the others and see in the logs which application made each request.

PlanActive API keys per agent
Starter3
Pro10
EnterpriseUnlimited

Only active keys count. The Chat interno key that Qaalia creates for Qaalia Chat doesn't count.

Manage your keys

  • Deactivate: with the switch on its card. The key stops working instantly and you can activate it again whenever you want.
  • Renew: re-enables an expired key.
  • Delete: removes it forever. Systems that use it will lose access.
Don't delete or deactivate the Chat interno key: Qaalia generates it automatically so Qaalia Chat can talk to the agent.

Authentication errors

If the key isn't valid, the API responds with 401 and the reason:

Code in the logsWhat it meansWhat to do
api_key_invalidaThe key doesn't exist or is mistypedCheck that you send the full key, with the Bearer prefix.
api_key_expiradaThe key expiredRenew it or create a new one.
api_key_desactivadaThe key is deactivatedActivate it from its card.
agente_inactivoThe agent is deactivatedActivate it in Customize → Settings.
negocio_inactivoThe business doesn't have an active subscriptionCheck your plan.

Frequently asked questions

I lost my API key, can I see it again?
No. For security it's only shown when created. Create a new one, update your system and delete the old one.
How do I rotate a key without interrupting service?
Create a new key, configure it in your system and, once you confirm in the logs that it's using it, delete the old one.
Does one key work for several agents?
No. Each key belongs to a single agent. For another agent, create a key from that agent.