openapi: 3.0.3 info: title: AgentBox API version: "0.1.10" description: | AgentBox provides Sandbox lifecycle management and tenant API key provisioning. ## Authentication All API requests must include an API key in the `AGENTBOX-API-KEY` header: ``` AGENTBOX-API-KEY: ``` ## Admin Impersonation Admin callers can act on behalf of any user by adding the following optional headers to **any regular (non-admin) endpoint**: ``` X-Impersonate-Team: X-Impersonate-User: ``` When both headers are present and the caller has admin role, the server resolves the target user's Kubernetes namespace via IAM and executes the request as if that user made the call. Non-admin callers that supply these headers have them silently ignored. contact: name: AgentBox Support tags: - name: auth x-displayName: Auth description: > Caller identity and authentication. Use `GET /auth/whoami` to verify your API key and discover your role (tenant / admin). - name: approvals x-displayName: Approvals description: > The gate that holds a write made with an unattended credential until a person says yes. A refused call answers `428` naming an approval id; these routes are where that id is polled and decided. Deciding requires a console session — a credential must not be able to approve its own writes. - name: sandboxes x-displayName: Sandboxes description: > Sandbox lifecycle management — create, inspect, delete, and interact with individual sandbox instances. Non-admin callers operate within their own namespace; admin callers may additionally supply `X-Impersonate-Team` / `X-Impersonate-User` headers to act on behalf of another user. - name: pools x-displayName: Pools description: > SandboxPool management — create and manage pre-warmed pod pools. Each pool holds a configurable number of idle sandboxes ready for instant allocation. Admin callers may impersonate via `X-Impersonate-Team` / `X-Impersonate-User`. - name: sandbox-envs x-displayName: Envs description: > SandboxEnv management — declarative environments that fan out into one or more member SandboxPools. The Env Reconciler materialises a member pool per entry in `members`, or a single quota-less pool named after the Env when `members` is empty. - name: sandbox-templates x-displayName: Templates description: > Read-only access to SandboxTemplate cluster resources. Templates define the pod spec, idle image, runtime port mappings, and reservation config shared across pools. - name: quotas x-displayName: Quotas description: > SI Scheduler quota information for the authenticated user. Returns resource allocations, usage, and free capacity per quota entry. - name: instancetypes x-displayName: Instance Types description: > Catalog of named base resource shapes that a sandbox can scale up from by an integer multiplier. Returned entries are read-only; resolution of (name, multiplier) into Pod resources happens server-side. The `instanceType` flag on `/feature-gates` reports whether the catalog backend is wired in. - name: volumes x-displayName: Volumes description: > Discovery of the PersistentVolumeClaims a caller may mount into a sandbox through `SandboxEnv.overrides.volumes`. Scoped to the caller's own namespace — the operation takes no namespace parameter, and that derivation is the authorisation boundary rather than a filter, since Kubernetes cannot mount a claim across namespaces. The `volumes` flag on `/feature-gates` reports whether the feature is enabled; while it is off the listing is empty and a non-empty `overrides.volumes` is rejected. - name: clusters x-displayName: Clusters description: > Cluster catalog visible to the current gateway. Use this to discover valid `clusterID` prefixes for cross-cluster sandbox and pool identifiers (`{clusterID}.{uuid}` for sandboxes, `{clusterID}::{poolName}` for pools). The `local: true` entry marks the cluster actually serving this request. - name: statistics x-displayName: Statistics description: > Aggregated sandbox and pool statistics. Tenant-scoped statistics are available to all authenticated users; cluster-wide statistics require admin role. - name: apikeys x-displayName: API Keys description: > Self-service API key management for tenants. Each key is scoped to the caller's namespace and cannot access resources in other namespaces. - name: feature-gates x-displayName: Feature Gates description: > Optional features enabled on this cluster. Clients use this to discover which feature-specific endpoints and UI elements are available. - name: admin x-displayName: Admin description: > Admin-only operations: cross-namespace sandbox/pool inspection, API key provisioning, template management, and organization queries. All endpoints require an admin-role API key (`AGENTBOX-API-KEY` header). # Group related tags in tools that render x-tagGroups (Redoc, Stoplight). Other # tools simply ignore this block and render the flat tag list above. x-tagGroups: - name: providers x-displayName: Providers tags: [quotas, instancetypes] servers: - url: "{protocol}://{path}" description: Responds with your request data variables: protocol: enum: - https - http default: https path: default: "" security: - ApiKeyAuth: [] components: parameters: QueryLimit: name: limit in: query required: false description: "Maximum number of items to return per page." schema: type: integer default: 20 minimum: 1 maximum: 1000 QueryOffset: name: offset in: query required: false description: "Number of items to skip before returning results (zero-based)." schema: type: integer default: 0 minimum: 0 # ----- Path parameters ----- PathSandboxId: name: sandboxId in: path required: true description: | Sandbox identifier. * Single-cluster: a bare UUID v7 such as `5de15c92-8fb5-440f-a9ea-7f62f734f1b9`. * Cross-cluster: a `{clusterID}.{uuid}` composite such as `cluster1.5de15c92-8fb5-440f-a9ea-7f62f734f1b9` (dot-separated). The `clusterID` prefix tells the gateway which Worker cluster owns this sandbox; the server parses it out transparently. Discover valid cluster IDs via `GET /clusters`. Because of the composite form, this field is NOT a strict RFC 4122 UUID — clients must treat it as an opaque string. Parsing reference: `pkg/utils/cluster/sandbox_id.go::SplitSandboxID`. schema: type: string example: "5de15c92-8fb5-440f-a9ea-7f62f734f1b9" PathPoolName: name: name in: path required: true description: | SandboxPool name. * Single-cluster: a DNS-1123 label such as `my-pool`. * Cross-cluster: a `{clusterID}::{poolName}` composite such as `cluster1::my-pool` (double-colon separator). Discover valid cluster IDs via `GET /clusters`. Parsing reference: `pkg/utils/cluster/parse.go::ParsePoolRef`. Note: the E2B-compatible API further extends this to `{clusterID}::{poolName}//{imageOverride}` for template strings; that form is only accepted on the E2B port, not on this native API. schema: type: string example: "my-pool" PathTemplateName: name: name in: path required: true description: "Global SandboxTemplate name (cluster-scoped resource)." schema: type: string example: "default-template" PathAPIKeyName: name: name in: path required: true description: | API key identifier in `{namespace}/{shortName}` format, or just `{shortName}` when the caller's namespace is implied. Admin endpoints accept the fully-qualified form. schema: type: string example: "t-team-user/my-key" PathTeam: name: team in: path required: true description: "Team name." schema: type: string example: "my-team" # ----- Common query filters ----- QueryTeam: name: team in: query required: false description: "Filter by team name. Admin callers may also use X-Impersonate-Team." schema: type: string QueryUser: name: user in: query required: false description: "Filter by user name. Admin callers may also use X-Impersonate-User." schema: type: string QueryNamespace: name: namespace in: query required: false description: "Filter by Kubernetes namespace (admin only)." schema: type: string QueryPoolName: name: poolName in: query required: false description: "Filter by sandbox pool name." schema: type: string QuerySandboxStatus: name: status in: query required: false description: "Filter by sandbox phase. One of: Idle, Starting, Running, Stopping, Failed." schema: type: string securitySchemes: ApiKeyAuth: type: apiKey in: header name: AGENTBOX-API-KEY AdminKeyAuth: type: apiKey in: header name: AGENTBOX-API-KEY description: "Admin-level API key. Same header as ApiKeyAuth but requires admin role." schemas: # Free-form string key/value metadata. Named rather than written out at each # use site because two inline maps with the same shape under schemas that # share an `allOf` parent make openapi-python-client try to emit two models # with the same generated name; it then drops the parent schema entirely, # and with it every endpoint that references it. That failure is silent — # the client is generated, just missing POST /envs. StringMap: type: object description: "Free-form string key/value metadata (labels or annotations)." additionalProperties: type: string # ========================================================= # Sandbox # ========================================================= SandboxStatusDetail: type: object properties: reason: type: string description: "Machine-readable reason code for the current status (mirrors Kubernetes condition reason)." message: type: string description: "Human-readable message explaining the current status." lastUpdatedTime: type: string format: date-time description: "RFC 3339 timestamp of when this status detail was last updated." additionalProperties: false SandboxEndpoint: type: object required: [url] properties: url: type: string description: "Fully-qualified URL to reach this runtime endpoint (e.g. https://sandbox.example.com/api)." logDir: type: string description: "Path to the runtime log file inside the container, if configured" additionalProperties: false SandboxReadinessResult: type: object required: [sandboxId, ready] properties: sandboxId: type: string description: | Sandbox identifier. Single-cluster: bare UUID v7 (e.g. `5de15c92-8fb5-440f-a9ea-7f62f734f1b9`). Cross-cluster: `{clusterID}.{uuid}` composite (e.g. `cluster1.5de15c92-...`, dot-separated). NOT a strict RFC 4122 UUID — treat as opaque. example: "5de15c92-8fb5-440f-a9ea-7f62f734f1b9" ready: type: boolean description: "True when all configured readiness probes have passed." endpoints: type: object description: "Per-runtime readiness status, keyed by runtime name." additionalProperties: type: object properties: ready: type: boolean description: "Whether this runtime endpoint's readiness probe passed." message: type: string description: "Diagnostic message when the probe failed." additionalProperties: false Sandbox: type: object required: [sandboxId, namespace, poolName, podName, status, claimedAt] properties: sandboxId: type: string description: | Sandbox identifier. Single-cluster: bare UUID v7 (e.g. `5de15c92-8fb5-440f-a9ea-7f62f734f1b9`). Cross-cluster: `{clusterID}.{uuid}` composite (e.g. `cluster1.5de15c92-...`, dot-separated). NOT a strict RFC 4122 UUID — treat as opaque. example: "5de15c92-8fb5-440f-a9ea-7f62f734f1b9" namespace: type: string description: "Kubernetes namespace where the sandbox pod is running." poolName: type: string description: "Name of the SandboxPool this sandbox was allocated from." envName: type: string description: "Name of the SandboxEnv that owns the pool this sandbox was allocated from (from pod label agentbox.navix.sh/env)." podName: type: string description: "Name of the Kubernetes Pod backing this sandbox." status: type: string enum: [ Pending, Starting, Running, Stopping, Failed, Completed, Canceled, Released, ] description: "Current lifecycle phase of the sandbox." claimedAt: type: string format: date-time description: "RFC 3339 timestamp when the sandbox was claimed by a user." startedAt: type: string format: date-time description: "RFC 3339 timestamp when the sandbox transitioned to Running." containerImages: type: object description: "Map of container name to image URI for each container in the sandbox pod." additionalProperties: type: string metadata: type: object description: "User-defined key-value pairs attached to the sandbox for filtering and annotation." additionalProperties: type: string endpoints: type: object description: "Map of runtime name to its endpoint URL, populated once the sandbox is Running." additionalProperties: $ref: "#/components/schemas/SandboxEndpoint" cpu: type: string description: 'CPU resource allocated to the sandbox (Kubernetes resource quantity, e.g. "1", "100m").' memory: type: string description: 'Memory resource allocated to the sandbox (Kubernetes resource quantity, e.g. "16Gi", "512Mi").' terminatedAt: type: string format: date-time description: "RFC 3339 timestamp when the sandbox workload terminated (exit or stop signal)." recycledAt: type: string format: date-time description: "Timestamp when the sandbox completed recycling (Stopping → Idle in-place upgrade) and the record was written to the store. Also set for evicted/externally-deleted sandboxes to record when the Failed record was persisted." durationSeconds: type: integer format: int64 description: "Wall-clock duration of the sandbox in seconds. Set for Running (startedAt to query time), Completed, Failed, and Released states (startedAt to terminatedAt). Omitted for Starting and Canceled states." idleTimeoutSeconds: type: integer format: int64 description: "Idle timeout in effect for THIS sandbox, in seconds, as resolved at claim time (request value overriding the pool default) and updated by SetTimeout. Omitted when the sandbox has no idle timeout. This is the per-sandbox value, not the pool default in SandboxPool.spec.defaultIdleTimeout — a caller that passed its own timeout sees the value it passed." failureReason: type: string description: "Machine-readable reason code when status is Failed." exitCode: type: integer format: int32 description: "Exit code of the main container when the sandbox terminated." failureMessage: type: string description: "Human-readable message describing the failure cause." statusDetail: $ref: "#/components/schemas/SandboxStatusDetail" team: type: string description: "Team label of the sandbox owner (from pod label)" user: type: string description: "User label of the sandbox owner (from pod label)" nodeName: type: string description: "Kubernetes node the sandbox Pod was scheduled onto." containerId: type: string description: 'Runtime container ID (e.g. "docker://abc123") of the primary container, captured when the sandbox entered Running state.' envdSecured: type: boolean description: "True when envd (the sandbox control port) requires an access token. Set from the create request's secure flag; used to decide whether to return an envd access token to the caller." trafficSecured: type: boolean description: "True when the sandbox's user service ports require a traffic access token. Set when the create request disabled public traffic; used to decide whether to return a traffic access token to the caller." example: sandboxId: "5de15c92-8fb5-440f-a9ea-7f62f734f1b9" namespace: "t-team-user" poolName: "poolname" podName: "poolname-wxtfc" status: "Completed" claimedAt: "2026-04-07T14:37:54Z" startedAt: "2026-04-07T14:37:55Z" terminatedAt: "2026-04-07T14:38:10Z" recycledAt: "2026-04-07T14:38:11Z" durationSeconds: 15 cpu: "1" memory: "16Gi" team: "team" user: "user" containerImages: sandbox: "docker.io/project/name:tag" SandboxEnvelope: type: object required: [sandbox] properties: sandbox: $ref: "#/components/schemas/Sandbox" # ========================================================= # Sandbox Logs # ========================================================= SandboxLogEntry: type: object required: [container, log] properties: timestamp: type: string format: date-time description: "RFC 3339 timestamp of the log line." container: type: string description: "Name of the container that produced this log line." log: type: string description: "Raw log line content." SandboxLogsResult: type: object required: [sandboxId, namespace, entries, truncated, source] properties: sandboxId: type: string description: | Sandbox identifier. Single-cluster: bare UUID v7; cross-cluster: `{clusterID}.{uuid}` composite (dot-separated). NOT a strict RFC 4122 UUID — treat as opaque. example: "5de15c92-8fb5-440f-a9ea-7f62f734f1b9" namespace: type: string description: "Kubernetes namespace of the sandbox." podName: type: string description: "Name of the Kubernetes Pod backing the sandbox." capturedAt: type: string format: date-time description: "RFC 3339 timestamp when the log snapshot was captured." entries: type: array description: "Ordered list of log lines (oldest first)." items: $ref: "#/components/schemas/SandboxLogEntry" truncated: type: boolean description: "True when the response was truncated due to the `lines` limit or internal size cap." totalBytes: type: integer format: int64 description: "Total byte size of all log entries before any truncation." source: type: string enum: [live, cached, runtime, central] description: | Where the lines came from. `live` reads the sandbox's Pod through the Kubernetes log API. `central` is the central log service, used once the sandbox has ended and its Pod was recycled; only what the log pipeline collected is available there. `runtime` is a runtime's own log file, read via exec. scope: type: string description: | For source=central: what was actually asked of the central log service — log store, filters and time window. An empty result and a mis-scoped query are the same 200 with no rows over the wire, so this is the only way to tell "the sandbox printed nothing" from "nobody was asked about it". containers: type: array description: | Every container of the sandbox Pod whose log can be read, the sandbox's own first. Includes init containers: on a Kubernetes with native sidecars the egress proxy is one, and the kubelet serves its log like any other. A client uses this to offer the choice; omitting `container` reads the sandbox container alone. items: type: string runtimeName: type: string description: "When source=runtime, the runtime name whose log file was read" SetSandboxTimeoutRequest: type: object required: [timeout] properties: timeout: type: string description: "New idle timeout duration. Duration string, e.g. '30m', '2h'. Use '0' to disable the timeout." example: "30m" ExecTokenResponse: type: object required: [token] properties: token: type: string description: Single-use exec token, valid for 30 seconds ExecCommandRequest: type: object required: [command] properties: command: type: string description: "Shell command to execute inside the sandbox (e.g. 'ls -la /tmp')" example: "echo hello" timeoutSeconds: type: integer description: "Execution timeout in seconds. Default: 30, Max: 300." minimum: 1 maximum: 300 example: 30 ExecCommandResult: type: object required: [exitCode, stdout, stderr] properties: exitCode: type: integer description: "Exit code of the command (0 = success)" stdout: type: string description: "Standard output of the command" stderr: type: string description: "Standard error of the command" DeleteSandboxResult: type: object required: [sandboxId, namespace, poolName, podName, status] properties: sandboxId: type: string description: | Sandbox identifier. Single-cluster: bare UUID v7; cross-cluster: `{clusterID}.{uuid}` composite (dot-separated). NOT a strict RFC 4122 UUID — treat as opaque. example: "5de15c92-8fb5-440f-a9ea-7f62f734f1b9" namespace: type: string description: "Kubernetes namespace the sandbox belonged to." poolName: type: string description: "Name of the SandboxPool the sandbox was allocated from." podName: type: string description: "Name of the Kubernetes Pod that backed the sandbox." status: type: string description: "Final status of the delete operation (e.g. Stopping)." CreateSandboxRequest: type: object required: [poolName] properties: poolName: type: string description: | Where to allocate the sandbox from: * `{envName}` — a SandboxEnv; the server picks one of its member Pools. A bare name must match an Env (every Pool has a same-named Env). * `{clusterID}::{name}` — pinned to one cluster, where `name` is resolved Env-first and falls back to a Pool of that name. A foreign `clusterID` forwards the request to that cluster, which resolves `name` itself. example: "my-env" image: type: string description: "Override the main container image for this sandbox. Replaces the pool's default image." example: "docker.io/myorg/myimage:latest" containerImages: type: object description: "Per-container image overrides keyed by container name. Takes precedence over `image`." additionalProperties: type: string labels: type: object description: "Kubernetes labels to apply to the sandbox pod." additionalProperties: type: string annotations: type: object description: "Kubernetes annotations to apply to the sandbox pod." additionalProperties: type: string metadata: type: object description: "User-defined key-value metadata for filtering and annotation. Available on the sandbox object after creation." additionalProperties: type: string startupTimeout: type: string description: "Maximum duration to wait for the sandbox to reach Running status before marking it as Failed. Duration string, e.g. '30s', '2m'." example: "2m" idleTimeout: type: string description: "Duration of inactivity after which the sandbox is automatically stopped. Duration string, e.g. '5m', '1h'. Use '0' to disable." example: "30m" ListSandboxesResult: type: object required: [items, total, limit, offset] properties: items: type: array description: "Page of sandbox objects matching the query." items: $ref: "#/components/schemas/Sandbox" total: type: integer description: "Total number of sandboxes matching the query (before pagination)." limit: type: integer description: "Maximum number of items requested per page." offset: type: integer description: "Number of items skipped before this page." # ========================================================= # SandboxPool # ========================================================= SandboxPoolSpec: type: object required: [replicas] properties: replicas: type: integer format: int32 minimum: 0 description: "Desired number of pre-warmed idle pods in the pool." templateName: type: string description: "Name of the SandboxTemplate cluster resource to use as the pod spec source." podCreationImagePolicy: type: string enum: [PoolDefaultImage, IdleImage] default: IdleImage description: "Controls which image newly created Pods start with. IdleImage (default) uses spec.idleImage; PoolDefaultImage uses the template container image." defaultStartupTimeout: type: string description: "Default startup timeout for sandbox create requests in this pool when the request does not specify startupTimeout. Also serves as the upper bound for the Starting phase: the controller deletes pods stuck in Starting for longer than this value. If not set, the internal default (2m) is used for create requests; no cleanup is enforced by default. Duration string, e.g. '5m'." defaultIdleTimeout: type: string description: "Default idle timeout for sandboxes created in this pool. Applied when a CreateSandbox request does not specify idleTimeout. If not set, sandboxes have no idle timeout by default. Duration string, e.g. '30m'." SandboxPoolStatus: type: object properties: phase: type: string enum: [Pending, Ready, ScalingUp, ScalingDown, Degraded, Terminating] description: "High-level pool health summary. Pending=no pods; Ready=all healthy idle pods present; ScalingUp/ScalingDown=replica count changing; Degraded=has unavailable idle or failed pods; Terminating=pool is being deleted." idleReplicas: type: integer format: int32 description: "Number of pods in Idle phase (ready to be claimed)." unavailableIdleReplicas: type: integer format: int32 description: "Number of Idle pods whose PodReady condition is False (e.g. Pending, CrashLoopBackOff). These are counted in idleReplicas but cannot accept requests. Non-zero value triggers Degraded phase." runningReplicas: type: integer format: int32 description: "Number of pods actively serving a sandbox workload." startingReplicas: type: integer format: int32 description: "Number of pods currently starting up." stoppingReplicas: type: integer format: int32 description: "Number of pods transitioning from Running to Idle (in-place upgrade in progress)." failedReplicas: type: integer format: int32 description: "Number of pods in a Failed state." pendingRequests: type: integer format: int32 description: "Throttled mirror of the in-process PoolScheduler queue depth. Patched every ~3s when the queue length changes by at least 20% or crosses the 0/>0 boundary. Useful for Dashboard observability — the Env autoscaler reads the live in-process Snapshot instead." updateRevision: type: string description: "Target revision hash of the current Pool template. Idle pods whose own hash differs are stale and get rolled onto this revision." currentRevision: type: string description: "The single revision hash all pods currently share; equals updateRevision once a rollout converges, empty while pods straddle revisions." updatedReplicas: type: integer format: int32 description: "Number of pods already at updateRevision." autoscaling: $ref: "#/components/schemas/PoolAutoScalingStatus" PoolAutoScalingStatus: type: object description: "Per-Pool autoscaler decision state. Sole writer is the SandboxPool reconciler running the autoscaling decision pipeline." properties: lastScaleUpTime: type: string format: date-time description: "Most recent wall-clock time spec.replicas grew (probe accepted at least one additional replica). Drives the success cooldown gate (scaleUpPolicy.cooldownSeconds)." lastScaleDownTime: type: string format: date-time description: "Most recent wall-clock time spec.replicas shrank. Drives scaleDownPolicy.stabilizationSeconds; the step size comes from scaleUpPolicy.mode." idleZeroSince: type: string format: date-time description: "When the Pool's idle replica count first hit zero in the current continuous-zero window; cleared when idle > 0. Drives the proactive scaleUpPolicy.idleThresholdSeconds trigger." lastScaleUpAttemptTime: type: string format: date-time description: "Most recent wall-clock time the admission probe ran for a scale-up attempt, regardless of outcome. Combined with lastScaleUpAttemptResult and scaleUpPolicy.saturationCooldownSeconds drives the saturation cooldown." lastScaleUpAttemptResult: type: string enum: [Enough, JustRight, Insufficient, Failed] description: "Outcome of the most recent admission probe. Enough = probe accepted the full target; JustRight = partial admission (reserved for finer-grained reporting); Insufficient = cluster has no headroom; Failed = invalid spec or internal probe error." scaleUpErrorMessage: type: string description: "Short single-line description of the most recent non-Enough probe result. Empty when lastScaleUpAttemptResult is Enough." observedGeneration: type: integer format: int64 description: "metadata.generation observed when the autoscaler last wrote this block. Clients use it to confirm status freshness relative to spec." PoolTemplateOverrides: type: object description: "Legacy pool-create overrides. Image-only — per-Pool resource sizing flows through EnvClusterMember.{instanceType,multiplier,inlineResources} now." properties: image: type: string description: "Override the main container (containers[0]) image" additionalProperties: false PoolSizing: type: string enum: [billed, free-form, either] description: | How the member Pools of a template — and therefore of an Env bound to it — must be sized. Reported by the quota provider that governs the deployment, on the template itself and (stamped onto it) on the Env, so that a console, a CLI or any other client reads the answer instead of re-deriving the rule. Three values, not two: "billed" and "free-form" are a deployment with a billing rule deciding per template, while "either" is a deployment with no rule at all — which must keep letting the caller choose, because an InstanceType catalog with no quota backend is a supported way to size Pools. - `billed` — the template's Pools spend quota. A Pool MUST carry the `quota.scitix.ai/url` label AND an `instanceType` (with an optional `multiplier`). It is refused without either: the quota is what the Pool is charged against, and the instance type is the unit it is charged in. This is the shape ordinary users' templates take. - `free-form` — the template is not billed, so a Pool MUST be sized by `inlineResources` alone. `instanceType`, `multiplier` and the quota label are refused with 400, because each one asserts something the server would not honour. Templates reserved for specific callers take this shape. - `either` — this deployment has no billing rule (no quota backend, or one that states no policy), so both shapes are accepted and the caller picks. This is the behaviour of every deployment before the rule existed, and of the open-source build. Read-only. The value mirrors the template's and is maintained by the API server at Env create and by the Env reconciler on every pass; it is never part of a write body. SandboxPool: type: object required: [name, namespace, spec, status] properties: name: type: string description: "Name of the SandboxPool (RFC 1123 DNS label)." namespace: type: string description: "Kubernetes namespace the pool is deployed in." spec: $ref: "#/components/schemas/SandboxPoolSpec" status: $ref: "#/components/schemas/SandboxPoolStatus" cpu: type: string description: 'CPU resource per pod in the pool (Kubernetes resource quantity, e.g. "1", "100m").' memory: type: string description: 'Memory resource per pod in the pool (Kubernetes resource quantity, e.g. "16Gi", "512Mi").' team: type: string description: "Team label of the pool owner (from CRD label)" user: type: string description: "User label of the pool owner (from CRD label)" scalingGroup: type: string description: "Scaling group this pool belongs to (from the agentbox.navix.sh/scaling-group label). Members in the same group share an autoscaling policy. Empty when the pool is excluded from autoscaling." templateVersion: type: string description: "Version of the source SandboxTemplate at last sync (from annotation)" overrides: $ref: "#/components/schemas/PoolTemplateOverrides" specYaml: type: string description: "Full EmbeddedSandboxTemplate (idleImage, runtimes, reservation, template) serialized as YAML for diff comparison." createdAt: type: string format: date-time description: "Creation time of the pool (from metadata.creationTimestamp)" owningEnv: type: string description: "Name of the SandboxEnv that owns this pool (resolved from OwnerReferences). Every pool is derived from an Env; empty only for a pool with no owning Env." example: name: "poolname" namespace: "t-team-user" cpu: "1" memory: "16Gi" team: "team" user: "user" spec: replicas: 2 status: phase: "Ready" idleReplicas: 1 unavailableIdleReplicas: 0 runningReplicas: 1 startingReplicas: 0 stoppingReplicas: 0 failedReplicas: 0 SandboxPoolEnvelope: type: object required: [template] properties: template: $ref: "#/components/schemas/SandboxPool" editable: $ref: "#/components/schemas/UpsertSandboxPoolRequest" description: | The body a write to this member Pool takes, read off the live member. Same schema as the PUT; see `SandboxEnvEnvelope.editable`. SandboxPoolSummary: type: object description: "Lightweight shape returned by the pool List endpoint: the full SandboxPool minus the heavy specYaml (full pod-template YAML) and overrides, neither of which list consumers read. Fetch GET /envs/{name}/sandboxpools/{poolName} for the full body (incl. specYaml for the diff view)." required: [name, namespace, spec, status] properties: name: type: string description: "Name of the SandboxPool (RFC 1123 DNS label)." namespace: type: string description: "Kubernetes namespace the pool is deployed in." spec: $ref: "#/components/schemas/SandboxPoolSpec" status: $ref: "#/components/schemas/SandboxPoolStatus" cpu: type: string description: 'CPU resource per pod in the pool (Kubernetes resource quantity, e.g. "1", "100m").' memory: type: string description: 'Memory resource per pod in the pool (Kubernetes resource quantity, e.g. "16Gi", "512Mi").' team: type: string description: "Team label of the pool owner (from CRD label)." user: type: string description: "User label of the pool owner (from CRD label)." scalingGroup: type: string description: "Scaling group this pool belongs to. Members in the same group share an autoscaling policy. Empty when excluded from autoscaling." templateVersion: type: string description: "Version of the source SandboxTemplate at last sync (from annotation)." createdAt: type: string format: date-time description: "Creation time of the pool (from metadata.creationTimestamp)." owningEnv: type: string description: "Name of the SandboxEnv that owns this pool (resolved from OwnerReferences)." CreateEnvSandboxPoolRequest: allOf: - $ref: "#/components/schemas/UpsertSandboxPoolRequest" description: | Add a member SandboxPool to an Env. The Pool's name and scalingGroup are derived from the effective resources — see `UpsertSandboxPoolRequest`, which is the same body this takes. UpsertSandboxPoolRequest: type: object additionalProperties: false description: | Add a member SandboxPool to an Env. The server derives: - `name` = "{envName}-{resourceKey}[-{quotaShort}]" - `scalingGroup` = `resourceKey` (e.g. "2c8Gi") where `resourceKey` is `instancetype.DeriveResourceKey(effective resources)` and `quotaShort` (when a quota label is supplied) is `quotaProvider.DeriveShortName(quotaID)`. Members in the same `scalingGroup` share an autoscaling policy. WHICH OF THE SHAPES BELOW IS ACCEPTED IS THE ENV'S TO SAY, not the caller's — read `poolSizing` off the Env this Pool joins (Template detail and Env detail both carry it; `abx envs ` prints it). Billed Env (`poolSizing: billed`) — the Template is billed, so the Pool must name what it spends: - `instanceType` (+ optional `multiplier`) alone → the Pod is sized to the full `instanceType × multiplier` envelope (default `multiplier` = 1). - `instanceType` (+ `multiplier`) AND `inlineResources` together → `instanceType × multiplier` is the reservation/billing envelope, while `inlineResources` is the actual (possibly rounded-down) Pod request. Every dimension of `inlineResources` must be ≤ the envelope (round down allowed, round up rejected with 400); the reservation still charges quota for the whole instance. - `labels` must carry `quota.scitix.ai/url`. Free-form Env (`poolSizing: free-form`) — the Template is one the deployment does not bill, so the Pool is sized directly: - `inlineResources` alone → explicit per-Pool resource requests/limits. - `instanceType`, `multiplier` and the quota label are REJECTED (400): an instance type buys an instance nobody reserved, and a quota label on a Pool that is never submitted for reservation is a claim the server cannot honour. Unmanaged Env (`poolSizing: either`) — this deployment states no rule, so both shapes are accepted and the caller picks. Every deployment behaved this way before the rule existed. Under the two managed values there is no per-Pool choice: the shape follows from the Env, so two Pools of one Env are always sized the same way. `scalingGroup` / pool name are derived from the effective Pod request (the rounded-down `inlineResources` when supplied, else the full envelope), so the name reflects the Pod's real size and Pools downsized differently land in distinct scaling groups. This is also what an update takes, and what `GET` returns as `editable`: one body for create, update and export, so a client edits what the API handed it rather than translating between two subsets that drift. The fields marked `x-immutable` describe the Pool's SHAPE and are fixed at create. An update must carry them back unchanged — omitting one or changing one is a 400 that names the value in force, because a body that loses the instance type is a caller bug, not a request for a smaller machine. example: instanceType: sci.c23-2 multiplier: 1 replicas: 1 minReplicas: 0 maxReplicas: 4 inlineResources: requests: cpu: 100m memory: 500Mi limits: cpu: 100m memory: 500Mi labels: quota.scitix.ai/url: https://quota.example/q/1 properties: instanceType: type: string x-immutable: true x-immutable-lever: "add a member in the size you want, then remove this one" description: "InstanceType catalog entry. Required when the Pool's Env is billed (env.poolSizing=billed); rejected when its Env is free-form (env.poolSizing=free-form); the caller's choice when the Env is unmanaged (env.poolSizing=either). May be combined with inlineResources to reserve a whole instance while running a smaller (rounded-down) Pod." multiplier: type: integer format: int32 minimum: 1 x-immutable: true x-immutable-lever: "add a member with the multiplier you want, then remove this one" description: "Multiplier applied to the InstanceType base resources to form the reservation envelope. Defaults to 1." inlineResources: # `allOf` rather than a bare `$ref`, and not for style: OpenAPI 3.0 # drops every key sitting beside a `$ref`, so `x-immutable` written # directly under one is invisible to anything that reads the document # through an OpenAPI parser — which is every consumer that matters. # The field was silently NOT fixed as far as Swagger, the generated # SDKs and the console's rule table were concerned, while the service # refused a change to it. `TestMemberFixedFieldsMatchTheSpec` is what # caught it. allOf: - $ref: "#/components/schemas/ResourceRequirements" x-immutable: true x-immutable-lever: "add a member with the resources you want, then remove this one" description: "Explicit per-Pool resource requests/limits. Required — and used alone — when the Pool's Env is free-form (env.poolSizing=free-form), where it is the whole of the Pod's sizing; on a billed Env it is optional and instead combined with instanceType as the rounded-down actual Pod request (must fit within instanceType × multiplier). Sets both requests and limits." replicas: type: integer format: int32 minimum: 0 description: "Initial replica count. Autoscaling, once enabled on this scalingGroup, owns subsequent changes." minReplicas: type: integer format: int32 minimum: 0 description: "Lower bound on this pool's replicas, enforced as a per-member scale-down floor by the Env autoscaler." maxReplicas: type: integer format: int32 description: "Upper bound on this pool's replicas, enforced when the Env autoscaler distributes scale-up delta." labels: allOf: - $ref: "#/components/schemas/StringMap" x-immutable: true x-immutable-lever: "add a member with the labels you want, then remove this one" description: "Labels stamped onto this member's SandboxPool. Use for plugin-driven metadata such as quota.scitix.ai/url (parsed by the server to derive the pool-name suffix). Required when the Pool's Env is billed (env.poolSizing=billed) — the Pool is rejected without it, because the scheduler it is submitted to has nothing to charge; rejected when the Env is free-form." annotations: allOf: - $ref: "#/components/schemas/StringMap" x-immutable: true x-immutable-lever: "add a member with the annotations you want, then remove this one" description: "Annotations stamped onto this member's SandboxPool." updateStrategy: $ref: "#/components/schemas/EnvUpdateStrategy" description: "Per-member rollout policy override. Unset inherits the Env overrides.updateStrategy, then autoUpdate=true / maxUnavailable=20%." UpdateEnvSandboxPoolRequest: allOf: - $ref: "#/components/schemas/UpsertSandboxPoolRequest" description: | Desired state of this member's editable bounds. This is a PUT and it means it: a field left out is one the caller wants REMOVED. That is the only way "take the ceiling off" can be expressed — while an omitted field meant "leave unchanged" there was no request that could clear minReplicas, maxReplicas or updateStrategy, and the form's empty box reported success without doing anything. `replicas` is the exception: it is the pool's size rather than a bound, an autoscaling group may own it outright, and omitting it leaves the pool the size it is — never scales it to zero. Update a member SandboxPool. The body is the one create takes and the one `GET` returns as `editable`; resource shape, instanceType, labels and annotations are fixed at create and must be echoed back unchanged (see `UpsertSandboxPoolRequest` for what each field means). When the scalingGroup has autoscaling enabled (via env.spec.autoscaling.enabled + a matching group entry), only `maxReplicas` is accepted — `replicas` is owned by the autoscaler. ImagePullSecretInput: type: object required: [registries] properties: registries: type: array minItems: 1 items: $ref: "#/components/schemas/RegistryCredential" RegistryCredential: type: object required: [registry, username, password] properties: registry: type: string description: "Registry host or URL (e.g. 'https://index.docker.io/v1/', 'ghcr.io', 'quay.io')." username: type: string password: type: string format: password DeleteSandboxPoolResult: type: object required: [name, namespace, status] properties: name: type: string namespace: type: string status: type: string ListSandboxPoolsResult: type: object required: [items, total, limit, offset] properties: items: type: array description: "Page of SandboxPool summaries." items: $ref: "#/components/schemas/SandboxPoolSummary" total: type: integer description: "Total number of pools matching the query (before pagination)." limit: type: integer description: "Maximum number of items requested per page." offset: type: integer description: "Number of items skipped before this page." EnvEvent: type: object required: [involvedKind, involvedName, reason, message, type, count] properties: involvedKind: type: string description: "Kind of the K8s object this event was emitted against. One of SandboxEnv | SandboxPool." involvedName: type: string description: "metadata.name of the involved object." reason: type: string description: "Event reason (machine-readable verb): ScaleUp / ScaleDown / PoolReady / PoolRecovered / Degraded / AutoscalerScaleUp / AutoscalerScaleDownStarted / AutoscalerScaleDownCompleted / AutoscalerScaleDownStuck / SandboxPoolPhase*." action: type: string description: "Event action (machine-readable). Sometimes absent on older events." message: type: string description: "Human-readable message body." type: type: string description: "Normal | Warning" count: type: integer description: "Number of times this event has fired. K8s coalesces repeated identical events and bumps this counter." firstTimestamp: type: string format: date-time description: "First time this event was observed (RFC3339)." lastTimestamp: type: string format: date-time description: "Most recent time this event was observed (RFC3339)." ListEnvEventsResult: type: object required: [items, total] properties: items: type: array description: "Events scoped to this Env and its member Pools, sorted descending by lastTimestamp." items: $ref: "#/components/schemas/EnvEvent" total: type: integer description: "Total number of events returned." # ========================================================= # SandboxEnv # # Env is the user-facing "sandbox environment" abstraction that binds one # SandboxTemplate runtime to one or more member SandboxPools. Autoscaling # configuration lives here (lifted from Pool in the Phase 1 rollout) so a # single Env can manage replicas across multiple Pools (same resource # shape, different scheduling classes — e.g. ondemand + spot). # ========================================================= PoolScaleUpPolicy: type: object description: "Scale-up behaviour for a scaling group (mode + cooldown + idle threshold + saturation cooldown)." properties: mode: type: string enum: [Conservative, Default, Aggressive] description: "How much warm headroom to keep, and how large a bite each scale-down takes. Sizing is relative to demand (claimed Pods + waiting claims), never to the pool's own replica count; waiting claims are always covered in full regardless of mode. Conservative=1 spare Pod, ceiling demand+1, scale-down -1; Default=ceil(demand/4) spare, ceiling 1.5x demand, scale-down -ceil(replicas/4); Aggressive=ceil(demand/2) spare, ceiling 2x demand, scale-down -ceil(replicas/2)." cooldownSeconds: type: integer format: int32 minimum: 0 description: "Minimum seconds between two consecutive scale-up events (group-level)." idleThresholdSeconds: type: integer format: int32 minimum: 0 description: "Aggregate idleReplicas=0 must persist for this long before the proactive trigger fires. Zero disables proactive scale-up." idleZeroQuietWindowSeconds: type: integer format: int32 minimum: 0 description: "Suppresses the proactive idleZero trigger when no Sandbox.Create has been observed for the Pool within this many seconds. Reactive scale-ups (queue length > 0 with no idle Pod) ignore this window. Set to 0 to disable the gate. Default 300." saturationCooldownSeconds: type: integer format: int32 minimum: 0 description: "How long a member stays marked saturated after a probe returned InsufficientResources / InvalidSpec. Default 60s." PoolScaleDownPolicy: type: object description: "Scale-down timing for a scaling group. How many replicas each event removes comes from scaleUpPolicy.mode — scale-down mirrors the scale-up mode so a pool sheds capacity on the same scale it acquired it." properties: idleTimeoutSeconds: type: integer format: int32 minimum: 0 description: "Minimum seconds a pod must remain Idle before it becomes a scale-down candidate. Also bounds the step: a scale-down never removes more pods than have aged past this." stabilizationSeconds: type: integer format: int32 minimum: 0 description: "Minimum seconds between two consecutive scale-down events." protectionWindowSeconds: type: integer format: int32 minimum: 0 description: "Seconds during which a scale-down-marked pod can still be claimed (cancels deletion)." SandboxEnvTemplateRef: type: object required: [name] properties: name: type: string description: "Name of the cluster-scoped SandboxTemplate the Env binds to." version: type: string description: "Optional Template version pin. When empty, the Env tracks the Template's current spec.version." SandboxEnvDefaults: type: object properties: instanceType: type: string description: "Default InstanceType used when Sandbox.create does not specify one. References an entry in the InstanceType catalog." multiplier: type: integer format: int32 minimum: 1 description: "Default multiplier applied to the InstanceType base resources." EnvClusterMember: type: object required: [name] description: | One SandboxPool participating in an Env. Identity is `name`; everything the caller can declare (sizing, scaling-group, routing priorities, user-supplied labels/annotations) lives under `config`. The materialised Pool's metadata + spec are server-internal state (captured after plugin admission ran) and are NOT exposed here — query the SandboxPool CR directly via `GET /v1/sandboxenvs/{name}/sandboxpools/{poolName}` to inspect the rendered Pool. properties: name: type: string description: "SandboxPool's metadata.name within the Env's namespace. Acts as the member identity within the Env." config: $ref: "#/components/schemas/EnvClusterMemberConfig" EnvClusterMemberConfig: type: object description: | User-declared intent for one Env member. Plugins do not mutate this — it stays equal to whatever the caller supplied at AddMember / UpdateMember time, so it remains a faithful description of the request shape across the member's lifetime. properties: labels: type: object additionalProperties: type: string description: "User-supplied SandboxPool metadata.labels (e.g. quota.scitix.ai/url). Plugins may consume these for routing decisions; their output lands on the server-internal member.metadata, not here." annotations: type: object additionalProperties: type: string description: "User-supplied SandboxPool metadata.annotations. Same propagation as labels." instanceType: type: string description: "Optional InstanceType catalog entry referenced by this member." multiplier: type: integer format: int32 description: "Multiplier applied to the InstanceType base resources for this member." inlineResources: $ref: "#/components/schemas/ResourceRequirements" description: "Per-Pool resource sizing. When set, replaces containers[0].resources of the rendered Template. Use this (or InstanceType + Multiplier) to express resource regions across members. Kept around for Template-upgrade resource alignment via a future RefreshMember API." scalingGroup: type: string description: "ScalingGroup name (typically derived from the effective resources, e.g. '1c4Gi'). Members in the same group share autoscaling policy." minReplicas: type: integer format: int32 description: "Lower bound on this member's spec.replicas. Enforced by the Env autoscaler as a per-member scale-down floor." maxReplicas: type: integer format: int32 description: "Upper bound on this member's spec.replicas. Enforced by the Env autoscaler when distributing scale-up delta." priority: type: integer format: int32 description: "Canonical preference: lower wins. Used for routing tiebreaks and as the default for scaleUpPriority / scaleDownPriority when those are unset." scaleUpPriority: type: integer format: int32 description: "Scale-up order within the scaling group — lower scaled first. When omitted, falls back to priority. Same-value tiebreak by name." scaleDownPriority: type: integer format: int32 description: "Scale-down order within the scaling group — lower shrunk first. When omitted, falls back to priority." updateStrategy: $ref: "#/components/schemas/EnvUpdateStrategy" description: "Per-member override of the Env-wide overrides.updateStrategy. Unset fields inherit from the Env default, then autoUpdate=true / maxUnavailable=20%." EnvUpdateStrategy: type: object description: "Automatic rollout policy for member Pools when their rendered idle-Pod identity (Template edit, image / gateway override) changes. Rollout mode is always Recreate: stale idle Pods are rebuilt; claimed (Running/Starting) Pods are never disrupted and roll after returning to Idle." properties: autoUpdate: type: boolean description: "Whether the member auto-rolls when its revision changes. Resolution order: member → env → default true. Set false to freeze a member on its current revision." maxUnavailable: type: string description: "Rollout unavailability budget as an absolute count (\"3\") or a percentage of desired idle replicas (\"20%\"). Rounded down, floored at 1. Resolution order: member → env → default \"20%\"." ResourceRequirements: type: object description: "Subset of Kubernetes corev1.ResourceRequirements used for per-Pool resource sizing on EnvClusterMember.inlineResources." properties: requests: type: object description: "Resource requests keyed by resource name (e.g. cpu, memory). Values use Kubernetes Quantity strings, e.g. '500m', '1Gi'." additionalProperties: type: string limits: type: object description: "Resource limits keyed by resource name." additionalProperties: type: string EnvOverrides: type: object description: "SandboxTemplate fields this Env replaces uniformly for every member Pool. The Env represents a single class of sandbox runtime, so image, image policy, default timeouts and image-pull credentials are expected to be shared; per-Pool variation lives on each EnvClusterMember." properties: image: type: string description: "Override the main container (containers[0]) image of the rendered Template. Applied before any per-Member overrides." podCreationImagePolicy: type: string enum: [PoolDefaultImage, IdleImage] description: "Mirrored onto every member Pool's spec.podCreationImagePolicy." defaultStartupTimeout: type: string description: "Mirrored onto every member Pool's spec.defaultStartupTimeout. Duration string, e.g. '5m'." defaultIdleTimeout: type: string description: "Mirrored onto every member Pool's spec.defaultIdleTimeout. Duration string, e.g. '30m'." imagePullSecret: $ref: "#/components/schemas/ImagePullSecretInput" description: | Write-only image-pull credentials. On create / update the server materialises a dockerconfigjson Secret named `ips-{envName}` in the Env's namespace with an OwnerReference back to the Env (cascade-deleted by Kubernetes GC). At render time the Env Reconciler appends that Secret's reference to every member Pool's spec.template.spec.imagePullSecrets so the kubelet can pull private images uniformly across the Env. Not returned on GET — check imagePullSecretConfigured for read-state. imagePullSecretConfigured: type: boolean description: | Server-set on GET: true when the `ips-{envName}` Secret exists in the Env's namespace. On PUT it is the KEEP signal, and the only way to say it. The request is desired state, and the credentials cannot be read back to be echoed — so a PUT carrying neither `imagePullSecret` nor this flag is asking for the Secret to be DELETED. Sending back what GET returned therefore preserves the stored material, exactly as it does for every other field; a client that strips this flag while editing an unrelated setting revokes the registry credentials as a side effect. `imagePullSecret` present wins: new credentials replace the old ones whatever this says. gateway: $ref: "#/components/schemas/GatewaySpec" description: | Egress gateway for every member Pool's sandbox Pods. Enabling it injects a transparent proxy sidecar, which is what makes per-sandbox egress filtering (network.allowOut / denyOut) and credential injection (network.rules with Secret.fill) possible on the create call. It carries no rules of its own: what a sandbox may reach, and what gets injected into which request, belong to that one sandbox and arrive with it. Changing this switch changes the Pod spec and therefore rolls the Env's pools. envd: $ref: "#/components/schemas/EnvdSpec" description: | Tunes the sandbox agent (envd) every member Pool's Pods run. These are process flags fixed when a Pod starts, so changing them re-renders the pod template and rolls the Env's idle pools — the same way an image or gateway change does. updateStrategy: $ref: "#/components/schemas/EnvUpdateStrategy" description: "Env-wide default rollout policy for member Pools when their idle-Pod identity changes. Overridable per member via EnvClusterMemberConfig.updateStrategy." volumes: type: array maxItems: 8 description: | Mount existing PersistentVolumeClaims from this Env's namespace into the sandbox container. The claim must already exist and be Bound; the server never creates or deletes a PVC. Discover mountable claims with GET /volumes. Mounts are fixed at Pod creation — Kubernetes forbids mutating spec.volumes on a live Pod — so editing this list rolls the member Pools' idle Pods. Sandboxes already running keep their previous mounts until they are returned. In-place image upgrades never touch volumes. items: $ref: "#/components/schemas/EnvVolumeMount" additionalProperties: false EnvVolumeMount: type: object description: "One PersistentVolumeClaim, or one subtree of it, mounted into the sandbox container." required: [claimName, mountPath] properties: claimName: type: string description: "Name of an existing, Bound PersistentVolumeClaim in this Env's namespace. Cross-namespace mounts are not possible in Kubernetes, which is the authorisation boundary: a caller only ever reaches claims in the namespace their identity resolved to." mountPath: type: string description: "Absolute path inside the sandbox container. Must not be '/' or '/mnt', must not sit inside a reserved path (/proc, /sys, /dev, /etc, /var/run, /var/lib/kubelet), and must not collide with or nest against a path the Template already mounts." subPath: type: string description: "Mount a subtree of the volume instead of its root. Relative, no '..' segments. Recommended when the backing PersistentVolume is exposed at its filesystem root. Note kubelet creates a missing subPath directory, so a mistyped value mounts an empty directory rather than failing." # NOTE: a property *named* readOnly, not the JSON-Schema `readOnly` # keyword (which is used on imagePullSecretConfigured above to mean # response-only). Do not lift this to the schema level. readOnly: type: boolean default: true description: "Defaults to true. Enforced on the Kubernetes volume source rather than the mount, so no container can request read-write for the same claim. Set false only when the agent must write: sandbox code runs as root with passwordless sudo and can delete anything writable. Read-only is a container-runtime bind flag — a Template whose pod spec can reach the host mount namespace (privileged, SYS_ADMIN, Bidirectional propagation, hostPath) cannot enforce it, and such a combination is rejected unless an administrator has opted the Template out." additionalProperties: false EnvdSpec: type: object description: | Settings for the sandbox agent (envd) that serves the E2B API inside every sandbox Pod. properties: verbose: type: boolean description: | Write one structured line per API call envd serves to the container's stdout — for a command, the command itself, its arguments, working directory and environment. It is how a deployment gets a record of what agents actually ran inside a sandbox, since a command's output otherwise only travels back to its caller. Defaults to on; a GET always reports the value in force. Two costs. A PTY session sends one API call per keystroke and each is logged with its whole request, so an interactive terminal produces a lot of lines and pays a serialization cost on a hot path. And environment variable VALUES appear in the log — anything secret belongs in a Secret the sandbox reads, or in the egress credential injection path, not in a plain environment variable. additionalProperties: false GatewaySpec: type: object description: | Egress gateway switch. Enabling it adds a transparent proxy sidecar and an iptables redirect to every sandbox Pod of the environment; the rules it enforces are supplied per sandbox on the create call. properties: enabled: type: boolean description: "Inject the egress proxy sidecar. A create request carrying network rules against an environment without it is refused rather than silently unenforced." additionalProperties: false EnvClusterSpec: type: object required: [clusterID] properties: clusterID: type: string description: "Cluster identifier that owns this segment. Each Worker only mutates the segment matching its own clusterID." members: type: array description: "Member Pools in this cluster. MVP allows multiple members per cluster but a single ScalingGroup." items: $ref: "#/components/schemas/EnvClusterMember" EnvAutoscalingGroup: type: object required: [name] properties: name: type: string description: "ScalingGroup identifier this policy applies to. Matches the EnvClusterMember.scalingGroup of at least one member declared on the env — the group is created automatically when a member with this ScalingGroup is added, and garbage-collected by the Env reconciler once no member references it." enabled: type: boolean description: "Per-group master switch. When false, this group's members keep manual Pool replicas; the autoscaler skips it. Each group is independent — other groups continue to run if Enabled=true." minReplicas: type: integer format: int32 minimum: 0 description: "Lower bound on the group's aggregate desired replicas." maxReplicas: type: integer format: int32 description: "Upper bound on the group's aggregate desired replicas." scaleUpPolicy: $ref: "#/components/schemas/PoolScaleUpPolicy" scaleDownPolicy: $ref: "#/components/schemas/PoolScaleDownPolicy" EnvAutoscalingSpec: type: object description: "Env-level autoscaler config. The master switch lives per-group on EnvAutoscalingGroup.enabled so groups can be toggled independently." properties: groups: type: array description: "Per-scaling-group policies. The autoscaler iterates Groups in order and operates on the first Enabled=true entry; future multi-group routing will use member.ScalingGroup to dispatch." items: $ref: "#/components/schemas/EnvAutoscalingGroup" SandboxEnvSpec: type: object required: [templateRef, mode] properties: templateRef: $ref: "#/components/schemas/SandboxEnvTemplateRef" mode: type: string enum: [WarmPool, OnDemandJob] description: "Routing mode — WarmPool dispatches to pre-warmed member Pools; OnDemandJob (Phase 3) creates a SandboxJob per request." defaults: $ref: "#/components/schemas/SandboxEnvDefaults" clusters: type: array items: $ref: "#/components/schemas/EnvClusterSpec" autoscaling: $ref: "#/components/schemas/EnvAutoscalingSpec" overrides: $ref: "#/components/schemas/EnvOverrides" EnvObservedMember: type: object required: [name] properties: name: type: string instanceType: type: string multiplier: type: integer format: int32 state: type: string enum: [Active, Saturated, Missing, Inconsistent] idleCount: type: integer format: int32 runningCount: type: integer format: int32 desiredReplicas: type: integer format: int32 currentReplicas: type: integer format: int32 pendingRequests: type: integer format: int32 description: "Mirror of SandboxPool.status.pendingRequests for this member — throttled at the source so visible value lags actual queue depth by up to ~3s." saturatedUntil: type: string format: date-time description: "Read-only mirror of SandboxPool.status.autoscaling.saturatedUntil. Until this time, the router deprioritises the member because the per-Pool autoscaler reported the cluster cannot fit additional replicas." scalingGroup: type: string description: "Autoscaling group this member belongs to on its owning cluster, echoed from spec. Empty when the member is in no group. Present on foreign (cross-cluster) members too, so a viewer without the foreign cluster's spec can still attribute the member to a group and link to that cluster's group detail." autoscalingEnabled: type: boolean description: "Whether this member's scalingGroup has the autoscaler on in its owning cluster. Each cluster scales independently, so a same-named group may be enabled in one cluster and off in another; this is the per-pool, per-cluster truth. Disambiguates scaleUpHeadroom == 0 (at ceiling) from autoscaling being off." scaleUpHeadroom: type: integer format: int32 description: "Estimated replicas this member can still add on its owning cluster before hitting the smaller of its own MaxReplicas and its group's aggregate MaxReplicas. Meaningful only when autoscalingEnabled: omitted = off, or on with no finite ceiling (unbounded); 0 = at ceiling; >0 = room left. Advisory estimate — the group ceiling is shared across members and quota is not folded in; for foreign members it also lags by the federation TTL." updateRevision: type: string description: "Mirror of the member Pool's status.updateRevision — the target revision the Pool is rolling towards." updatedReplicas: type: integer format: int32 description: "Mirror of the member Pool's status.updatedReplicas. A rollout is in progress while this is below the member's replica count." templateVersion: type: string description: "SandboxTemplate spec.version the member Pool was last rendered from, read off its provenance annotation. An observation of what the member actually carries, not a constraint — members follow the Template's current body, and spec.templateRef.version pins nothing. Empty for foreign (cross-cluster) members." EnvClusterStatus: type: object required: [clusterID] properties: clusterID: type: string isLocal: type: boolean description: "True on the Worker that owns this segment. Other segments arrive via Hub Sync (future)." observedMembers: type: array items: $ref: "#/components/schemas/EnvObservedMember" lastSnapshotTime: type: string format: date-time EnvScalingGroupStatus: type: object required: [name] properties: name: type: string totalIdle: type: integer format: int32 totalRunning: type: integer format: int32 totalDesired: type: integer format: int32 EnvCondition: type: object required: [type, status] properties: type: type: string status: type: string reason: type: string message: type: string lastTransitionTime: type: string format: date-time SandboxEnvStatus: type: object properties: conditions: type: array items: $ref: "#/components/schemas/EnvCondition" clusters: type: array items: $ref: "#/components/schemas/EnvClusterStatus" scalingGroups: type: array items: $ref: "#/components/schemas/EnvScalingGroupStatus" memberCount: type: integer format: int32 description: "Total member Pools across all cluster segments (today: the local segment only). Exists because printer columns cannot evaluate the nested clusters[].members[] array." desiredReplicas: type: integer format: int32 description: "Env-wide sum of every member Pool's desired replicas." runningReplicas: type: integer format: int32 description: "Env-wide sum of every member Pool's running replicas." idleReplicas: type: integer format: int32 description: "Env-wide sum of every member Pool's idle replicas." SandboxEnv: type: object required: [name, namespace, spec] properties: name: type: string namespace: type: string labels: type: object additionalProperties: type: string spec: $ref: "#/components/schemas/SandboxEnvSpec" status: $ref: "#/components/schemas/SandboxEnvStatus" team: type: string user: type: string createdAt: type: string format: date-time envDocs: type: string description: | Rendered Markdown documentation for this Env, sourced from the linked SandboxTemplate's agentbox.navix.sh/docs annotation. These placeholders are substituted server-side: * `${AGBX_ENV_NAME}` — this env's name. * `${AGBX_POOL_NAME}` — the first member Pool that exists in the local cluster, or `-pool-name` when the env has none yet. * `${AGBX_CLUSTER_ID}` — the local cluster ID. * `${AGBX_NATIVE_URL}`, `${AGBX_E2B_URL}`, `${AGBX_DATA_URL}` — the local cluster's gateway URLs from the cluster config. * `${AGBX_DATA_DOMAIN}` — the data URL without its scheme (what the E2B SDK's `E2B_DOMAIN` expects). * `${AGBX_HOST}` — the gateway hostname; `${AGBX_INNER_IP}` — the in-cluster IP that host is pinned to by hostAliases, for clients already inside the cluster. * `${AGBX_HTTPS}` — "true"/"false" for the data URL's scheme. * `${AGBX_REGISTRY_HOST}` — the local cluster's first configured image registry. `${AGBX_API_KEY}` is the exception: it is never substituted, so the response carries no credential and can be cached, logged, echoed or relayed. A client that holds one of the caller's keys — the console — replaces it before showing the snippet. A placeholder whose value this deployment does not know (no gateway configured, no host alias, no registry) is left in the output verbatim rather than rendered empty. poolSizing: allOf: - $ref: "#/components/schemas/PoolSizing" description: >- How this Env's member Pools must be sized, derived from the bound template's own poolSizing and carried on the Env (the agentbox.navix.sh/pool-sizing label) by the API server on create and by the Env reconciler on every pass. A template that gains or loses its billing annotations therefore re-stamps the Envs that reference it within a reconcile. Omitted when the Env has not been stamped yet, which clients must read as "either" — the behaviour that predates this field. See PoolSizing for what each value asks of a Pool write. SandboxEnvEnvelope: type: object required: [env] properties: env: $ref: "#/components/schemas/SandboxEnv" editable: $ref: "#/components/schemas/UpsertSandboxEnvRequest" description: | The body a write to this Env takes, read off the live object — the same schema as `UpdateSandboxEnvRequest`, so what this returns can be edited and sent straight back with apply/PUT. It exists because the alternative, reusing the read shape as a write body, silently clears every field the caller did not copy over. SandboxEnvSummary: type: object description: "Lightweight summary returned by the List endpoint — omits the full spec (autoscaling policies, per-member config) and detailed per-member status. Fetch GET /envs/{name} for the complete SandboxEnv." required: [name] properties: name: type: string description: "Name of the SandboxEnv (RFC 1123 DNS label, unique within its namespace)." namespace: type: string team: type: string user: type: string createdAt: type: string format: date-time description: "RFC 3339 timestamp when the Env was created." templateName: type: string description: "The bound SandboxTemplate name (from spec.templateRef.name)." mode: type: string enum: [WarmPool, OnDemandJob] description: "How the Env satisfies sandbox-create requests." memberCount: type: integer format: int32 description: "Total member Pools across all cluster segments." desiredReplicas: type: integer format: int32 description: "Env-wide sum of every member Pool's desired replicas." runningReplicas: type: integer format: int32 description: "Env-wide sum of every member Pool's running replicas." idleReplicas: type: integer format: int32 description: "Env-wide sum of every member Pool's idle replicas." scalingGroupCount: type: integer format: int32 description: "Total number of autoscaling groups declared on the Env." autoscalingEnabledGroupCount: type: integer format: int32 description: "Number of autoscaling groups with enabled=true. There is no Env-level autoscaling switch; autoscaling is toggled per group." ready: type: boolean description: "True when the Env's Ready condition is True (all members Active)." poolSizing: $ref: "#/components/schemas/PoolSizing" ListSandboxEnvsResult: type: object required: [items] properties: items: type: array items: $ref: "#/components/schemas/SandboxEnvSummary" UpdateSandboxEnvRequest: allOf: - $ref: "#/components/schemas/UpsertSandboxEnvRequest" # The same shape as create (minus `name`, which is the path), on purpose: # the body this takes is the body `GET /envs/{name}` returns as `editable`, # so export → edit → apply round-trips with nothing to translate. description: | Desired state of the Env. Members are managed through `/envs/{name}/sandboxpools/*` and autoscaling through `/envs/{name}/autoscaling/*`. This is a PUT and it means it: `overrides` is REPLACED WHOLESALE, so a field left out is one the caller wants removed. Sending `overrides: {}` clears every override. Write-only credential values need not be echoed: their references round-trip through GET, so re-sending what GET returned preserves the stored material. The fields marked `x-immutable` in `UpsertSandboxEnvRequest` are the one exception, and in the other direction: an update must carry them back UNCHANGED. Omitting one, or sending a different value, is a 400 that names what is currently in force — a body that loses the template is almost always a caller bug, and accepting it silently would hide it. A request carrying no `imagePullSecret` DELETES the backing Secret, not just the reference to it. Previously there was no call that could, so a registry password the user had cleared in the console went on existing in the cluster while the form reported success. It was a PATCH while the request carried a single wholesale-replaced object, which meant the verb promised merge semantics the body never had. One verb per meaning: every editable object on this API is a PUT of its desired state. UpdateEnvAutoscalingGroupRequest: type: object description: | Desired state of one autoscaling group. This is a PUT and it means it: a field left out is one the caller wants REMOVED. That is the only way "take the ceiling off" can be expressed — while an omitted field meant "leave unchanged" there was no request that could clear minReplicas, maxReplicas or a policy, and the form's empty box reported success without doing anything. properties: enabled: type: boolean description: "Whether the autoscaler acts on this group." minReplicas: type: integer format: int32 minimum: 0 maxReplicas: type: integer format: int32 scaleUpPolicy: $ref: "#/components/schemas/PoolScaleUpPolicy" scaleDownPolicy: $ref: "#/components/schemas/PoolScaleDownPolicy" EnvAutoscalingSpecEnvelope: type: object required: [spec] properties: spec: $ref: "#/components/schemas/EnvAutoscalingSpec" EnvAutoscalingGroupEnvelope: type: object required: [group] properties: group: $ref: "#/components/schemas/EnvAutoscalingGroup" editable: $ref: "#/components/schemas/UpdateEnvAutoscalingGroupRequest" description: | The body a write to this group takes, read off the live group. ListEnvAutoscalingGroupsResult: type: object required: [items, total] properties: items: type: array items: $ref: "#/components/schemas/EnvAutoscalingGroup" total: type: integer DeleteEnvAutoscalingGroupResult: type: object required: [name, status] properties: name: type: string status: type: string description: "'Deleted' on success." SandboxEnvName: type: string minLength: 1 maxLength: 24 pattern: "^[a-z]([a-z0-9-]*[a-z0-9])?$" description: >- The Env this file is about. `create` requires it; `update` takes the name from the address and refuses a file whose `name` says something else. It is part of the write body so that the file a create wrote is the file an update takes — one shape, sent to one address. RFC 1123 DNS label, capped at 24 chars so derived names (PoolName = EnvName + ResourceKey + QuotaShort, PodName = PoolName + UUID) stay under the 63-char label/DNS limit. UpsertSandboxEnvRequest: type: object required: [templateRef] additionalProperties: false description: | What a client may set on an Env — the SAME body for create and update, and the body `GET /envs/{name}` returns as `editable`. One shape rather than two subsets, because two subsets drift: while create accepted `mode` and update did not, a person editing an Env had no way to send back what the API had just handed them, and the file a client exported from a read was not a file a write accepted. Fields marked `x-immutable` are fixed at create. An update must carry them UNCHANGED: leaving one out, or sending a different value, is a 400 that names the value in force rather than a silent ignore — a body that drops the template is far more likely to be a bug in the caller than a request to have no template. properties: name: $ref: "#/components/schemas/SandboxEnvName" templateRef: allOf: - $ref: "#/components/schemas/SandboxEnvTemplateRef" x-immutable: true x-immutable-lever: "create a new Env from the other template and move the traffic over" description: >- Which SandboxTemplate every member Pool is rendered from. Pin a version to hold the Env still across Template edits; omit it to follow the Template. Fixed after create. mode: type: string enum: [WarmPool, OnDemandJob] default: WarmPool x-immutable: true x-immutable-lever: "create a new Env in the other mode" description: >- WarmPool keeps idle Pods ready to claim. OnDemandJob creates a Pod per sandbox and tears it down after, trading start latency for holding no capacity between runs. Fixed after create. overrides: $ref: "#/components/schemas/EnvOverrides" labels: allOf: - $ref: "#/components/schemas/StringMap" x-immutable: true x-immutable-lever: "create a new Env with the labels you want" description: "Metadata stamped onto the Env's objects. Use for plugin-driven metadata such as quota.scitix.ai/url (parsed by the server to derive the pool-name suffix)." annotations: allOf: - $ref: "#/components/schemas/StringMap" x-immutable: true x-immutable-lever: "create a new Env with the annotations you want" description: "Annotations stamped onto the Env's objects." CreateSandboxEnvRequest: allOf: - $ref: "#/components/schemas/UpsertSandboxEnvRequest" - type: object # `name` is the one field a create states and an update takes from the # address, so it is required HERE and only here. The property itself # is a `$ref` to the same component the update references: the shape # is written once, the requirement is stated where it applies. # # Both halves matter. A bare `required` beside the `allOf` makes # oapi-codegen collapse the whole request into a type alias, and an # empty `{type: object}` member makes openapi-typescript intersect it # with `Record`. required: [name] properties: name: $ref: "#/components/schemas/SandboxEnvName" example: name: my-env templateRef: name: e2b-envd mode: WarmPool overrides: gateway: enabled: true labels: team: ai-infra description: | What `POST /envs` takes: the same body an update does, plus the one thing only a create can say — which name to make. `name` is required here and the `pattern` it has to match is on the property itself. DeleteSandboxEnvResult: type: object required: [name, namespace, status] properties: name: type: string namespace: type: string status: type: string description: "'Terminating' on a successful delete request." # ========================================================= # SandboxTemplate # ========================================================= RuntimeReadinessProbe: type: object description: "Lightweight readiness probe — only httpGet is supported. Advanced fields (initialDelaySeconds, periodSeconds, etc.) use Kubernetes defaults." properties: httpGet: type: object required: [port] properties: port: type: integer format: int32 minimum: 1 maximum: 65535 description: "Port to probe" path: type: string description: "HTTP path to probe (e.g. /healthz), defaults to /" additionalProperties: false additionalProperties: false Runtime: type: object required: [name] properties: name: type: string port: type: integer format: int32 minimum: 1 maximum: 65535 protocol: type: string description: type: string description: "Human-readable description of this runtime" logDir: type: string description: "Path to the runtime log file inside the container (e.g. /tmp/envd.log)" readinessProbe: $ref: "#/components/schemas/RuntimeReadinessProbe" description: "Optional readiness probe for this runtime endpoint" additionalProperties: false VisibilityRule: type: object properties: team: type: string description: "Team name that this rule applies to." users: type: array description: "Specific users within the team that this rule applies to. Empty means all users in the team." items: type: string additionalProperties: false VisibilityConfig: type: object properties: rules: type: array description: "List of visibility rules controlling which teams and users can see this template." items: $ref: "#/components/schemas/VisibilityRule" additionalProperties: false SandboxTemplateSpec: type: object properties: version: type: string description: 'User-defined version string for the template (e.g. "v1.2.3").' description: type: string description: "Human-readable description of the template and its intended use." idleImage: type: string description: "Container image used when the pod is in Idle phase (lightweight placeholder image)." template: type: string description: "Kubernetes PodTemplateSpec serialized as YAML/JSON string, passed through as-is" runtimes: type: array items: $ref: "#/components/schemas/Runtime" description: "Runtime port mappings for the sandbox" visibility: $ref: "#/components/schemas/VisibilityConfig" description: "Access visibility rules" SandboxTemplateStatus: type: object properties: ready: type: boolean description: "True when the template has been validated and is ready for use." message: type: string description: "Human-readable status message, populated when ready is false." SandboxTemplateSummary: type: object description: "Lightweight summary returned by the List endpoint — omits spec, specYaml, labels, annotations, status, and full docs to reduce payload size." required: [name] properties: name: type: string description: "Name of the SandboxTemplate cluster resource (RFC 1123 DNS label)." version: type: string description: "User-defined version of this template (from spec.version)." description: type: string description: "Human-readable description of the template (from spec.description)." createdAt: type: string format: date-time description: "RFC 3339 timestamp when the template was created." cpu: type: string description: 'CPU resource quantity derived from the template''s pod spec (e.g. "1", "100m").' memory: type: string description: 'Memory resource quantity derived from the template''s pod spec (e.g. "16Gi", "512Mi").' syncSource: type: string description: "Resource origin: 'global' (synced via ws-proxy) or 'local' (created directly on worker)." runtimeNames: type: array description: "List of runtime endpoint names defined in this template (lightweight alternative to the full Runtime objects)." items: type: string hasDocs: type: boolean description: "True when the template has documentation in the agentbox.navix.sh/docs annotation." poolSizing: $ref: "#/components/schemas/PoolSizing" SandboxTemplate: type: object required: [name] properties: name: type: string description: "Name of the SandboxTemplate cluster resource (RFC 1123 DNS label)." version: type: string description: "User-defined version of this template (from spec.version)." description: type: string description: "Human-readable description of the template (from spec.description)." createdAt: type: string format: date-time description: "RFC 3339 timestamp when the template was created." cpu: type: string description: 'CPU resource quantity derived from the template''s pod spec (e.g. "1", "100m").' memory: type: string description: 'Memory resource quantity derived from the template''s pod spec (e.g. "16Gi", "512Mi").' syncSource: type: string description: "Resource origin: 'global' (synced via ws-proxy) or 'local' (created directly on worker). Empty for legacy resources." docs: type: string description: | Markdown documentation for the template, stored in the agentbox.navix.sh/docs annotation. Supports the placeholders listed under SandboxEnv.envDocs. On Template Get the env-scoped ones become readable hints (YOUR_ENV_NAME, YOUR_POOL_NAME) because there is no env context, while everything derived from the serving cluster's config (${AGBX_CLUSTER_ID}, the gateway URLs, ${AGBX_HOST}, ${AGBX_INNER_IP}, ${AGBX_HTTPS}, ${AGBX_REGISTRY_HOST}) is substituted for real; GetSandboxEnv substitutes everything except ${AGBX_API_KEY}, which neither renderer touches. Editing only the docs does not require bumping spec.version — docs never reach the rendered Pod, so they name no new template revision. crdYaml: type: string description: "Complete raw SandboxTemplate CRD YAML (without managedFields). Includes resourceVersion and uid for optimistic locking on PUT." poolSizing: $ref: "#/components/schemas/PoolSizing" SandboxTemplateEnvelope: type: object required: [template] properties: template: $ref: "#/components/schemas/SandboxTemplate" UpsertSandboxTemplateRequest: type: object required: [crdJson] properties: crdJson: type: string description: "Complete SandboxTemplate CRD object serialized as JSON. metadata.name is required. Labels, annotations, and resourceVersion are extracted from the JSON." DeleteSandboxTemplateResult: type: object required: [name, status] properties: name: type: string status: type: string ListSandboxTemplatesResult: type: object required: [items, total, limit, offset] properties: items: type: array description: "Page of SandboxTemplateSummary objects (lightweight — use GET /sandbox-templates/{name} for full details)." items: $ref: "#/components/schemas/SandboxTemplateSummary" total: type: integer description: "Total number of templates (before pagination)." limit: type: integer description: "Maximum number of items requested per page." offset: type: integer description: "Number of items skipped before this page." # ========================================================= # APIKey # ========================================================= SelfCreateAPIKeyRequest: type: object description: Request body for tenant self-service API key creation. Namespace/user/team are taken from the caller's auth context. properties: description: type: string description: "Optional human-readable description for this key (e.g. its intended use)." expiresAt: type: string format: date-time description: "Optional RFC 3339 expiry timestamp. Omit for a non-expiring key." mode: type: string enum: [unrestricted, agent] default: unrestricted description: | What this key is for, and therefore what it may do unattended. * `unrestricted` — a person's own credential. Behaves exactly as every key did before this field existed. * `agent` — handed to something that acts while nobody is watching. Its platform WRITES (create an environment, add a pool, delete anything) are held until a person approves them, and the refusal names an approval to act on. The sandbox surface is unaffected in both modes: an agent-mode key starts sandboxes, runs commands and moves files exactly as an unrestricted one does. It is the same key the E2B SDK uses, and the gate deliberately does not sit on that path — only on the platform operations `abx` performs. CreateAPIKeyRequest: type: object properties: namespace: type: string description: "Kubernetes namespace to associate the key with." user: type: string description: "Username to associate the key with." team: type: string description: "Team name to associate the key with." description: type: string description: "Optional human-readable description for this key." expiresAt: type: string format: date-time description: "Optional RFC 3339 expiry timestamp. Omit for a non-expiring key." tokenHash: type: string description: > Full SHA-256 hex hash of the raw token (64 hex chars). When provided together with hashPrefix, the key is imported using the given hash instead of generating a new random token. The operation is idempotent — if a key with the same hash already exists it is silently accepted. Admin-only. hashPrefix: type: string description: > First 16 hex characters of the tokenHash. Required when tokenHash is provided. issuedAt: type: string format: date-time description: > Original issue timestamp (import mode). Used to preserve the original creation time. Ignored when tokenHash is not provided. CreateAPIKeyResult: type: object required: [apiKey, keyId, role, issuedAt] properties: apiKey: type: string description: "The raw API key value (only returned once at creation time; store it securely)." keyId: type: string description: "Unique identifier for this API key (used to look up or delete the key)." user: type: string description: "Username associated with the key." team: type: string description: "Team associated with the key." role: type: string description: "Role granted by this key (e.g. tenant, admin)." description: type: string description: "Human-readable description of the key." issuedAt: type: string format: date-time description: "RFC 3339 timestamp when the key was created." expiresAt: type: string format: date-time description: "RFC 3339 expiry timestamp, or absent if the key never expires." APIKeyItem: type: object required: [keyId, role, issuedAt] properties: mode: type: string enum: [unrestricted, agent] description: "What this key is for. Absent on keys issued before the field existed, which read as `unrestricted`." keyId: type: string description: "Unique identifier for this API key." user: type: string description: "Username associated with the key." team: type: string description: "Team associated with the key." role: type: string description: "Role granted by this key (e.g. tenant, admin)." description: type: string description: "Human-readable description of the key." issuedAt: type: string format: date-time description: "RFC 3339 timestamp when the key was created." expiresAt: type: string format: date-time description: "RFC 3339 expiry timestamp, or absent if the key never expires." syncSource: type: string description: "Resource origin: 'global' (synced via ws-proxy) or 'local' (created directly on worker). Empty for legacy resources." rawToken: type: string description: | The full raw API key value (`agbx_...`), for recovery by the person who owns it. Present only for keys created after plaintext storage was introduced; absent for legacy keys, and displayed masked in the console. **Always absent for an agent credential.** An agent is forbidden from minting a key precisely so that it cannot issue itself one without the agent restriction — and returning an existing key here would have let it read that credential instead of creating it. The metadata still comes back, so an agent can say which keys exist and which are gated; only the material is withheld. PromoteAPIKeyResult: type: object required: [keyId, status] properties: keyId: type: string description: "Unique identifier of the promoted API key." status: type: string description: "Result of the promote operation (e.g. Promoted)." DeleteAPIKeyResult: type: object required: [keyId, status] properties: keyId: type: string description: "Unique identifier of the deleted API key." status: type: string description: "Result of the delete operation (e.g. Deleted)." ListAPIKeysResult: type: array description: "List of API key objects. Returned in full — the endpoint does not paginate." items: $ref: "#/components/schemas/APIKeyItem" # ========================================================= # Approvals # ========================================================= ApprovalPrincipal: type: object required: [team, user] properties: team: { type: string } user: { type: string } keyId: type: string description: "Which credential asked. A key-scoped grant belongs to this key alone, so deleting the key must take its grants with it." ApprovalRequest: type: object required: [id, principal, operation, onceOnly, method, path, summary, createdAt, expiresAt, status] properties: id: { type: string } principal: $ref: "#/components/schemas/ApprovalPrincipal" sessionId: type: string description: "Absent when the caller sent no session header. Such a request can only ever be approved for one call." operation: type: string description: "What is being asked for, e.g. `env.create`. A grant is written against this, not against a route." onceOnly: type: boolean description: "True for destructive and credential-minting calls, which refuse the session and key scopes." method: { type: string } path: { type: string } summary: type: string description: "What the person is being asked, naming the thing acted on." createdAt: { type: string, format: date-time } expiresAt: { type: string, format: date-time } status: type: string enum: [pending, approved, denied, expired] scope: type: string enum: [once, session, key] description: "How far the decision reached. Set once decided." decidedBy: { type: string } decidedAt: { type: string, format: date-time } ApprovalGrant: type: object required: [id, principal, scope, operation, createdAt, grantedBy] properties: id: { type: string } principal: $ref: "#/components/schemas/ApprovalPrincipal" scope: type: string enum: [session, key] sessionId: { type: string } operation: { type: string } createdAt: { type: string, format: date-time } expiresAt: type: string format: date-time description: "Absent for a key-scoped grant, which ends only when revoked." grantedBy: { type: string } ListApprovalsResult: type: object required: [pending, grants] properties: pending: type: array items: $ref: "#/components/schemas/ApprovalRequest" grants: type: array items: $ref: "#/components/schemas/ApprovalGrant" ApprovalDecisionRequest: type: object required: [decision] additionalProperties: false properties: decision: type: string enum: [approve, deny] scope: type: string enum: [once, session, key] default: once description: "Ignored when denying. `session` needs the request to carry a session id; both wider scopes are refused for a once-only operation." # ========================================================= # Quota # ========================================================= QuotaResources: type: object description: "Resource accounting for a single quota, keyed by resource name (e.g. cpu, memory, nvidia.com/gpu, sci.c22-2)." properties: total: type: object description: "Total capacity allocated to this quota." additionalProperties: type: string used: type: object description: "Currently consumed amount." additionalProperties: type: string reserved: type: object description: "Reserved but not yet actively consumed amount." additionalProperties: type: string free: type: object description: "Available amount (total - used - reserved)." additionalProperties: type: string Quota: type: object required: [id, name] properties: id: type: string description: "Stable identifier for this quota. Used by clients to reference the quota in subsequent API calls (e.g. as the reservation target). Opaque from the caller's perspective." name: type: string description: "Human-readable display name for this quota. Suitable for showing in UI; not guaranteed to be unique across providers." team: type: string description: "Team that owns this quota, if applicable." user: type: string description: "User that owns this quota, if applicable." resources: $ref: "#/components/schemas/QuotaResources" metadata: type: object description: "Provider-attached display hints, opaque to the core schema. Keys are provider-defined (e.g. a vendor-prefixed pool name/type); generic clients ignore unknown keys." additionalProperties: type: string ListQuotasResult: type: object required: [items, total, limit, offset] properties: items: type: array description: "Page of quota objects." items: $ref: "#/components/schemas/Quota" total: type: integer description: "Total number of quota entries (before pagination)." limit: type: integer description: "Maximum number of items requested per page." offset: type: integer description: "Number of items skipped before this page." # ========================================================= # WhoAmI # ========================================================= WhoAmIResult: type: object required: [role] properties: mode: type: string enum: [unrestricted, agent] description: | What kind of credential this is. `agent` keys have their writes held for a person to release. Reported here so a client can say so before attempting the write rather than after: an agent that learns its own restriction up front asks for the right thing, while one that learns it from a 428 has already spent the round trip. Absent on keys issued before the field existed, which read as `unrestricted`. role: type: string description: "Role assigned to the caller's API key (e.g. tenant, admin)." user: type: string description: "Username extracted from the caller's auth context." team: type: string description: "Team extracted from the caller's auth context." namespace: type: string description: >- The namespace this credential reads and writes in on THIS cluster. Reported because it is not always the one recorded when the credential was minted — a credential is used against several clusters, which map a tenant differently, so each cluster resolves it locally. Two credentials for the same person can land in different namespaces, and the symptom is an empty list rather than an error, which is why it is worth being able to read it back. # ========================================================= # FeatureGates # ========================================================= FeatureGates: type: object required: [quota, instanceType] description: >- Boolean switches that tell clients which optional features are wired into the current deployment. Dashboards gate feature UI on these values; SDKs can short-circuit feature-specific calls when a gate is false. properties: quota: type: boolean description: >- True when a non-noop quota provider is active (quota selection on pool creation, quota listing endpoint). False on deployments with no quota backend wired in. example: true instanceType: type: boolean description: >- True when a non-noop InstanceType catalog provider is active (catalog-driven member sizing in the Env upsert sheet, `/instancetypes` listing endpoint). False on deployments with no InstanceType backend wired in. example: true volumes: type: boolean description: >- True when mounting existing PersistentVolumeClaims into sandboxes is enabled (the volumes panel in the Env upsert sheet, `/volumes` listing endpoint). When false the server also rejects a non-empty `overrides.volumes`, so this is a kill switch and not only a UI hint. example: false # ========================================================= # InstanceType catalog # ========================================================= InstanceTypeItem: type: object required: [name, baseResources] description: >- Catalog entry exposing a named base resource shape. Sandboxes pick an entry by `name` and a positive integer multiplier; resolution to Pod resources happens server-side. properties: name: type: string description: "Catalog key. Unique within a deployment." showName: type: string description: "User-facing label. Falls back to `name` when empty." description: type: string description: "Free-form description for tooltips." baseResources: $ref: "#/components/schemas/ResourceRequirements" description: "Pod resource requirements at multiplier=1. Numeric keys (cpu, memory, nvidia.com/gpu, ...) scale linearly with the multiplier." maxMultiplier: type: integer format: int32 minimum: 0 description: "Maximum allowed multiplier. 0 means no cap." cost: type: string description: "Free-form cost weight for client-side sorting / display." extensions: type: object additionalProperties: type: string description: "Backend-specific key/value pairs (e.g. `gpu-type`). Open clients pass these through unchanged for display only." ListInstanceTypesResult: type: object required: [items, total] properties: items: type: array description: "Available InstanceType entries, sorted by name." items: $ref: "#/components/schemas/InstanceTypeItem" total: type: integer description: "Number of returned entries." # ========================================================= # Organization # ========================================================= TeamsResult: type: object required: [items, total] properties: items: type: array description: "List of team names." items: type: string total: type: integer description: "Total number of teams." UsersResult: type: object required: [items, total] properties: items: type: array description: "List of usernames in the team." items: type: string total: type: integer description: "Total number of users in the team." NamespacesResult: type: object required: [items, total] properties: items: type: array description: "List of Kubernetes namespace names." items: type: string total: type: integer description: "Total number of namespaces." ListVolumesResult: type: object required: [items, total] properties: items: type: array items: $ref: "#/components/schemas/VolumeItem" total: type: integer description: "Number of mountable claims returned." VolumeItem: type: object required: [claimName, phase] description: "One PersistentVolumeClaim in the caller's namespace that a SandboxEnv may mount." properties: claimName: type: string description: "The claim's name — the value to put in `overrides.volumes[].claimName`." displayName: type: string description: >- Human-readable name, resolved from the first non-empty label listed in the deployment's `--volume-display-name-labels`. Falls back to claimName when no label matches or none is configured, so this is always safe to render directly. capacity: type: string description: "Requested capacity, e.g. '5Ti'. Absent when the claim reports none." accessModes: type: array description: "The claim's access modes, e.g. ['ReadWriteMany']." items: type: string storageClass: type: string description: "The claim's storageClassName, when set." phase: type: string description: "Claim phase. Only Bound claims are returned, so this is always 'Bound' today; present so a future filter relaxation stays legible." labels: type: object additionalProperties: type: string description: >- The claim's labels, verbatim. Returned so a caller can apply its own presentation rules without this API having to know the storage platform's label vocabulary. additionalProperties: false # ========================================================= # Statistics # ========================================================= SandboxStatistics: type: object required: [total, byStatus, byNamespace] properties: total: type: integer description: "Total number of sandboxes across all namespaces." byStatus: type: object description: "Sandbox count broken down by status (e.g. Running, Failed)." additionalProperties: type: integer byNamespace: type: object description: "Sandbox count broken down by Kubernetes namespace." additionalProperties: type: integer SandboxStatisticsEnvelope: type: object required: [statistics] properties: statistics: $ref: "#/components/schemas/SandboxStatistics" UserSandboxStatistics: type: object required: [namespace, total, byStatus] properties: namespace: type: string description: "Kubernetes namespace these statistics are scoped to." total: type: integer description: "Total number of sandboxes in the user's namespace." byStatus: type: object description: "Sandbox count broken down by status (e.g. Running, Failed)." additionalProperties: type: integer UserSandboxStatisticsEnvelope: type: object required: [statistics] properties: statistics: $ref: "#/components/schemas/UserSandboxStatistics" # ========================================================= # Errors # ========================================================= ClusterSummary: type: object required: [id, local] description: "One cluster entry visible through the gateway's routing table." properties: id: type: string description: | Cluster identifier. Use this value as the prefix when addressing cross-cluster resources: `{id}.{uuid}` for sandboxes, `{id}::{poolName}` for pools. example: "cluster1" name: type: string description: "Human-readable display name (may equal id)." example: "cluster1" local: type: boolean description: | True when this entry is the cluster serving the current request — i.e. sandbox/pool identifiers without any cross-cluster prefix refer to this cluster. example: true ListClustersResult: type: object required: [clusters] description: "Response envelope for `GET /clusters`." properties: clusters: type: array items: $ref: "#/components/schemas/ClusterSummary" ErrorResponse: type: object required: [error] description: | Standard error envelope. Individual endpoints override the `example` per response code so the shape of `detail` is accurate for that specific failure mode. properties: error: type: string description: "Human-readable error message." errorCode: type: string description: | Machine-readable business error code. Only present for specific business errors that require special handling (e.g. `APPROVAL_REQUIRED` tells an agent its write is held for a person to release, and `FORBIDDEN_FOR_AGENT` tells it no approval will ever exist). Generic HTTP errors (400, 500, etc.) do NOT carry this field. example: "APPROVAL_REQUIRED" detail: description: | Structured context for the error. Shape depends on the failure mode. Common variants: * Plain string — simple context ("pool not found: my-pool") * `PoolStatusDetail` — returned on 409/429 from CreateSandbox to describe pool replica breakdown and retry hints * `{availablePools: [...]}` — returned on 404 from CreateSandbox / 400 from CreateSandboxPool when the referenced resource does not exist * `{availableTemplates: [...]}` — returned on 400 from CreateSandboxPool * `{availableQuotaURLs: [...]}` — returned on 400 when spec.reservation is set but quotaURL is missing paths: # ========================================================= # Auth # ========================================================= /auth/whoami: get: operationId: GetWhoAmI summary: Get caller identity tags: [auth] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/WhoAmIResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # Sandboxes # ========================================================= /sandboxes: post: operationId: CreateSandbox summary: Create a sandbox tags: [sandboxes] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateSandboxRequest" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/SandboxEnvelope" example: sandbox: sandboxId: "5de15c92-8fb5-440f-a9ea-7f62f734f1b9" namespace: "t-team1-user1" poolName: "my-pool" podName: "my-pool-xy7k2" status: "Running" claimedAt: "2026-04-21T10:15:30Z" team: "team1" user: "user1" "400": description: Bad Request — validation failure (e.g. missing `poolName`, invalid `idleTimeout`). content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: error: "poolName is required" "401": description: Unauthorized — API key missing or invalid. content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: error: "invalid API key" "403": description: | Forbidden — the target pool belongs to another tenant. A warm pool's Pods are capacity its owner already paid for out of their quota and reservation, so only that tenant (or an admin) may claim one. Pools carrying no ownership labels are exempt. content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: error: "sandbox pool default/demo-1c2gi belongs to team-a/alice; create in a pool of your own" "404": description: | Not Found — the requested `poolName` does not exist in the caller's namespace. The `detail` field carries an `availablePools` array so the client can pick a valid pool without a second round-trip to `ListSandboxPools`. content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: error: "sandbox pool t-team1-user1/missing-pool not found" detail: availablePools: - name: "my-pool" namespace: "t-team1-user1" idle: 2 running: 1 starting: 0 - name: "gpu-pool" namespace: "t-team1-user1" idle: 0 running: 0 starting: 1 hint: "Pool not found. Pick a name from availablePools, or call POST /v1/sandboxpools first." "409": description: | Conflict — the target pool has no idle pods. `detail` is a `PoolStatusDetail` exposing the live replica counts and a human-readable hint so the client can either retry after `retryAfter` or scale the pool up. content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: error: "no idle pods available in pool my-pool" detail: idle: 0 running: 3 starting: 0 stopping: 0 failed: 0 hint: "pool at capacity; wait for a running sandbox to be released or scale up" "429": description: | Too Many Requests — SI Scheduler rejected the reservation attempt. `detail` mirrors the scheduler's submit response (`errCode`, optional `retryAfter`). content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: error: "scale failed: QUOTA_EXCEEDED" detail: errCode: "QUOTA_EXCEEDED" message: "user quota reached its hard cap" retryAfter: 30 "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: error: "failed to generate sandbox UUID" get: operationId: ListSandboxes summary: List sandboxes tags: [sandboxes] parameters: - $ref: "#/components/parameters/QueryPoolName" - $ref: "#/components/parameters/QuerySandboxStatus" - $ref: "#/components/parameters/QueryLimit" - $ref: "#/components/parameters/QueryOffset" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListSandboxesResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /sandboxes/{sandboxId}: get: operationId: GetSandbox summary: Get a sandbox tags: [sandboxes] parameters: - $ref: "#/components/parameters/PathSandboxId" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SandboxEnvelope" example: sandbox: sandboxId: "5de15c92-8fb5-440f-a9ea-7f62f734f1b9" namespace: "t-team1-user1" poolName: "my-pool" podName: "my-pool-xy7k2" status: "Running" claimedAt: "2026-04-21T10:15:30Z" team: "team1" user: "user1" endpoints: default: "https://agentbox.example.com/v1/sandboxes/5de15c92-8fb5-440f-a9ea-7f62f734f1b9" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: error: "invalid API key" "404": description: Not Found — the sandbox does not exist or has already been terminated. content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: error: "sandbox t-team1-user1/5de15c92-8fb5-440f-a9ea-7f62f734f1b9 not found or already terminated" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: operationId: DeleteSandbox summary: Delete a sandbox tags: [sandboxes] parameters: - $ref: "#/components/parameters/PathSandboxId" responses: "202": description: Accepted content: application/json: schema: $ref: "#/components/schemas/DeleteSandboxResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /sandboxes/{sandboxId}/timeout: put: summary: Update sandbox idle timeout operationId: SetSandboxTimeout tags: [sandboxes] security: - ApiKeyAuth: [] parameters: - $ref: "#/components/parameters/PathSandboxId" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SetSandboxTimeoutRequest" responses: "204": description: Timeout updated "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /sandboxes/{sandboxId}/logs: get: operationId: GetSandboxLogs summary: Get sandbox logs tags: [sandboxes] security: - ApiKeyAuth: [] parameters: - $ref: "#/components/parameters/PathSandboxId" - name: container in: query required: false schema: type: string description: | Which container's log to read. Defaults to the sandbox's own container — a Pod also runs the egress proxy and the injector init containers, whose output is the platform's rather than the user's, and the proxy logs a line per connection it evaluates. Name any container from `containers` in the response to read that one instead; an unknown name is a 400. - name: lines in: query required: false schema: type: integer minimum: 0 maximum: 10000 description: "Return only the last N lines. 0 or absent means return all lines." - name: source in: query required: false schema: type: string description: | Log source selector. - Omit or "stdout": return container stdout/stderr (default behavior) - "": read the runtime's log file (logDir) via exec inside the container. Only available for Running sandboxes with a matching runtime that has logDir set. responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SandboxLogsResult" "400": description: Bad Request (e.g. runtime not found, logDir not configured, sandbox not Running) content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /sandboxes/{sandboxId}/exec-token: post: operationId: CreateSandboxExecToken summary: Create a short-lived exec token for WebSocket terminal description: | Returns a single-use token (TTL 30s) for establishing a WebSocket terminal. WS endpoint: wss:///ws/clusters/{clusterID}/sandboxes/{sandboxId}/terminal?token= The sandbox must be in Running phase. tags: [sandboxes] parameters: - $ref: "#/components/parameters/PathSandboxId" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ExecTokenResponse" "400": description: Bad Request (sandbox not Running) content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /sandboxes/{sandboxId}/is_ready: get: operationId: IsSandboxReady summary: Check if all runtime endpoints of a sandbox are ready deprecated: true description: | **DEPRECATED** — will be removed in a future version. Prefer `GET /sandboxes/{sandboxId}` and inspect the returned `sandbox.status` (`Running`) plus `sandbox.endpoints` (non-empty, correct scheme/port) instead. Executes the configured ReadinessProbe for each runtime endpoint and returns the aggregated result. Returns 200 when all probes pass, 503 when one or more probes fail. If a runtime has no ReadinessProbe configured, it is considered ready. tags: [sandboxes] parameters: - $ref: "#/components/parameters/PathSandboxId" responses: "200": description: All configured readiness probes passed content: application/json: schema: $ref: "#/components/schemas/SandboxReadinessResult" "503": description: One or more endpoints are not ready content: application/json: schema: $ref: "#/components/schemas/SandboxReadinessResult" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /sandboxes/{sandboxId}/exec: post: operationId: ExecSandboxCommand summary: Execute a command inside a sandbox deprecated: true description: | **DEPRECATED** — will be removed in a future version. Prefer opening an interactive exec session with the WebSocket endpoint (see `POST /sandboxes/{sandboxId}/exec-token` + `wss://.../terminal`) for any non-trivial command execution. This REST call is limited to 300 seconds and does not stream output incrementally. Executes a shell command inside the sandbox and returns stdout, stderr, and exit code. The sandbox must be in Running phase. The command runs in a non-interactive shell (no TTY). tags: [sandboxes] parameters: - $ref: "#/components/parameters/PathSandboxId" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ExecCommandRequest" responses: "200": description: Command executed (check exitCode for success/failure) content: application/json: schema: $ref: "#/components/schemas/ExecCommandResult" "400": description: Bad Request (sandbox not Running or invalid request) content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # SandboxEnvs # ========================================================= /envs: get: operationId: ListSandboxEnvs summary: List SandboxEnvs visible to the caller tags: [sandbox-envs] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListSandboxEnvsResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" post: operationId: CreateSandboxEnv summary: Create a new SandboxEnv shell. Members are added through `POST /envs/{name}/sandboxpools`; the matching autoscaling group is created automatically per member and tuned through `PUT /envs/{name}/autoscaling/groups/{groupName}`. tags: [sandbox-envs] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateSandboxEnvRequest" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/SandboxEnvEnvelope" "400": description: Bad Request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "409": description: Already Exists content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "422": description: A rewritten template image is missing from the target registry. content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "503": description: Template image access could not be verified; retry after checking registry connectivity and credentials. content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /envs/{name}: get: operationId: GetSandboxEnv summary: Get a SandboxEnv by name. Response includes the rendered envDocs Markdown. tags: [sandbox-envs] parameters: - in: path name: name required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SandboxEnvEnvelope" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: operationId: DeleteSandboxEnv summary: Delete a SandboxEnv. All member SandboxPools are cascade-deleted via OwnerReferences. tags: [sandbox-envs] parameters: - in: path name: name required: true schema: type: string responses: "202": description: Accepted content: application/json: schema: $ref: "#/components/schemas/DeleteSandboxEnvResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" put: operationId: UpdateSandboxEnv summary: Replace the editable Env shell fields (overrides only). Members and autoscaling groups have dedicated endpoints. x-since: "0.0.0" tags: [sandbox-envs] parameters: - in: path name: name required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateSandboxEnvRequest" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SandboxEnvEnvelope" "400": description: Bad Request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # Env-scoped autoscaler config # The autoscaler config lives on SandboxEnv.spec.autoscaling. CRUD # here mutates that subtree. Groups are independent records keyed by # name (mirroring EnvClusterMember CRUD under /sandboxpools). # ========================================================= /envs/{name}/autoscaling: get: operationId: GetEnvAutoscaling summary: Return the env's full autoscaling spec (enabled flag + groups). tags: [sandbox-envs] parameters: - in: path name: name required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/EnvAutoscalingSpecEnvelope" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Env Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /envs/{name}/autoscaling/groups: get: operationId: ListEnvAutoscalingGroups summary: List autoscaling groups on the env. tags: [sandbox-envs] parameters: - in: path name: name required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListEnvAutoscalingGroupsResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Env Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /envs/{name}/autoscaling/groups/{groupName}: get: operationId: GetEnvAutoscalingGroup summary: Get one autoscaling group by name. tags: [sandbox-envs] parameters: - in: path name: name required: true schema: type: string - in: path name: groupName required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/EnvAutoscalingGroupEnvelope" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Group Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" put: operationId: UpdateEnvAutoscalingGroup summary: Patch one or more editable fields on an autoscaling group. tags: [sandbox-envs] parameters: - in: path name: name required: true schema: type: string - in: path name: groupName required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateEnvAutoscalingGroupRequest" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/EnvAutoscalingGroupEnvelope" "400": description: Bad Request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Group Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: operationId: DeleteEnvAutoscalingGroup summary: Remove an autoscaling group from the env. tags: [sandbox-envs] parameters: - in: path name: name required: true schema: type: string - in: path name: groupName required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/DeleteEnvAutoscalingGroupResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Group Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # Env-scoped SandboxPools # Every "Pool" is a member of a SandboxEnv. CRUD here mutates # SandboxEnv.spec.clusters[].members[]; the Env Reconciler then # materialises the underlying SandboxPool CR (OwnerRef → Env). # ========================================================= /envs/{name}/sandboxpools: post: operationId: CreateEnvSandboxPool summary: Add a member SandboxPool to an Env tags: [pools] parameters: - in: path name: name required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateEnvSandboxPoolRequest" responses: "202": description: Accepted — the member entry was added to the Env spec; the SandboxPool CR is materialised asynchronously by the Env Reconciler. Response body returns the projected Pool (status fields may be unset until the next reconcile). content: application/json: schema: $ref: "#/components/schemas/SandboxPoolEnvelope" "400": description: Bad Request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Env not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "409": description: Conflict — a member with this name already exists in the Env content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "503": description: Server misconfigured (LOCAL_CLUSTER_ID not set) content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" get: operationId: ListEnvSandboxPools summary: List member SandboxPools of an Env tags: [pools] parameters: - in: path name: name required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListSandboxPoolsResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Env not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /envs/{name}/events: get: operationId: ListEnvEvents summary: List recent K8s Events for a SandboxEnv and its member SandboxPools, newest first. description: | Returns the K8s Events emitted against the named SandboxEnv and every member SandboxPool the Env owns in the caller's namespace, merged and sorted descending by lastTimestamp. Used by the dashboard to render an activity timeline (scaling decisions, phase transitions, autoscaler actions). Reads come straight from the apiserver — no Prometheus round-trip — so the latest event is visible as soon as the controllers emit it. tags: [sandbox-envs] parameters: - in: path name: name required: true schema: type: string - in: query name: limit schema: type: integer minimum: 1 maximum: 500 default: 100 description: "Maximum number of events to return." responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListEnvEventsResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Env not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /envs/{name}/sandboxpools/{poolName}: parameters: - in: path name: name required: true schema: type: string - in: path name: poolName required: true schema: type: string get: operationId: GetEnvSandboxPool summary: Get a member SandboxPool tags: [pools] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SandboxPoolEnvelope" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" put: operationId: UpdateEnvSandboxPool summary: Update a member SandboxPool tags: [pools] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateEnvSandboxPoolRequest" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SandboxPoolEnvelope" "400": description: Bad Request — name in body does not match path, or invalid field combinations. content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Env or member not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "503": description: Server misconfigured (LOCAL_CLUSTER_ID not set) content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: operationId: DeleteEnvSandboxPool summary: Remove a member SandboxPool from an Env tags: [pools] responses: "202": description: Accepted — the member entry was removed from the Env spec; the SandboxPool CR is cascade-deleted by the Env Reconciler. content: application/json: schema: $ref: "#/components/schemas/DeleteSandboxPoolResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Env or member not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "503": description: Server misconfigured (LOCAL_CLUSTER_ID not set) content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # SandboxTemplates # ========================================================= /sandbox-templates: get: operationId: ListSandboxTemplates summary: List sandbox templates tags: [sandbox-templates] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListSandboxTemplatesResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /sandbox-templates/{name}: get: operationId: GetSandboxTemplate summary: Get a sandbox template tags: [sandbox-templates] parameters: - $ref: "#/components/parameters/PathTemplateName" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SandboxTemplateEnvelope" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # Clusters # ========================================================= /clusters: get: operationId: ListClusters summary: List clusters visible to the gateway description: | Returns the cluster catalog visible to the gateway serving this request. The entry with `local: true` is the cluster that owns native-local resources (a sandbox created here without any `{clusterID}.` prefix lives in that cluster). Other entries are reachable via cross-cluster forwarding: prefix sandbox IDs with `{clusterID}.` (dot) and pool names with `{clusterID}::` (double colon) to route to them. This endpoint requires only a regular API key — it does not leak gateway URLs, headers, or any write-capability. tags: [clusters] security: - ApiKeyAuth: [] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListClustersResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # FeatureGates # ========================================================= /feature-gates: get: operationId: GetFeatureGates summary: Report optional features enabled on this cluster description: >- Returns boolean switches for each optional feature wired into the current deployment. Clients (dashboard, SDK) use this to decide whether to render feature-specific UI (quota selector on pool create, etc.) and whether the corresponding endpoints are available. tags: [feature-gates] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/FeatureGates" example: quota: true "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # Quotas # ========================================================= /quotas: get: operationId: ListQuotas summary: List quotas for current user tags: [quotas] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListQuotasResult" example: items: - name: "team1-user1-ondemand" quotaURL: "alice.bob.carol.ted" queue: "ted" team: "carol" user: "alice" poolId: "bob" resources: cpu: "64" memory: "256Gi" used: cpu: "24" memory: "96Gi" reserved: cpu: "16" memory: "64Gi" free: cpu: "24" memory: "96Gi" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # InstanceTypes # ========================================================= /volumes: get: operationId: ListVolumes x-since: "0.0.0" summary: List mountable PersistentVolumeClaims description: >- Returns the Bound PersistentVolumeClaims in the caller's namespace, which are exactly the claims a SandboxEnv may mount through `overrides.volumes`. There is deliberately no namespace parameter: the namespace is derived from the caller's identity, and that derivation is the authorisation boundary. Empty when the feature is disabled (see `volumes` on `/feature-gates`). tags: [volumes] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListVolumesResult" example: total: 2 items: - claimName: "team-user-41" displayName: "zystore" capacity: "5Ti" accessModes: ["ReadWriteMany"] storageClass: "example-shared-fs" phase: "Bound" - claimName: "shared-models" displayName: "shared-models" capacity: "200Ti" accessModes: ["ReadWriteMany"] storageClass: "example-shared-fs" phase: "Bound" "401": description: Unauthorized — API key missing or invalid. content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal error — the claims could not be read. content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /instancetypes: get: operationId: ListInstanceTypes summary: List InstanceType catalog entries description: >- Returns the full InstanceType catalog. Empty when the configured provider is the noop (see `instanceType` on `/feature-gates`). tags: [instancetypes] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListInstanceTypesResult" example: total: 1 items: - name: "sci.c23-2" showName: "sci.c23-2" description: "Standard CPU shape." baseResources: requests: cpu: "1" memory: "8Gi" limits: cpu: "1" memory: "8Gi" maxMultiplier: 8 extensions: gpu-type: "" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # Statistics # ========================================================= /statistics/sandboxes: get: operationId: GetUserSandboxStatistics summary: Get user-scoped sandbox statistics tags: [statistics] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/UserSandboxStatisticsEnvelope" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # Self-service API Keys (tenant — namespace locked to caller's namespace) # ========================================================= /api-keys: post: operationId: SelfCreateAPIKey summary: Create an API key for yourself (tenant) tags: [apikeys] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SelfCreateAPIKeyRequest" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/CreateAPIKeyResult" "400": description: Bad Request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "503": description: Service Unavailable content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" get: operationId: SelfListAPIKeys summary: List your own API keys (tenant) tags: [apikeys] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListAPIKeysResult" "503": description: Service Unavailable content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /api-keys/{name}: delete: operationId: SelfDeleteAPIKey summary: Delete one of your own API keys (tenant) tags: [apikeys] parameters: - $ref: "#/components/parameters/PathAPIKeyName" responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/DeleteAPIKeyResult" "403": description: Forbidden (not your key) content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "503": description: Service Unavailable content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # Approvals # # The gate that holds a write made with an unattended credential until a # person says yes. Only these three routes decide anything; every other route # merely gets refused with a 428 naming an approval id. # ========================================================= /approvals: get: operationId: ListApprovals x-since: "0.0.0" summary: What is waiting on you, and what you have already allowed description: | Scoped to the caller's team+user, not to a key: the person deciding owns every key they hold, and this list is read by a human. tags: [approvals] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListApprovalsResult" /approvals/{approvalId}: get: operationId: GetApproval x-since: "0.0.0" summary: Where one approval request has got to description: | The endpoint a blocked client polls. Expiry is reported as a status rather than as a 404, because a caller waiting on a request that timed out deserves to be told which of the two happened. tags: [approvals] parameters: - name: approvalId in: path required: true schema: { type: string } responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ApprovalRequest" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /approvals/{approvalId}/decision: post: operationId: DecideApproval x-since: "0.0.0" summary: Approve or deny a pending request description: | Console sessions only. A credential must not be able to approve its own writes — that would make the gate a formality the agent walks through by itself. tags: [approvals] parameters: - name: approvalId in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ApprovalDecisionRequest" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ApprovalRequest" "400": description: Bad Request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /approvals/grants/{grantId}: delete: operationId: RevokeApprovalGrant x-since: "0.0.0" summary: Withdraw a standing permission tags: [approvals] parameters: - name: grantId in: path required: true schema: { type: string } responses: "204": description: Revoked "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # Admin: API Keys # ========================================================= /admin/api-keys: post: operationId: CreateAPIKey summary: Create an API key (admin) security: - AdminKeyAuth: [] tags: [admin] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateAPIKeyRequest" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/CreateAPIKeyResult" "400": description: Bad Request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "503": description: Service Unavailable content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" get: operationId: ListAPIKeys summary: List API keys (admin) security: - AdminKeyAuth: [] tags: [admin] parameters: - $ref: "#/components/parameters/QueryNamespace" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListAPIKeysResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "503": description: Service Unavailable content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /admin/api-keys/{name}: delete: operationId: DeleteAPIKey summary: Delete an API key (admin) security: - AdminKeyAuth: [] tags: [admin] parameters: - $ref: "#/components/parameters/PathAPIKeyName" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/DeleteAPIKeyResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "503": description: Service Unavailable content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /admin/api-keys/{name}/promote: post: operationId: PromoteAPIKey summary: Promote a local API key to global (admin) description: > Elevates a locally-created API key to a global key by syncing it through the ws-proxy manager to all connected Worker clusters. The key must not already be global. Requires an active ws-proxy connection. security: - AdminKeyAuth: [] tags: [admin] parameters: - $ref: "#/components/parameters/PathAPIKeyName" responses: "200": description: Promoted content: application/json: schema: $ref: "#/components/schemas/PromoteAPIKeyResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "409": description: Conflict (key is already global) content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "503": description: Service Unavailable (ws-proxy not connected) content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # Admin: SandboxTemplate CRUD # ========================================================= /admin/sandbox-templates: get: operationId: AdminListSandboxTemplates summary: List sandbox templates (admin) description: | Returns all SandboxTemplate resources. Admin callers see every template regardless of origin; optional `team` / `user` query parameters narrow results to templates accessible by a specific identity. security: - AdminKeyAuth: [] tags: [admin] parameters: - name: team in: query schema: type: string description: "Filter by team." - name: user in: query schema: type: string description: "Filter by user." responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ListSandboxTemplatesResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" post: operationId: AdminCreateSandboxTemplate summary: Create a sandbox template (admin) security: - AdminKeyAuth: [] tags: [admin] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpsertSandboxTemplateRequest" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/SandboxTemplateEnvelope" "400": description: Bad Request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "409": description: Conflict content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /admin/sandbox-templates/{name}: put: operationId: AdminUpdateSandboxTemplate summary: Update a sandbox template (admin) security: - AdminKeyAuth: [] tags: [admin] parameters: - $ref: "#/components/parameters/PathTemplateName" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpsertSandboxTemplateRequest" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SandboxTemplateEnvelope" "400": description: Bad Request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "409": description: Conflict (resourceVersion mismatch — refresh and retry) content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: operationId: AdminDeleteSandboxTemplate summary: Delete a sandbox template (admin) security: - AdminKeyAuth: [] tags: [admin] parameters: - $ref: "#/components/parameters/PathTemplateName" responses: "202": description: Accepted content: application/json: schema: $ref: "#/components/schemas/DeleteSandboxTemplateResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # Admin: Organization # ========================================================= /admin/teams: get: operationId: ListTeams summary: List all teams (admin) security: - AdminKeyAuth: [] tags: [admin] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/TeamsResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /admin/teams/{team}/users: get: operationId: ListUsersByTeam summary: List users in a team (admin) security: - AdminKeyAuth: [] tags: [admin] parameters: - $ref: "#/components/parameters/PathTeam" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/UsersResult" "400": description: Bad Request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /admin/namespaces: get: operationId: ListNamespaces summary: List all namespaces (admin) security: - AdminKeyAuth: [] tags: [admin] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/NamespacesResult" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ========================================================= # Admin: Statistics # ========================================================= /admin/statistics/sandboxes: get: operationId: AdminGetSandboxStatistics summary: Get cluster-wide sandbox statistics (admin) security: - AdminKeyAuth: [] tags: [admin] responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SandboxStatisticsEnvelope" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "403": description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Internal Server Error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse"