Guides
Authentication
Every request is authenticated with two headers — both are required on every call.
The Klart AI API doesn’t use OAuth or bearer tokens. Instead, each request carries two headers that together identify your team and authorize the call:
| Header | Description |
|---|---|
x-api-key | Your API key. Identifies and authorizes the caller. |
Klart-Team-Id | Your team ID. Scopes the request to your workspace and its agents. |
-H "x-api-key: YOUR_API_KEY" \
-H "Klart-Team-Id: YOUR_TEAM_ID"Where to find them
Both values live in the API Keys section of your workspace at admin.klartai.com. Anyone with access to that section of your workspace can generate or revoke keys.
Keeping your key safe
Treat your API key like a password:
- Call the API from a server or backend you control — never from client-side code where the key would be visible to anyone using the app.
- Don’t commit keys to source control or paste them into shared documents.
- If a key is ever exposed, revoke it and generate a new one from the API Keys section right away.
This page's examples use placeholder values
Every code sample in these docs uses YOUR_API_KEY and YOUR_TEAM_ID as placeholders. The interactive request builder lets you fill in real values to generate a working snippet, entirely in your own browser — it never transmits what you type.
If authentication fails
A missing or invalid header is rejected before your request reaches an agent, with a 401 response and one of a few specific error codes — see Errors for the full list and what each one means.