Skip to main content
POST
/
api
/
api-keys
Create an API key
import requests

url = "https://app.langwatch.ai/api/api-keys"

payload = {
    "name": "<string>",
    "bindings": [{ "scopeId": "<string>" }]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
{
  "token": "<string>",
  "apiKey": {
    "id": "<string>",
    "name": "<string>",
    "createdAt": "2023-11-07T05:31:56Z"
  }
}

Documentation Index

Fetch the complete documentation index at: https://langwatch.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Admin API key for organization-level operations (managing projects, API keys). Create one in Settings > API Keys or via POST /api/api-keys. Format: sk-lw-{id}_{secret}.

Body

application/json
name
string
required

Human-readable name for this token

Required string length: 1 - 100
bindings
object[]
required

Role bindings that define what this token can access

Required array length: 1 - 20 elements
description
string

Optional description

Maximum string length: 500
expiresAt
string<date-time>

Optional expiration date (ISO 8601)

keyType
enum<string>
default:personal

personal = tied to a user. service = not tied to any user, for automation.

Available options:
personal,
service
projectIds
string[]

For service keys with restricted scope: list of project IDs to grant ADMIN access to. Omit for full org access.

Maximum array length: 50

Response

API key created. The token field contains the plaintext key — it is only shown once.

token
string

Plaintext API key token (sk-lw-...). Store securely — shown only once.

apiKey
object