REST API Reference
Use the same-origin HTTP surface with the correct session, CSRF, cluster, namespace, permission, and object semantics.
The Gameplane API is a same-origin HTTP surface that mirrors Kubernetes API semantics. Every request requires a valid session token and CSRF token, respects namespace and cluster scope rules, and enforces fine-grained RBAC permissions.
Resource Collections
List or create namespaced GameServer, Backup, and related resources.
| Route | Method | Permission | Description |
|---|---|---|---|
/servers |
GET · POST | servers:read/write |
List or create namespaced GameServer resources. |
/backups |
GET · POST | backups:read/write |
List and start one-shot world backups. |
/restores |
GET · POST | backups:read/restore |
List and initiate restore operations. |
/schedules |
GET · POST | schedules:read/write |
List and manage backup schedules. |
/modules |
GET | modules:read |
Browse installed and available module resources. |
/users |
GET · POST | users:read/manage |
List or invite platform users. |
/users/me/language |
PUT | signed-in user | Save your dashboard language as {"language": "<tag>"}; null clears it (v0.4.0). |
/auth/locale |
GET | none (public) | Instance default language tag for the login page; returns only the tag (v0.4.0). |
Clusters and Nodes
Register and inspect the clusters you can see. Cluster-level mutations need cluster:manage.
| Route | Method | Permission | Description |
|---|---|---|---|
/clusters |
GET | none (filtered by your grants) | List the registered clusters you can see. |
/clusters |
POST | cluster:manage |
Register a remote cluster. |
/clusters/{name} |
DELETE | cluster:manage |
Remove a cluster registration. |
/clusters/{name}/kubeconfig |
PUT | cluster:manage |
Replace a registered cluster’s kubeconfig; keeps its identity and grants (v0.4.0). |
/clusters/{name}/gateway |
PUT · DELETE | cluster:manage |
Set or remove the remote agent gateway credentials (v0.4.0). |
/cluster |
GET | cluster:read |
Nodes and health of the selected cluster. |
/fleet/inventory |
GET | exact cluster-wide inventory grant | Nodes of every cluster you can see, across clusters (v0.4.0 listing). |
/fleet/servers, /fleet/backups, /fleet/schedules, /fleet/restores |
GET | per-item grants | Permission-filtered reads across every authorized cluster (v0.3.0). |
Actions and Administration
Trigger server lifecycle operations, manage platform configuration, and audit access logs.
| Route | Method | Permission | Description |
|---|---|---|---|
/servers/{name}:restart |
POST | servers:write |
Request an audited graceful restart. |
/servers/{name}:start |
POST | servers:write |
Resume a suspended server. |
/servers/{name}:stop |
POST | servers:write |
Suspend a running server. |
/servers/{name}:wake |
POST | servers:write |
Wake a sleeping server (requires wake-on-connect enabled). |
/servers/{name}:clone |
POST | servers:write |
Create a copy of a server’s template and config. |
/servers/{name}:wipe-data |
POST | servers:write |
Erase a server’s game data (requires name confirmation). |
/servers/{name}/files/* |
GET · POST · DELETE | servers:write |
Agent-backed file browse and mutation proxy. |
/admin/config |
GET · PUT | config:read/manage |
Read or update platform configuration. |
/admin/audit |
GET | audit:read |
Paginate the audit log with optional filters. |
/admin/audit/export |
GET | audit:read |
Export filtered audit evidence as CSV or JSON. |
Authentication and Session Requirements
Every request must include:
-
Session Token — obtained via
/auth/login(local) or/auth/oidc/{provider}/callback(SSO). Passed as thegameplane_sessionHttpOnly cookie. -
CSRF Token — required for mutations (POST, PUT, PATCH, DELETE). Pass via the
X-Gameplane-CSRFheader. The same token must be sent as the X-Gameplane-CSRF header on every mutating request for the life of the session. -
Namespace Selector — passed as
?namespace=<name>for scoped resources (GameServers, Backups, etc.). Defaults to the user’s default namespace if absent. Users can only access namespaces they have been granted permission to. -
Cluster Selector — passed as
?cluster=<id>for multi-cluster installs. Defaults to the local (home) cluster. Users can only access clusters they have been granted permission to. Collection reads under/fleet/*(v0.3.0) ignore the default and combine every authorized cluster, with optional cluster and namespace filters, returning each item’s{cluster, namespace, name, uid}target and flagging unavailable or truncated scopes.
Cluster and namespace selectors follow the same scope rules as the dashboard UI. A user bound to a specific namespace or remote cluster cannot bypass that scope by changing query parameters.
Error Responses
The API returns standard HTTP status codes and plain-text error messages:
- 2xx — Success
- 400 Bad Request — Invalid input, missing required fields, or malformed query parameters
- 401 Unauthorized — Missing or expired session token
- 403 Forbidden — Insufficient permissions, namespace/cluster out of scope, or CSRF token invalid
- 404 Not Found — Resource does not exist
- 409 Conflict — Resource conflict (e.g., server name already in use, restore target mismatch)
- 429 Too Many Requests — Rate limit exceeded (per-user and per-IP buckets apply to mutations)
- 5xx Server Error — Internal server error or Kubernetes API failure
Error responses use Content-Type: text/plain; charset=utf-8 with a plain-text message body by default. The HTTP status code carries the semantics.
A client that lists application/problem+json in its Accept header (with a non-zero q) receives an RFC 9457 problem document instead (v0.4.0). It carries type, status, title, detail, a stable messageId and args (the message arguments), so the dashboard can show the message in the active language. Every other client keeps the plain-text body.
Query Parameters and Filters
Common Parameters
namespace— Target namespace for scoped resources (defaults to user’s default)cluster— Target cluster ID for multi-cluster requests (defaults tolocal)
Audit Export (GET /admin/audit/export)
format— Output format:csv(default) orjsonsince— RFC3339 start timestamp (inclusive)until— RFC3339 end timestamp (inclusive)actor— Filter by username (substring match)method— Filter by HTTP verb: GET, POST, PUT, PATCH, DELETEstatus— Filter by HTTP status class: 2xx, 4xx, 5xx
Example:
curl -H "X-Gameplane-CSRF: $CSRF" \
"https://gameplane.example.com/admin/audit/export?format=csv&actor=alice&status=4xx" \
-b "gameplane_session=$SESSION"
Request/Response Format
- Content-Type —
application/jsonfor all bodies - Request Bodies — POST and PATCH requests expect a JSON object. Refer to the CRD Catalog for the schema of each resource type.
- Response Format — Responses are either Kubernetes unstructured objects (for resource CRUD) or custom JSON structures (for actions, audit, config). List responses include a
itemsarray.
Rate Limiting
- Reads — Unlimited per authenticated session
- Writes — Per-IP burst of 60 requests, refilling at 60/min (no separate per-user write limit)
- Special endpoints —
/auth/loginapplies a per-IP burst of 10 (5/min refill) layered with a per-username burst of 6 (3/min refill); both apply only to login, tuned for Argon2id cost
Hitting the rate limit returns 429 Too Many Requests with a Retry-After header.
Examples
List GameServers in a namespace
curl -b "gameplane_session=$SESSION" \
"https://gameplane.example.com/servers?namespace=production&cluster=local"
Create a GameServer
curl -X POST \
-b "gameplane_session=$SESSION" \
-H "X-Gameplane-CSRF: $CSRF" \
-H "Content-Type: application/json" \
-d @server-manifest.json \
"https://gameplane.example.com/servers?namespace=production"
Request a graceful restart
curl -X POST \
-b "gameplane_session=$SESSION" \
-H "X-Gameplane-CSRF: $CSRF" \
"https://gameplane.example.com/servers/my-server:restart?namespace=production"
Export audit logs filtered by failed requests
curl -b "gameplane_session=$SESSION" \
"https://gameplane.example.com/admin/audit/export?format=json&status=4xx&status=5xx" \
-o audit-failures.json
See Also
- WebSocket & Event Streams — Real-time server health, player counts, and console output
- CRD Catalog — Full schema reference for GameServer, Backup, and other resources
- API & Realtime Development — Writing agent-backed WebSocket handlers
- Kubectl & GitOps Recipes — Using kubectl and git workflows alongside the API