API
The REST API is served under /v1 on the platform host. It is what the web UI uses; everything the UI can do, a script can do.
Reference
The complete, generated description is the OpenAPI document:
- in the repository:
backend/openapi.json; - from a running installation:
/v1/openapi.json.
The API server also serves interactive documentation at /docs, outside /v1, which the chart's Ingress does not route; reach it directly:
kubectl -n idekube port-forward svc/idekube-apiserver 8080
# then open http://127.0.0.1:8080/docs
Resource groups
| Prefix | Resource | Needs |
|---|---|---|
/v1/auth | Sign in, refresh, sign out, identity-provider flow, device sign-in. | Nothing; signed in to confirm who one is or to authorize a device. |
/v1/meta | What each module that runs tells before anyone signs in, under its name: the site name and announcement (system), the sign-in methods (auth), volume classes (worker), prices (team), defaults of the workspace form (workspace), and the plugins that are on with what each of them tells. | Nothing. |
/v1/users/me | The caller's profile and permissions, avatar, two-step verification, linked providers, sessions, API tokens, SSH keys and environment variables. | Signed in. |
/v1/users | Accounts: create, change, disable, delete, sign out, reset a second factor. | user:read, user:write. |
/v1/roles, /v1/permissions | Roles and the permissions they bundle. | role:read, role:write; signed in to list the roles. |
/v1/teams | Teams, their members, quotas, credit and ledger. | Signed in for one's own; team:read, team:create, team:manage; billing:read, billing:credit for credit. |
/v1/templates, /v1/template-language | Templates, their revisions and the language they are written in. | Signed in for one's own and shared ones; template:author to write, template:review to approve or reject, template:read, template:manage for other teams'. |
/v1/workers | Workers: enroll, configure, cordon, rotate the token, remove. /v1/workers/connect is the agents' WebSocket. | worker:read, worker:manage; the worker's token for connect. |
/v1/workers/locations | The workers a new workspace or volume may be placed on. | Signed in. |
/v1/workspaces | Workspaces: create, update, start, stop, delete, open, set the volumes they mount, variables, and tokens for their sidecars. | Signed in; workspace:maintain to start, stop or delete other teams' workspaces; workspace:manage for full cross-team access. |
/v1/clusters | Clusters of workspaces: create, change (their size too), start, stop, delete; their variables and network rules. | Signed in; workspace:maintain to start, stop or delete other teams' clusters; workspace:manage for full cross-team access. |
/v1/volumes | Volumes. | Signed in; storage:maintain to archive, restore or delete other teams' volumes; storage:manage for full cross-team access. |
/v1/notifications, /v1/announcements | One's notifications and preferences; announcements. | Signed in; notification:send to announce. |
/v1/network/workers | How each worker's network is checked. | settings:read, settings:write. |
/v1/audit | The audit log. | audit:read. |
/v1/settings | Runtime settings. | settings:read, settings:write. |
/v1/plugins | The plugins of the release; turn one on or off. | settings:read, settings:write. |
/v1/system | Version, replica. | settings:read. |
/v1/jobs, /v1/job-kinds | Background jobs and their schedules. | job:read; retrying, cancelling, running and rescheduling need job:manage. |
/v1/mcp | The Model Context Protocol server, for AI agents. | Signed in; on unless the mcp settings turn it off. |
Authentication
For scripts, create an API token on your profile (Developer tab) and send it as a bearer token:
BASE=https://idekube.example.org
curl -sS "$BASE/v1/workspaces" -H "Authorization: Bearer $IDEKUBE_TOKEN"
An API token starts with idk_ and lasts until it expires or is deleted. POST /v1/users/me/tokens makes one, from a session that confirmed who it is; its scopes are those of API tokens and permissions the caller holds, and none, the default, is full access. A request beyond them is refused with 403 and insufficient_scope. GET /v1/users/me returns the token's token_scopes.
A command-line client signs in without handling a password through the device authorization flow (RFC 8628), as idk login does:
POST /v1/auth/devicewith{"name": "…"}, the name of the token to make, and optionallyscopesandexpires_in_days, returns adevice_code, auser_codeof eight characters such asABCD-EFGH, andverification_uri_complete, the platform's/device?code=…page. Both codes lastexpires_inseconds, 600.- The person opens that page, signed in, and authorizes it after confirming who they are, or denies it.
- Meanwhile the client calls
POST /v1/auth/device/tokenwith{"device_code": "…"}everyintervalseconds, 3. It answers400andauthorization_pendinguntil then, the new token once it is authorized,403anddevice_deniedif it was denied, and400anddevice_code_invalidonce the code expired or was used.
Interactive clients sign in directly instead:
curl -sS "$BASE/v1/auth/login" -H 'Content-Type: application/json' \
-d '{"username": "alice", "password": "..."}'
The response is {"tokens": {...}, "mfa": null}, where tokens holds access_token, refresh_token, token_type (bearer) and expires_in, the lifetime of the access token in seconds. For an account with two-step verification it is {"tokens": null, "mfa": {"ticket": "...", "methods": ["totp", "webauthn", "recovery"]}}; complete it with POST /v1/auth/mfa/verify and {"ticket", "method", "code"}.
POST /v1/auth/refreshwith{"refresh_token": "..."}returns a new pair. Store the new refresh token: the old one stops working a minute later. Asking again with the old one within that minute, for example after losing the answer, returns the same new refresh token.POST /v1/auth/logoutwith the refresh token ends its session.
Errors
Errors are JSON objects with a stable, machine-readable code and a human-readable message:
{"code": "quota_exceeded.memory_mb", "message": "memory_mb quota exceeded: 4096 used + 16384 requested > 16384"}
| Status | Codes | Meaning |
|---|---|---|
400 | captcha_required, captcha_invalid, or a specific code such as volume_shrink, workspace_domain_unset, authorization_pending | The request cannot be carried out as stated. |
401 | unauthorized, invalid_credentials, invalid_token, account_inactive | Missing, wrong or expired credentials. |
402 | insufficient_credit, storage_frozen | The team has no credit for it. |
403 | forbidden, insufficient_scope, reauth_required, wrong_password, mcp_disabled, device_denied | The caller or its token may not do it, has not confirmed who it is, or the feature is turned off. |
404 | not_found, template_unavailable | The resource does not exist, or the caller may not see it. |
409 | name_taken, username_taken, volume_attached, mount_path_taken, workspace_managed, volume_managed, worker_full, worker_cordoned | The resource already exists, is still referenced, is part of something changed only as a whole, or is in the wrong state. |
422 | quota_exceeded.<dimension>, invalid, worker_unoffered, volumes_apart, volume_elsewhere | A quota would be exceeded, a value is invalid, or what is asked cannot be placed. |
429 | too_many_requests, too_many_attempts | Over a rate or guessing limit; Retry-After says how many seconds to wait. |
500 | internal_error | A fault of the platform. It is logged with the request's ID; the message says no more. |
502 | worker_unreachable, worker_error, worker_outdated | A worker's agent is away, refused, or is of a release that does not know what was asked. |
503 | unavailable, captcha_unavailable | The database is busy, or a Turnstile challenge cannot be checked right now. Try again. |
504 | timeout | The operation took too long. |
A request whose body or parameters do not match the schema is answered with 422 and the code invalid. details lists every problem found, each at its location, for a form to show by its field:
{"code": "invalid", "message": "body.name: expected length >= 1", "details": [
{"location": "body.name", "message": "expected length >= 1"},
{"location": "body.cpu_m", "message": "expected number >= 100"}
]}
Pagination
List endpoints take limit (1 to 500, default 50) and offset (default 0) and return a page:
{"items": [], "total": 0}
total is the number of matches before paging. Most lists also take q for a text search; workspaces, clusters and volumes take all=true to include other teams' resources, which is honoured with the corresponding :read, :maintain or :manage permission.
Batch operations
POST /v1/workspaces/batch (start, stop, delete) and POST /v1/users/batch (enable, disable, delete) take up to 500 ids. Each item succeeds or fails on its own:
{"succeeded": ["k3v9x0a2bq"], "failed": {"p0o9i8u7y6": {"code": "not_found", "message": "workspace not found"}}}
Asynchronous results
Creating, starting, stopping or deleting a workspace or volume returns as soon as the request is recorded. The cluster follows. Poll the resource and read phase to see the outcome; see Workspaces. While the platform cannot get there, status_code says why, as one of the codes above, and status_message in words; it keeps trying, ever less often, until it can. After a success, status_code is empty and status_message holds what the worker said of the resource, if anything.
Clients
The idk command line and the MCP server for AI agents act through this API. Both are built on the Go package github.com/idekube-project/idekube-platform/backend/client, which other Go programs may import as well.