Skip to content

Overview & Authentication

The Kotauth REST API v1 is a machine-to-machine interface for managing workspace resources programmatically. It covers the full lifecycle of users, roles, groups, applications, sessions, audit logs, webhooks, resource servers, and API keys.

Base URL:

{baseUrl}/t/{workspaceSlug}/api/v1

For example: https://auth.yourdomain.com/t/my-app/api/v1

An interactive Swagger UI is available on every running instance at:

/t/{workspaceSlug}/api/v1/docs

Swagger UI assets are bundled inside the application JAR — no external CDN requests are made. This means API documentation works in air-gapped and firewalled environments without additional configuration.

All API endpoints require an API key passed as a Bearer token:

Authorization: Bearer kauth_my-app_abcdef1234567890

API keys are created and managed in the admin console under Settings → API Keys for each workspace. The key format is kauth_<workspaceSlug>_<random> — the prefix makes them easy to identify in logs and secret scanners.

Each API key carries a set of scopes that restrict which operations it may perform. Attempting an operation without the required scope returns 403 Forbidden.

ScopeGrants access to
users:readList and retrieve users
users:writeCreate, update, disable users; assign and remove roles
roles:readList and retrieve roles
roles:writeCreate, update, delete roles
groups:readList and retrieve groups
groups:writeCreate, update, delete groups; manage members
applications:readList and retrieve applications
applications:readList and retrieve applications
applications:writeCreate, update, delete applications; manage default roles
sessions:readList active sessions
sessions:writeRevoke sessions
audit_logs:readRead audit log events
user_attributes:readRead per-user custom attributes
user_attributes:writeSet and delete per-user custom attributes
claim_mappers:readList claim mapper configurations
claim_mappers:writeCreate, update, delete claim mappers
workspace:readRead workspace configuration
webhooks:readList webhook endpoint subscriptions
webhooks:writeCreate and delete webhook endpoints
resource_servers:readList resource servers and application bindings
resource_servers:writeCreate, update, delete resource servers; manage application bindings
api_keys:readList API keys
api_keys:writeCreate and revoke API keys
auth:send-otpSend Email OTP challenges
auth:verify-otpVerify Email OTP codes and receive authorization codes

Always issue API keys with the minimum scope required. A key used for read-only reporting should not have write scopes.

Write operations (POST, PUT, PATCH, DELETE) are rate-limited to 60 requests per 60-second window per API key per workspace. Read operations (GET) are unrestricted.

When the limit is exceeded, the API returns 429 Too Many Requests with a Retry-After header indicating how many seconds to wait:

{
"type": "https://kotauth.dev/errors/429",
"title": "Rate limit exceeded",
"status": 429,
"detail": "API write rate limit exceeded for this key in this workspace. Retry after 60 seconds."
}

The rate limit is scoped to the combination of API key prefix and workspace slug, so different keys hitting the same workspace have independent counters.

List endpoints return paginated results with a meta object:

{
"data": [...],
"meta": {
"total": 143,
"offset": 0,
"limit": 20
}
}

Use offset and limit query parameters to paginate:

GET /users?offset=20&limit=20

All errors follow RFC 7807 Problem Details with Content-Type: application/problem+json:

{
"type": "https://kotauth.dev/errors/422",
"title": "Validation Error",
"status": 422,
"detail": "Username may only contain letters, digits, dots, underscores, and hyphens."
}
StatusMeaning
400Bad request — malformed JSON or missing required fields
401Missing or invalid API key
403Valid key but insufficient scope
404Resource not found
409Conflict — resource already exists (e.g. duplicate username)
422Validation error — request is well-formed but semantically invalid
429Rate limit exceeded
500Internal server error