Authentication
The DISKA API is authenticated with organization API keys. A key acts on behalf of the organization, not of a person: it keeps working if the person who created it leaves the organization, until it is revoked or expires.
Create a key
Only the organization's owners and admins can see and manage API keys.
- In the backoffice, open Definições → Chaves API (Settings → API keys).
- Click Criar nova chave API (create new API key).
- Fill in the Nome (name — required, up to 120 characters) and, optionally, the Descrição (description — up to 500).
- Under Âmbitos (scopes), choose what the key can do. With nothing selected, the key has full access. See scopes.
- Under Expira em (expires on), pick a date if you want the key to stop working on its own. The key is valid until the end of that day.
- Click Gerar (generate).
The A sua chave API (your API key) window shows the full key (dsk_…) only once. Copy it and store it somewhere safe: once you close the window there is no way to see it again — Diska keeps only a hash of the key, not the key itself. If you lose it, create a new one.
In the list, each key shows its name, a masked preview (dsk_a1b2…F5A4), its scopes (Acesso total — full access — when it has none), creation date, expiry and Último uso (last used). Last use is updated at most every 5 minutes, so a key used just now may show a slightly earlier time.
Send the key
Send the key with every request, in one of these headers:
Authorization: Bearer dsk_…
X-API-Key: dsk_…
If you send both, Authorization wins. To check that the key works and which organization it belongs to, call GET /v1/me:
curl https://api.diska.ai/v1/me \
-H "Authorization: Bearer dsk_…"
Expiry and revocation
- Expiry: after the chosen date, the key returns
401withChave de API expirada.("API key expired"). A key with no expiry date is valid until it is revoked. - Revocation: in the list, click the bin icon and confirm with Revogar chave (revoke key). The key stops working immediately and disappears from the list.
To rotate a key without interrupting your integration: create the new one, update your system, and only then revoke the old one.
Good practices
- Use one key per integration, with the minimum scopes that integration needs.
- Store keys in environment variables or a secrets vault, on the server only.
- Never use a key in code that runs in a browser or a mobile app.
- If a key is exposed, revoke it and create another.
Where a key does not work
An API key only opens the DISKA API endpoints (https://api.diska.ai/v1). It gives no access to the backoffice or to the internal API the backoffice uses (/api/v1), and it cannot start voice sessions.
The backoffice (app.diska.ai) authenticates people with the signed-in user's session and uses its own internal API. Those session tokens are short-lived and belong to the product: do not use them in integrations.
Authentication errors
| Code | detail | Cause |
|---|---|---|
401 | Chave de API em falta. Envie 'Authorization: Bearer dsk_…'. | The request carried no key. |
401 | Chave de API inválida ou revogada. | The key does not exist, was revoked, or does not start with dsk_ (for example, a backoffice session token). |
401 | Chave de API expirada. | The key's expiry date has passed. |
403 | Organização suspensa. | The key's organization is suspended. |
403 | A chave não tem o âmbito '…'. | The key has scopes and none of them covers this endpoint. |

