API and Contracts
GlobalStacks ships OpenAPI and protobuf contract sources for the HTTP control plane and agent-control WebSocket surface.
API reference
GlobalStacks now ships contract sources in-repo:
openapi/openapi.yamlfor the HTTP control-plane APIproto/globalstacks/agent/v1/control_plane.protofor the agent-control WebSocket API
Current API coverage includes:
- authentication and current-user session status
- infrastructure clusters for BYO and GlobalStacks-managed sandbox capacity
- connected hosts, host overview, host logs, host terminal sessions, and routing metadata
- sandboxes, sandbox terminal sessions, and runtime activity
- sandbox blueprints under
/api/blueprints, including image-backed create, list, get, activate, deactivate, and delete - blueprint capture from existing sandboxes with
POST /api/sandboxes/{sandboxId}/blueprints - blueprint registry discovery, repository inventory, artifact inventory, and short-lived credential issuance under
/api/registry - external registry connections under
/api/registry-connections - runtime networks under
/api/networks, including members, aliases, policies, routes, mesh join, and agent-backed diagnostics - control-plane volume resources under
/api/volumes, including detached create and first-class attachment records under/api/volumes/{volumeId}/attachments - provisioning tokens and CLI API keys
- provisioning tokens are cluster-scoped and can only target BYO clusters
- interactive host terminal sessions are carried through the connected agent transport
- control-plane-managed feature operations should use typed agent APIs; volume lifecycle must move to first-class agent RPCs rather than shell-proxied command execution
Naming conventions
- HTTP collection endpoints use plural resource names such as
/api/clusters,/api/hosts,/api/sandboxes, and/api/volumes - record-specific operations hang off those collection paths, for example
/api/hosts/{hostId}or/api/volumes/{volumeId}/attachments/{attachmentId} - the operator CLI intentionally uses singular command namespaces, for example
gstacks host ...,gstacks volume ..., andgstacks sandbox ...
Volume model
- volumes are control-plane resources, not host-owned records
POST /api/volumescreates a detached volume recordPOST /api/volumes/{volumeId}/attachmentscreates a first-class attachment recordDELETE /api/volumes/{volumeId}/attachments/{attachmentId}removes one attachment record- attachment records are intentionally immutable; change is modeled as delete-and-recreate
- current implementation supports both
hostandsandboxattachments through that attachment collection - creating a sandbox attachment auto-realizes the required host-side volume attachment when needed
- the current agent implementation realizes many logical volumes on one host as subdirectories inside one shared JuiceFS filesystem mount
- sandbox bind-mount intent is applied by the host agent runtime
- the public HTTP API does not expose JuiceFS-specific tuning fields
- interactive host shell transport is not the execution path for volume lifecycle; using shell-proxied
gstacks-agent volume ...commands is not an acceptable long-term transport
Network model
POST /api/networkscreates an explicit runtime network boundaryPOST /api/sandboxes/{sandboxId}/networks/{networkId}/attachattaches a sandbox and publishes aliases- aliases are unique within a network and resolve as
<alias>.<network>.gstacks GET /api/networks/{networkId}/routeslists published aliases and portsPOST /api/networks/{networkId}/mesh-joinissues short-lived credentials for local mesh accessPOST /api/networks/{networkId}/diagnosticsasks participating agents to run read-only mesh checks- network diagnostics are agent-executed typed control messages, not host shell commands
Blueprint model
GET /api/blueprintslists blueprint records for the active tenantPOST /api/blueprintscreates an image-backed blueprint fromname,image, optionaldescription, optionalregistry_connection_id, and optional metadataGET /api/blueprints/{blueprintId}returns one blueprintPOST /api/blueprints/{blueprintId}/activatemarks a blueprint usable for sandbox creationPOST /api/blueprints/{blueprintId}/deactivatekeeps the record and artifact metadata but removes it from sandbox creationDELETE /api/blueprints/{blueprintId}removes an unused blueprint record and is blocked while live sandboxes reference itPOST /api/sandboxes/{sandboxId}/blueprintscreates a blueprint record from an existing sandbox and preserves source-sandbox provenancePOST /api/sandboxesaccepts eitherimageorblueprint; requests that set both are rejected- when
blueprintis provided, the control plane resolves the active blueprint by ID or unique name, uses its immutableartifact_refas the sandbox image source, and storessource_blueprint_idon the sandbox record POST /api/sandboxesalso accepts optional repository bootstrap fields:repository_id,repository_url,repository_branch,repository_commit,repository_path, andrepository_credential_secret_ref- repository bootstrap metadata is returned on the sandbox record with
repository_bootstrap_status,repository_url,repository_branch,repository_commit, andrepository_path
Created blueprints are stored in the internal blueprint repository. External registries are read-only sources for image-backed blueprints; GlobalStacks records the source connection and publishes its own internal artifact reference for later sandbox provisioning.
The current retention policy is conservative: deactivate blueprints that should no longer be selected for new sandboxes, delete only unused blueprint records, and retain internal artifact metadata for auditability.
Registry model
GET /api/registryreturns internal blueprint registry discovery data, including URL, namespace, storage driver, S3 configuration status, supported digest behavior, and default credential TTL/registry/v2/serves the embedded OCI registry API for internal blueprint artifactsGET /api/registry/repositorieslists internal blueprint repositoriesGET /api/registry/artifactslists locally published blueprint artifacts and digest referencesPOST /api/registry/credentialsissues a short-lived pull or push credential scoped to a repository and optional artifactGET /api/registry-connectionslists external source registry connectionsPOST /api/registry-connectionscreates an external source registry connection with provider, URL, username, secret reference, project, TLS, and metadata fieldsGET /api/registry-connections/{registryConnectionId}returns one external source registry connectionPATCH /api/registry-connections/{registryConnectionId}updates one external source registry connectionDELETE /api/registry-connections/{registryConnectionId}deletes a registry connection when no active blueprint depends on it
Internal registry pull credentials are short-lived and scoped to one repository action. Agents request pull credentials through the typed control-plane stream before pulling blueprint artifacts by digest. Registry credentials are stored as secret references, not plaintext passwords. Provider aliases are normalized for Docker Hub, GHCR, GitLab, AWS ECR, Google Artifact Registry, Azure Container Registry, and custom registries. A blank Docker Hub registry URL defaults to https://docker.io.
S3-backed blueprint repository storage is the durable mode for production. In that mode, manifests, blobs, and upload state live in the configured S3-compatible bucket and local files are only rebuildable cache. Local filesystem storage remains useful for development and single-node testing. Agents cache blueprint images locally by immutable digest, report cache status to the control plane, and can receive warm-cache jobs so placement can prefer an already-warmed host when capacity and policy are otherwise comparable.
Recommended usage
For product usage:
- use the console for interactive workflows
- use
gstacksfor supported command-line workflows - use the contract files when building tooling, tests, or integrations against the current control-plane surface
Contract files
- HTTP:
openapi/openapi.yaml - Generated TypeScript types:
openapi/generated/types.d.ts - WebSocket:
proto/globalstacks/agent/v1/control_plane.proto