Getting started

Authentication

All requests to the Kognita public API must carry two headers: an API key and an organization ID. Neither is optional.

Required headers

HeaderValueWhere to find it
x-kognita-api-keyYour secret API keyDashboard → API Keys → Create key
x-kognita-organization-idYour organization IDDashboard → Settings → Organization ID

API key format

kgn_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

All keys are prefixed with kgn_ followed by a random URL-safe string. Keys are shown only once at creation time; store them securely.

Keep your API key secret

  • • Never expose it in client-side JavaScript or public repositories.
  • • Store it in environment variables or a secrets manager.
  • • If a key is compromised, rotate it immediately from the dashboard.

Setting credentials as environment variables

Store credentials outside your code. The convention used throughout these docs:

.env
KOGNITA_API_KEY=kgn_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
KOGNITA_ORG_ID=org_xxxxxxxxxxxxxxxxxxxx

Setting up a reusable client

Rather than repeating headers on every call, create a thin wrapper around your HTTP client.

bash
curl https://api.kognita.ai/api/v1/knowledge-bases \
  -H "x-kognita-api-key: kgn_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "x-kognita-organization-id: org_xxxxxxxxxxxxxxxxxxxx"

Authentication errors

Missing or invalid credentials return a 400 or 401:

401 Unauthorized
{
  "errorCode": "UNAUTHORIZED",
  "errorMessage": "Invalid or missing API key"
}
400 Bad Request
{
  "errorCode": "MISSING_ORG_ID",
  "errorMessage": "x-kognita-organization-id header is required"
}