Skip to content

REST API ​

The management API, on port 8080. Its OpenAPI 3.1 document has the same schemas as gRPC, since both come from one set of protos. A server serves it at /v3/api-docs (/v3/api-docs.yaml as YAML), and shows it in Swagger UI at /swagger-ui.html, where Authorize takes a token. ./gradlew :api:generateOpenApi writes it to api/build/openapi/cosky.yaml, with the item schema of the Watch's event stream as well, which the server's copy leaves out.

Conventions ​

Authentication: Authorization: Bearer <token>, on everything except GET /v1/auth/config and Actuator.

Resources have shared metadata and one kind-specific spec, in proto3 JSON. Empty fields are left out, and 64-bit numbers such as revisions are strings.

json
{
  "meta": {
    "namespace": "prod",
    "name": "app.yaml",
    "revision": "42",
    "createRevision": "7",
    "updatedAt": "2026-08-18T01:00:00Z",
    "updatedBy": "serviceaccount:admin"
  },
  "config": {"format": "CONFIG_FORMAT_YAML", "content": "a: 1", "sha256": "..."}
}

Names: {name} is one path segment, so a / in a Config name is sent as %2F.

Writes replace the whole object, and read-only fields are ignored.

HeaderMeans
If-Match: "42"Only if it is still at revision 42
If-None-Match: *Only if it does not exist

GET and PUT return the revision as ETag. A PUT of what is already there answers {"changed": false} and creates no revision.

Lists come in pages: pass nextPageToken as pageToken until it is empty. pageSize is 500 by default and 1000 at most, and a page can hold fewer when the objects are large. The response's revision and epoch let you start a Watch from where the list ended.

Reading your own writes: a replica may be slightly behind. ?minRevision=42 waits until it has reached that revision, and answers 504 after 3 seconds.

Errors are problem details (RFC 9457), as application/problem+json. Beside type, title, status, detail and instance, code is the gRPC status, and reason the reason, which does not change between versions. Some reasons add a member that says more. type leads to the reason's row below.

json
{
  "type": "https://cosky.ahoo.me/guide/rest-api#revision-conflict",
  "title": "Revision conflict",
  "status": 409,
  "detail": "KIND_CONFIG prod/app.yaml: expected revision 42, current revision 43.",
  "instance": "/v1/namespaces/prod/configs/app.yaml",
  "code": "ABORTED",
  "reason": "ERROR_REASON_REVISION_CONFLICT",
  "revisionConflict": {
    "key": {"namespace": "prod", "kind": "KIND_CONFIG", "name": "app.yaml"},
    "expectedRevision": "42",
    "currentRevision": "43"
  }
}
ReasonHTTPMore
RESOURCE_NOT_FOUND404resourceNotFound: the key
NAMESPACE_NOT_FOUND404namespace
INVALID_ARGUMENT400badRequest: the violations
UNAUTHENTICATED401
PERMISSION_DENIED403
REVISION_CONFLICT409revisionConflict: the key, the expected and the current revision
NAMESPACE_NOT_EMPTY409namespace
LEASE_NOT_FOUND412leaseNotFound
WATCH_QUOTA_EXCEEDED429watchQuotaExceeded: the limit
STORE_UNAVAILABLE503
REVISION_REGRESSION503namespace
MIN_REVISION_TIMEOUT504namespace

Failures that are not CoSky's own, such as a path that does not exist, are problem details too, of the type about:blank, without code or reason.

Endpoints ​

Configs ​

MethodPath
GET/v1/namespaces/{ns}/configsList. ?labelSelector=a=1,b=2
GET, PUT, DELETE/v1/namespaces/{ns}/configs/{name}
GET/v1/namespaces/{ns}/configs/{name}/historyNewest first. ?limit= is the most revisions over all pages together, and ?pageToken= the next page
POST/v1/namespaces/{ns}/configs/{name}:rollback{"toRevision": "41"}. Writes that content as a new revision, and brings back a deleted Config.
POST/v1/namespaces/{ns}/configs:importA zip file as the body; each entry path is a Config name
GET/v1/namespaces/{ns}/configs:exportA zip file

Instances ​

MethodPath
GET/v1/namespaces/{ns}/instancesList. ?service=order&labelSelector=
GET, PUT, DELETE/v1/namespaces/{ns}/instances/{name}Without meta.lease, it stays until deleted. The service cannot change

Leases are gRPC only: applications use the client.

Watch ​

GET /v1/namespaces/{ns}/watch?kind=KIND_CONFIG&name=&service=&fromRevision=&fromEpoch=

Server-sent events, one proto3 JSON message per data: line:

MessageMeans
snapshotThe current state, when fromRevision is 0. Holds the epoch to resume with.
eventsOne revision's changes
progressA bookmark, every 10 seconds while idle
goneYour position is no longer valid: start over without one
canceledThe stream ends, for the reason given

Large snapshots and revisions span several messages, marked by more. An EventSource cannot send a token: use fetch with a stream reader, as the Dashboard does.

Views ​

Computed from the server's memory, read-only.

Path
/v1/namespaces/{ns}/views/servicesServices and their instance counts
/v1/namespaces/{ns}/views/topologyWho consumes whom
/v1/namespaces/{ns}/views/statsCounts of services, instances and Configs

Global objects ​

MethodPath
GET/v1/namespaces
GET, PUT, DELETE/v1/namespaces/{name}The smallest body is {"namespace":{}}. Only an empty namespace can be deleted. While a deletion is under way, namespace.terminating is true, namespace.terminatingEpoch names the namespace it is for, and a write gets 404. A deletion that finds the namespace created again meanwhile stops with 409 and changes nothing.
GET/v1/serviceaccounts
GET, PUT, DELETE/v1/serviceaccounts/{name}The smallest body is {"serviceAccount":{}}. tokens in the body is ignored.
POST/v1/serviceaccounts/{name}/tokensReturns the plaintext once. {"expiresAt": "..."} is optional.
DELETE/v1/serviceaccounts/{name}/tokens/{tokenId}
GET/v1/roles
GET, PUT, DELETE/v1/roles/{name}
GET/v1/rolebindings
GET, PUT, DELETE/v1/rolebindings/{name}

Identity ​

Path
/v1/meWho you are, and your effective rules
/v1/auth/configHow people sign in. Needs no token and holds public values only.

Operations ​

Path
/actuator/health/liveness, /actuator/health/readinessProbes
/actuator/prometheusMetrics

Released under the Apache License 2.0.