Authentication

Get a Krisp API key and create short-lived session tokens for the realtime WebSocket endpoints.

Krisp APIs use two kinds of credentials:

Do not send the master token on the WebSocket, and never ship it in a browser or mobile app. Create session tokens on your backend and give only the session token to the client.

Get your API key

  1. Sign up or log in at the Developers Portal.
  2. Go to API Keys → Create key.
  3. Store it as a secret on your backend, for example in the KRISP_API_KEY environment variable.

For a complete example that goes from API key to live transcript, see the Quickstart.


Generate a session token

Host: https://api.developers.krisp.ai/

POST /v2/sdk/tokens/session

Creates a session token for the product you name in usage_type.

Headers

HeaderRequiredDescription
AuthorizationYesYour API key in the format api-key YOUR_API_KEY
Content-TypeYesapplication/json

Body parameters

ParameterTypeRequiredDescription
usage_typeStringYesThe product the token is for: stt, tts, viva (Voice Isolation) or vt.
expiration_ttlIntegerNoLifetime of the session token in minutes. Minimum 5, maximum 300 (5 hours). Default 180 (3 hours). For vt, the maximum is 1440 (24 hours).
metadata.session_idStringNoYour own identifier for the session, up to 255 characters.

The team and user always come from the API key. They are never read from the request.

Example request

curl -X POST \
  'https://api.developers.krisp.ai/v2/sdk/tokens/session' \
  -H 'Authorization: api-key YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"usage_type": "stt", "expiration_ttl": 100}'

Example response

{
  "code": 0,
  "message": "Success",
  "data": {
    "session_key": "session_key_...",
    "expires_at": "2026-10-01T15:40:00.000Z",
    "key_id": 123,
    "status": "LICENSE_VALID",
    "type": "session",
    "usage_type": "stt"
  },
  "req_id": "..."
}

Response attributes

FieldTypeDescription
codeInteger0 on success.
messageStringSuccess.
data.session_keyStringThe session token. Use it as the API key when opening the WebSocket.
data.expires_atStringWhen the session token expires (ISO 8601, UTC).
data.key_idIntegerID of the API key the session token was created from.
data.statusStringStatus of the session token.
data.typeStringAlways session.
data.usage_typeStringThe product the token is scoped to.
req_idStringRequest ID. Include it if you contact Krisp support.

Errors

Errors use this shape:

{
  "code": 1,
  "error_code": "AUTH_API_KEY_INVALID",
  "message": "...",
  "req_id": "..."
}
HTTP statuserror_codeMeaning
400VALIDATION_ERRORusage_type is missing or unknown, or expiration_ttl is out of range.
401AUTH_HEADER_MISSINGThe Authorization header is missing or is not in the api-key YOUR_API_KEY format.
401AUTH_API_KEY_INVALIDThe API key is invalid, paused, suspended, or not attached to a team.
401AUTH_API_KEY_EXPIREDThe API key has expired.
401AUTH_NO_LICENSEThe API key is not assigned to a license.
403PRODUCT_NOT_ALLOWEDYour team does not have access to the requested product.
403PAYMENT_PAST_DUEAn invoice payment failed and the grace period has expired.
403BALANCE_EXHAUSTEDYour prepaid credit balance is used up.
403SPEND_CAP_REACHEDYour monthly spending limit is reached.
403USAGE_LIMIT_EXCEEDEDstt, tts or viva: your team used the minutes its contract allows for this product.
403VT_USAGE_LIMIT_EXCEEDEDvt only: your team used its allowed Voice Translation hours.
502CACHE_UNAVAILABLEThe token could not be stored. It is safe to retry.

The billing errors (PAYMENT_PAST_DUE, BALANCE_EXHAUSTED, SPEND_CAP_REACHED) are returned only when usage checks are enabled for your account.

The simultaneous-sessions limit is checked when the WebSocket opens (concurrency_limit_exceeded), not here.


Use the session token on the WebSocket

Use the returned session token as the API key when opening the WebSocket. Send it in the Authorization header of the handshake, with the api-key scheme:

Authorization: api-key SESSION_TOKEN

If your client cannot set headers on a WebSocket handshake (for example, browsers), pass the same value as the authorization query parameter instead, URL-encoded:

wss://streaming.krisp.ai/stt?authorization=api-key%20SESSION_TOKEN

Create a session token for each product you use: usage_type stt, tts, viva or vt for /stt, /tts, /voice-isolation and /vt. See Voice Translation (VT) for the VT details. Create a new token before the current one expires. If the token is missing, malformed or expired, the server closes the connection with one of the errors below. See the API overview for the full list.

codeHTTP statusMeaning
missing_authorization_header401No Authorization header or authorization query parameter was sent.
invalid_api_key401The Authorization value does not use the api-key scheme.
unauthorized403The session token is not valid or has expired.

Example (Python)

import requests
import websockets

API_KEY = "YOUR_API_KEY"  # backend only

resp = requests.post(
    "https://api.developers.krisp.ai/v2/sdk/tokens/session",
    json={"usage_type": "stt", "expiration_ttl": 100},
    headers={"Authorization": f"api-key {API_KEY}"},
)
resp.raise_for_status()
SESSION_TOKEN = resp.json()["data"]["session_key"]


async def connect():
    headers = {"Authorization": f"api-key {SESSION_TOKEN}"}
    return await websockets.connect("wss://streaming.krisp.ai/stt", additional_headers=headers)


Did this page help you?