API reference

Generated from the OpenAPI specification (SHA-256 0c77136174a4...). Public names use camelCase; serialized keys keep their wire spelling. Required arguments are positional, optional ones ride in a trailing options object.

Client methods

ContreeClient.listNetworkPolicies(options?)

GET /network/policies — List network policies

Returns policies in your namespace and the shared namespace. Deleted policies are excluded. Reusing or restoring a policy does not change its creation time or listing position. Each entry contains the policy UUID, creation timestamp, accessible tags, and a summary with the number of IP rules. Tags are sorted by name. Your tag takes precedence over a shared tag with the same name; the overridden shared binding is omitted. Use GET /network/policies/{uuid} to retrieve the full rules. Requires spawn or spawn_disposable permission.

Search: Supply search to find active policies in your namespace and the shared namespace that allow the destination. The input determines the search type; currently only IPv4 and IPv6 addresses and CIDRs are supported. Domains and other unsupported inputs return 400. An omitted search parameter lists policies normally; an empty value returns 400.

Use [tcp://|udp://]address-or-cidr[:port]. IPv6 addresses and CIDRs must be enclosed in brackets when specifying a port, with the prefix length inside the brackets. Examples: 192.0.2.1, 192.0.2.0/24:443, tcp://192.0.2.0/24:443, and udp://[2001:db8::/64]:53. This is search syntax, not a URL. CIDRs must use their network address; host bits, scoped IPv6 addresses, and ports outside 1-65535 return 400.

A match must allow the requested protocol and port throughout the entire CIDR, not merely overlap it. An IP address is treated as a /32 or /128 CIDR. All-port rules match every requested port. If protocol or port is omitted, any single protocol/port combination covering the entire destination matches. Complementary subnets granting that same access are normalized into a covering rule. Permissions from different policies are never combined for search. Empty policies do not match. Filtering happens before pagination, and results retain the same order, summary, timestamp, and tags as the normal listing.

Arguments:
  • options.search – string | null — IP or CIDR search, optionally qualified by TCP/UDP and a destination port.

  • options.limit – number | null — Maximum number of results to return. Invalid values raise 400 error.

  • options.offset – number | null — Number of results to skip. Invalid values raise 400 error.

Returns:

Promise<NetworkPolicyListResponse>

ContreeClient.createNetworkPolicy(cidrs)

POST /network/policies — Create a network policy

Creates a policy with immutable rules in the caller’s namespace. Requires network_policy permission.

Rules

  • Each rule allows a CIDR for the selected protocol and ports. An empty or omitted port list allows all ports.

  • ICMP is allowed to every listed CIDR, regardless of protocol or ports.

  • An empty rules array (cidrs: []) blocks all IP egress, including ICMP and traffic to the host.

  • ARP is blocked for all policies.

Limits

The same limit of 16384 units applies before and after normalization. Sum the number of ports across all rules, counting an empty or omitted port list (all ports) as 1. The limit covers the entire policy, across all IP versions and protocols. Duplicates count toward the limit before normalization. Exceeding the limit returns 400, even if normalization would remove redundant rules or ports.

Normalization

Before storage, duplicate rules and ports are removed, CIDRs are merged per protocol and port, and rules and ports are sorted. This preserves the allowed traffic. The response contains the normalized rules.

Policy identity

Equivalent normalized policies in the same namespace reuse the same UUID, including concurrent requests. The UUID is UUIDv5 derived from the namespace and the normalized policy hash. Resubmitting a deleted policy restores it without restoring its tags. To change the rules, create a new policy.

Arguments:
  • cidrs – NetworkPolicyCIDRRule[]

Returns:

Promise<NetworkPolicy>

ContreeClient.getNetworkPolicy(uuid)

GET /network/policies/{uuid} — Get a network policy

Returns an accessible policy, including deleted policies. Returns 404 if the policy does not exist. Requires spawn or spawn_disposable permission.

Arguments:
  • uuid – string — Network policy UUID Example: 12345678-9abc-baba-deda-0123456789ab.

Returns:

Promise<NetworkPolicy>

ContreeClient.deleteNetworkPolicy(uuid)

DELETE /network/policies/{uuid} — Remove a network policy

Removes a policy in your namespace. Requires network_policy permission. Returns 204 if the policy is removed or was already removed. Returns 404 if the policy does not exist in your namespace. Removes its tags and excludes it from listings. The policy remains accessible and usable by UUID, but cannot be assigned to tags.

Arguments:
  • uuid – string — Network policy UUID Example: 12345678-9abc-baba-deda-0123456789ab.

Returns:

Promise<null>

ContreeClient.listNetworkPolicyTags(options?)

GET /network/tags — List network policy tags

Returns your tags and shared tags, ordered by name. Your tag takes precedence when a shared tag has the same name. Requires spawn or spawn_disposable permission.

Arguments:
  • options.limit – number | null — Maximum number of results to return. Invalid values raise 400 error.

  • options.offset – number | null — Number of results to skip. Invalid values raise 400 error.

Returns:

Promise<ListNetworkPolicyTagsResponse>

ContreeClient.getNetworkPolicyTag(tag)

GET /network/tags/{tag} — Get a network policy tag

Redirects to the policy referenced by your tag, or the shared tag if you have no tag with that name. The redirect response includes the effective tag binding as JSON. Requires spawn or spawn_disposable permission. Returns 404 if the tag or its target policy does not exist or is removed.

Arguments:
  • tag – string — Network policy tag name

Returns:

Promise<NetworkPolicyTag>

ContreeClient.setNetworkPolicyTag(tag, uuid)

PUT /network/tags/{tag} — Bind a tag to a network policy

Creates or replaces your tag’s binding to an active policy in your namespace or the shared namespace. Repeating the same binding has no effect. Returns 404 if the target policy does not exist, is inaccessible, or is removed. The tag belongs to your namespace. Requires network_policy permission.

Arguments:
  • tag – string — Network policy tag name

  • uuid – string

Returns:

Promise<NetworkPolicyTag>

ContreeClient.deleteNetworkPolicyTag(tag)

DELETE /network/tags/{tag} — Remove a network policy tag

Removes your tag, including when operations use its policy. Repeated deletion succeeds. If a shared tag has the same name, it becomes visible again. Requires network_policy permission.

Arguments:
  • tag – string — Network policy tag name

Returns:

Promise<null>

ContreeClient.listImages(options?)

GET /images — List publicly available images

Returns a list of all publicly available container images.

Arguments:
  • options.limit – number | null — Maximum number of images to return. Must be between 1 and 1000. Default is 100. Invalid values raise 400 error.

  • options.offset – number | null — Number of images to skip before starting to collect the result set. Default is 0. Invalid values raise 400 error.

  • options.tagged – boolean — Example: 1.

  • options.tag – string | null — A valid image tag prefix to filter images by this prefix. Only images with tags starting with. Implies tagged parameter. Example: ubuntu.

  • options.uuid – string | null — Filter images by UUID Example: 12345678-9abc-baba-deda-0123456789ab.

  • options.since – string | number | Date | null — Show only results created after the given date/time or interval. Accepts a Unix timestamp or interval string. Interval format: 600s/15m/2h/3d/1w means 600 seconds, 15 minutes, 2 hours, 3 day, or 1 week ago respectively). For example: * 2025-01-01T12:00:00+00:00 means January 1st, 2025 at 12:00 UTC * 600s means 600 seconds ago * 15m means 15 minutes ago Invalid values raise 400 error. Example: 1w.

  • options.until – string | number | Date | null — Show only results created before the given date/time or interval. Accepts a Unix timestamp or interval string. Interval format: 600s/15m/2h/3d/1w means 600 seconds, 15 minutes, 2 hours, 3 day, or 1 week ago respectively). For example: * 2025-01-01T12:00:00+00:00 means January 1st, 2025 at 12:00 UTC * 600s means 600 seconds ago * 15m means 15 minutes ago Invalid values raise 400 error. Example: 1h.

Returns:

Promise<ImageListResponse>

ContreeClient.deleteImageTag(imageUuid, options?)

DELETE /images/{imageUUID}/tag — Remove tags from an image

Removes a tag (or all tags) from an image.

When tag query parameter is provided, only that specific tag is removed. When omitted, all tags are removed from the image.

If any public image has the same tag, tag will start tracking that public image again.

In all other cases tag will be removed and the image will be accessible only by its UUID.

Arguments:
  • imageUuid – string — The UUID of the image to untag Example: 12345678-9abc-baba-deda-0123456789ab.

  • options.tag – string | null — The tag to remove. If omitted, all tags are removed from the image. Example: busybox:latest.

Returns:

Promise<null>

ContreeClient.updateImageTag(imageUuid, tag)

PATCH /images/{imageUUID}/tag — Add a tag to an image

Adds a tag to an image. Tags are unique per namespace; if the requested tag is already assigned to another image, it will be moved to this image.

Assigning a tag that matches a public tag to a public image will freeze that tag to the current image - subsequent public updates to the tag will not affect it. To make the public tag track the latest public image again, remove your tag assignment.

When a tag is removed from an image that resides in the public namespace, the API returns HTTP 200 OK. response body contains the tag that now points to the public image (i.e., the image that the tag is automatically re-assigned to).

In other words, un-tagging a public image does not delete the tag; it simply moves the tag back to the public image and the caller receives that tag in the successful response.

Arguments:
  • imageUuid – string — The UUID of the image to update Example: 12345678-9abc-baba-deda-0123456789ab.

  • tag – string — New tag for the image Example: busybox:latest.

Returns:

Promise<Image>

ContreeClient.importImage(registry, options?)

POST /images/import — Import a container image from a registry

Imports the OCI image filesystem content of from a specified registry.

Important limitations and behavior:

  • Only the image root filesystem (files and directories) is imported. This is like to the output of docker export and does not preserve layers metadata.

  • Most image configuration and manifest data are ignored. Metadata such as LABEL, ENTRYPOINT, CMD, WORKDIR, EXPOSE and other image configuration directives will NOT be imported or applied.

  • ENV variables defined in the image are imported and automatically applied to the instance environment when shell is set to true. When shell is false, image environment variables are not inherited and must be passed explicitly via the env field.

  • The result is a flat rootfs snapshot with preserved environment variables.

  • If the specified tag already exists in the public images, the imported image will replace it. To avoid this, you can tag the existing image with a different tag for use it later. You also can use image UUIDs it is not changing for imported and existend image.

  • In case the remote image is unchanged and already imported, the operation will complete and the same UUID will be returned without re-importing the image.

The request creates an import operation which runs asynchronously.

Arguments:
  • registry – ImageImportRegistry

  • options.tag – string | null | undefined — Tag to identify the image when listing publicly available images. If omitted, the image will be private and only accessible by ID. Example: busybox:latest.

  • options.timeout – number | undefined — Maximum time in seconds to wait for the import operation to complete Example: 300.

Returns:

Promise<string>

ContreeClient.listFiles(options?)

GET /files — List uploaded files for the current namespace

Returns a paginated list of uploaded files for the current namespace.

Arguments:
  • options.limit – number | null — Maximum number of files to return

  • options.offset – number | null — Number of files to skip

  • options.since – string | number | Date | null — Filter files created after this time

  • options.until – string | number | Date | null — Filter files created before this time

Returns:

Promise<FilesListResponse>

ContreeClient.uploadFile(content)

POST /files — Upload a file to the server. the body must be a file content.

Uploads a file to the server. The body must contain the file content.

Arguments:
  • content – Uint8Array | Blob | ReadableStream<Uint8Array> — Raw file content: bytes or a binary stream.

Returns:

Promise<FileResponse>

ContreeClient.getFile(sha256)

GET /files/{sha256} — Get file info by SHA256

Returns file info (uuid, sha256, createdAt, updatedAt).

Arguments:
  • sha256 – string — SHA256 hash of the file (64 hex characters)

Returns:

Promise<File>

ContreeClient.checkFileExists(sha256)

HEAD /files/{sha256} — Check if a file exists for the current namespace

Returns 200 if the file is uploaded by the current namespace, otherwise 404.

Arguments:
  • sha256 – string — SHA256 hash of the file (64 hex characters)

Returns:

Promise<boolean>

ContreeClient.spawnInstance(command, image, options?)

POST /instances — Spawn a new container instance

Creates and runs a new execution instance with the specified configuration. Requires a valid Authorization header.

Common request body rules:

  • The request body must contain at least command and image fields all other fields can be omitted.

  • If the command field is a shell expression, you must set shell field to true.

  • For specifying the shell binary, you can use env field to set SHELL variable.

  • When shell is true, environment variables defined in the image (via ENV directives) are automatically inherited. When shell is false, image environment variables are not inherited and must be passed explicitly via the env field.

Arguments:
  • command – string — The command to execute. In case if shell is set to true, this MUST contain shell expression. For example echo hello world or ls -l /app. If shell is set to false, this must be a relative or absolute path to the executable inside the image rootfs. For example: /bin/app or /usr/bin/find. Do not forget pass necessary PATH variable to env field, by default PATH is set to /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin. Example: /bin/app.

  • image – string

  • options.disposable – boolean | undefined — Creates a disposable execution environment no any state will be saved.

  • options.hostname – string | undefined — Hostname to set when execution. Example: container-name.

  • options.args – string[] | undefined — Arguments to pass to the command if shell is set to false. Example: ["arg1","arg2"].

  • options.shell – boolean | undefined — Whether to run the command through a shell. If true, the command must be a shell expression and all values from args will be ignored. If false, the command field must be a path to an executable and args will be used. When true, environment variables from the image are automatically inherited. When false, they are not - use the env field to pass them explicitly.

  • options.env – Record<string, string> | null | undefined — Environment variables to set in the container. These are merged with image-defined variables when shell is true. When shell is false, only variables specified here are available - image-defined variables are not inherited. Example: {"KEY1":"value1","KEY2":"value2"}.

  • options.preserveEnv – boolean | undefined — Preserve environment variables in resulting image after execution. When true, the image’s existing environment variables from metadata/env are merged with user-provided env values (user values take priority on conflicts), and the combined result is written back to metadata/env after command execution. Setting a variable to an empty string or null removes it from the preserved environment.

  • options.preserveCwd – boolean | undefined — Save the resolved initial working directory as the default in the resulting image. An empty or omitted cwd resolves to the image’s current workdir, or / if none exists. The metadata file is opened for writing only when its contents differ from the new value. Directory changes made by the command do not change the saved value. Requires disposable: false to retain the metadata in a resulting image.

  • options.cwd – string | undefined — Path to the working directory, must be absolute or a special value the empty string. It means the default working directory of the image or server default will be used. If field is omitted it will be set to the empty string. The directory will be created automatically if it does not exist. Example: /app.

  • options.uid – number | undefined — User ID to run the process as. Example: 0.

  • options.gid – number | undefined — Group ID to run the process as. Example: 0.

  • options.resourcesLimits – InstanceResourcesLimits | undefined

  • options.networking – InstanceNetworking | undefined

  • options.stdin – ClosableStreamRepr | undefined

  • options.timeout – number | undefined — Maximum execution time in seconds Example: 60.

  • options.truncateOutputAt – number | undefined — Maximum number of bytes to keep per stream (stdout, stderr, and stdin) in the subprocess event log. Does not affect stdin delivery to the child, which always receives the complete stream regardless of this cap. Default is 1048576 (1 MiB). The maximum value is 10485760 (10 MiB). Example: 65535.

  • options.files – Record<string, FileSpec> | undefined — Map of absolute file paths to file metadata Example: {"/root/hello.txt":{"uuid":"a9165a5d-5c86-4bd8-8ee4-ae46c....

Returns:

Promise<InstanceSpawnResponse>

ContreeClient.listOperations(options?)

GET /operations — List operations

Returns a list of running and completed operations

Arguments:
  • options.limit – number | null — Maximum number of operations to return. Must be between 1 and 1000. Default is 100. Invalid values raise 400 error.

  • options.offset – number | null — Number of operations to skip before starting to collect the result set. Default is 0. Invalid values raise 400 error.

  • options.status – OperationStatus | string | null — Filter operations by their state

  • options.kind – "image_import" | "instance" | null — Filter operations by their kind

  • options.since – string | number | Date | null — Show only results created after the given date/time or interval. Accepts a Unix timestamp or interval string. Interval format: 600s/15m/2h/3d/1w means 600 seconds, 15 minutes, 2 hours, 3 day, or 1 week ago respectively). For example: * 2025-01-01T12:00:00+00:00 means January 1st, 2025 at 12:00 UTC * 600s means 600 seconds ago * 15m means 15 minutes ago Invalid values raise 400 error. Example: 1w.

  • options.until – string | number | Date | null — Show only results created before the given date/time or interval. Accepts a Unix timestamp or interval string. Interval format: 600s/15m/2h/3d/1w means 600 seconds, 15 minutes, 2 hours, 3 day, or 1 week ago respectively). For example: * 2025-01-01T12:00:00+00:00 means January 1st, 2025 at 12:00 UTC * 600s means 600 seconds ago * 15m means 15 minutes ago Invalid values raise 400 error. Example: 1h.

Returns:

Promise<OperationSummary[]>

ContreeClient.getOperationStatus(operationId, options?)

GET /operations/{operationId} — Get an operation status

Returns the status of an operation.

For an EXECUTING INSTANCE operation, pass ?inflight=1 to also synthesize the partial result.stdout / result.stderr from the live event log. Off by default — each fetch with inflight triggers an extra subscribe RPC to the guest and drains its current events.gz, which is wasted work for clients that only poll for status transitions.

Arguments:
  • operationId – string — The ID of the operation Example: 12345678-9abc-baba-deda-0123456789ab.

  • options.inflight – boolean — HTTP-flag boolean. Present without a value (?inflight) and ?inflight=1 both enable; ?inflight=0 and absence disable. When enabled and the operation is EXECUTING INSTANCE, partial stdout/stderr is synthesized from the live event log and attached under result.

Returns:

Promise<OperationResponse>

ContreeClient.cancelOperation(operationId)

DELETE /operations/{operationId} — Cancel an operation

Cancels an operation

Arguments:
  • operationId – string — The ID of the import operation to cancel Example: 12345678-9abc-baba-deda-0123456789ab.

Returns:

Promise<null>

ContreeClient.iterOperationEvents(operationId, options?)

GET /operations/{operationId}/events — Stream the operation event log via Server-Sent Events

Always returns text/event-stream (SSE) on success. The body is a sequence of three kinds of lines (per RFC W3C SSE), each terminated by \n\n:

Frame shapes

Normal event frame — one OperationEvent JSON object in data:, dispatchable via event::

id: <integer event.id>
event: <OperationEventType, e.g. stdout|stderr|spawn|exit>
data: {"id": N, "ts": "...", "spid": ..., "type": "...", "data": {...}}

event: always matches data.type. See OperationEvent and OperationEventType for the per-type payload shape. Native EventSource dispatches each frame to the matching addEventListener("<type>", ...) handler.

Server-side error frame — surfaces handler exceptions to the connected client without tearing the TCP connection down mid-stream. Sent right before the server closes the response:

: stream ended with error, retry since last event id

event: sse_error
data: <one-line exception message>

The leading SSE comment line lets pure-EventSource clients see the intent (“retry from Last-Event-Id”); the sse_error frame carries the error text for logging. Clients should treat this as a non-clean close and reconnect with the standard SSE Last-Event-Id semantics (see Resuming).

Keepalive comment — periodic : keepalive\n\n lines emitted while the stream is idle. They keep upstream proxy_read_timeout / TCP idle timers fresh and have no application meaning. Spec-compliant; EventSource and any SSE parser must ignore comment lines (those beginning with :).

follow semantics

The follow parameter controls only whether the stream stays open after the last currently-known event:

  • follow=0 (default) — the server emits everything currently available and closes the connection.

  • follow=1 — same start; if the operation is still running the server keeps the connection open and forwards new events as they appear. For terminal operations follow=1 is a no-op: there’s nothing more to subscribe to, so the connection closes after the last event just like follow=0.

Optional filters:

  • ?spid=N — only events whose spid (Spawned Process ID, the routing identity in OperationEvent) matches.

  • ?since=N — only events with id > N.

follow=1 requires SPAWN or SPAWN_DISPOSABLE on top of the baseline LIST — a long-lived subscription reserves per-operation server state. follow=0 is read-only and stays under LIST.

Resuming after a drop

Every normal frame carries id: — the canonical event id. On reconnect send the last successfully received id in the standard Last-Event-Id request header (or ?since=N on manual GETs); the server resumes from that point.

Error handling

Status

Meaning

Client action

200

Stream open

Read frames; reconnect with Last-Event-Id if the stream closes before reaching a terminal event

400

Malformed query/header (non-integer param)

Fix request

401

Missing/invalid auth

Refresh credentials

403

Auth lacks LIST (or SPAWN for follow=1)

Use a token with the right scope

404

Operation not in this namespace

Wrong UUID

410

Stream is over but the terminal artifact isn’t ready yet

Retry after Retry-After

425

Not yet ready (operation is still being prepared)

Retry after Retry-After

502

Upstream returned an error opening the stream

Retry; if persistent, escalate

504

Upstream took too long to respond

Retry

A 200 followed by an event: sse_error frame and immediate close is the in-band equivalent of “the stream broke after we already committed to a 200” — handle it the same way as 410: wait briefly, reconnect with Last-Event-Id.

See OperationEvent for the per-event shape.

Arguments:
  • operationId – string — The ID of the operation Example: 12345678-9abc-baba-deda-0123456789ab.

  • options.follow – boolean — HTTP-flag boolean. Present without a value (?follow) and ?follow=1 both enable; ?follow=0 and absence disable. When enabled, the SSE stream stays open after the currently-known events have been sent — for a running operation new events are forwarded as they appear; for a terminal operation it has no effect.

  • options.spid – number | null — Only emit events whose spid field matches. Filter is applied server-side regardless of whether the operation is still running or already terminal.

  • options.since – number | null — Only emit events with id > since (event IDs are monotonically increasing). Overridden by the Last-Event-Id header when present.

  • options.lastEventId – number | null — Standard SSE resume header sent automatically by EventSource on reconnect. Treated as ?since=N; takes precedence over the query param.

Returns:

AsyncGenerator<OperationEvent>

ContreeClient.operationSubprocessCreate(operationId, command, options?)

POST /operations/{operationId}/subprocesses — Spawn an additional subprocess inside a running instance

Starts a new process inside the VM that already hosts the named operation. Distinct from POST /instances, which spins up a VM: this endpoint requires a running operation (EXECUTING or ASSIGNED) and reuses the existing VM.

The body is an ExecSpec — process-execution fields only. VM-level concerns (image, hostname, files, timeout, disposable, preserveEnv) are not accepted here; they were set when the parent operation was created.

resourcesLimits.cpu and resourcesLimits.memoryMib use the same names and units as operation creation. Each omitted or null subprocess limit inherits the corresponding operation limit. Values above the operation limit return 400. Limits apply at launch: memoryMib sets RLIMIT_AS for each process and memory.max for the entire process tree. They cannot be changed through this API. Guest root can modify limits; these limits do not provide security isolation between processes in one VM.

The required permission follows the parent instance: SPAWN_DISPOSABLE when it was spawned with disposable=true, SPAWN otherwise.

On success the worker assigns a fresh spid (≥2; spid=1 is the main process spawned from metadata) and the response carries it in the body plus a Location header pointing at GET /operations/{operationId}/subprocesses/{spid} — the subprocess result reconstructed from its events.

Arguments:
  • operationId – string — The ID of the operation Example: 12345678-9abc-baba-deda-0123456789ab.

  • command – string — The command to execute. Same semantics as in InstanceSpawnRequest.command — when shell=true it is a shell expression, otherwise a path to an executable. Example: /bin/app.

  • options.resourcesLimits – ProcessResourcesLimits | undefined

  • options.args – string[] | undefined — Arguments to pass to the command if shell is set to false. Example: ["arg1","arg2"].

  • options.shell – boolean | undefined — Run command through a shell expression (args must be empty).

  • options.env – Record<string, string> | null | undefined — Environment variables to set in the child process.

  • options.cwd – string | undefined — Working directory; empty string means image / server default.

  • options.uid – number | undefined — User ID to run the process as.

  • options.gid – number | undefined — Group ID to run the process as.

  • options.stdin – ClosableStreamRepr | undefined — Bytes fed to the child’s stdin — honored for both the main process and exec’d subprocesses. With close=false the pipe stays open and more data can be written via POST /operations/{operationId}/subprocesses/{spid}/stdin.

  • options.truncateOutputAt – number | undefined — Maximum number of bytes to keep per stream (stdout, stderr, and stdin) in the subprocess event log. Does not affect delivery to the child — stdin is always delivered in full regardless of this cap. Defaults to 1 MiB; capped at 10 MiB. Example: 65535.

Returns:

Promise<number>

ContreeClient.operationSubprocess(operationId, spid)

GET /operations/{operationId}/subprocesses/{spid} — Result of one subprocess, reconstructed from its events

Returns an InstanceResult for spid — the same shape as the parent operation’s metadata.result — folded from the subprocess’s event log (spawn / stdout / stderr / exit). Works for running and terminal operations alike. While the process is still running, state.exitCode and state.signal are -1 (unknown) and resources holds sentinel defaults; once the exit event lands they carry the real values.

stdout / stderr are consolidated and capped at the spec’s truncateOutputAt. The raw event stream stays available at GET /operations/{operationId}/events?spid={spid}.

Arguments:
  • operationId – string — The ID of the operation Example: 12345678-9abc-baba-deda-0123456789ab.

  • spid – number — Spawn id (1 = main process; ≥2 = exec’d children).

Returns:

Promise<InstanceResult>

ContreeClient.operationSubprocessKill(operationId, spid, options?)

DELETE /operations/{operationId}/subprocesses/{spid} — Kill one subprocess

Sends a signal to the process group of spid inside the running instance. Without the signal parameter the group gets SIGKILL. Termination is observable, not returned: the exit event lands in the event log and GET /operations/{operationId}/subprocesses/{spid} reports the terminal state (signal set, exitCode -1 when killed).

Killing spid=1 (the main process) effectively ends the operation, like letting the command fail.

Arguments:
  • operationId – string — The ID of the operation Example: 12345678-9abc-baba-deda-0123456789ab.

  • spid – number — Spawn id (1 = main process; ≥2 = exec’d children).

  • options.signal – string | null — Signal to send instead of SIGKILL — a number (15) or a name with or without the SIG prefix (TERM, SIGTERM). Example: SIGTERM.

Returns:

Promise<null>

ContreeClient.operationSubprocessStdin(operationId, spid, value, options?)

POST /operations/{operationId}/subprocesses/{spid}/stdin — Write to a subprocess’s stdin and/or close it

Writes a chunk to the stdin of a live process inside the running instance — spid=1 targets the main process, ≥2 the exec’d children. Requires the process to have been started with stdin.close=false; otherwise its pipe is already at EOF and the call returns 409.

close=true (the default) signals EOF after writing value; an empty value with close=true just closes the pipe. A client that serializes its own requests gets ordered writes; concurrent requests to the same spid are safe but their order is unspecified.

A 504 means the guest write timed out mid-call — the chunk may or may not have been delivered (e.g. the process stopped reading and the pipe is full), so blind retries can duplicate data.

Arguments:
  • operationId – string — The ID of the operation Example: 12345678-9abc-baba-deda-0123456789ab.

  • spid – number — Spawn id (1 = main process; ≥2 = exec’d children).

  • value – string — Content to write to stdin (may be empty for a close-only request) Example: aGVsbG8K.

  • options.encoding – "ascii" | "base64" | undefined — Encoding of the content

  • options.close – boolean | undefined — true (default) closes stdin (EOF) after writing value — the pre-existing one-shot behavior. false keeps the pipe open so more data can be sent later via POST /operations/{operationId}/subprocesses/{spid}/stdin.

Returns:

Promise<null>

ContreeClient.applyInstanceFile(operationUuid, fileUuid, path, options?)

POST /operations/{operation_uuid}/files — Apply an uploaded file to a running instance

Reads a file previously uploaded through POST /files and writes it to a running INSTANCE operation, including disposable instances. Requires LIST and the permission used to start the instance. Both the operation and the uploaded file must belong to the request namespace. Expired files are unavailable. The assigned worker streams the stored object to the guest through RPC. Init records request metadata in inspect events and the terminal publication result in file_upload, including fileUuid and byte count. File contents do not enter operation events.

With unpack omitted or false, path is the full destination filename. Missing parent directories are created. The file is published atomically after transfer and SHA256 verification. The new file has mode 0644 and is owned by the guest runtime user. With replace true, an existing leaf symlink is replaced. Directories and special files are not regular file destinations.

With unpack true, path is the destination directory. Supports tar, tar.gz and tar.bz2; compression is detected from the stored bytes. Xz is unsupported and rejected before subsequent chunks are sent. Without unpack, compressed archives are copied unchanged. Content-Type describes this JSON request and never controls extraction.

Extraction accepts regular files, directories, symlinks and hardlinks to regular files already extracted in the staging tree. Parent symlinks inside that tree are not followed. Absolute entry names and entries containing ‘..’ are rejected. procfs, sysfs, devices, FIFOs and sockets are unsupported. New directories have mode 0755; regular files retain tar permission bits (0777). Ownership and timestamps are not restored. Other entries fail explicitly. With replace omitted or false, any existing destination returns 409, including a symlink or empty directory. This condition is checked again atomically at publication. replace true permits an existing destination. With merge omitted or false, directory replacement removes the entire old tree without merging contents.

Archives are extracted into a temporary sibling directory. The destination remains unchanged until the complete stream and SHA256 have been verified. Without merge, publication uses an atomic rename or exchange, then removes the old tree. Root and mount-point replacement are unavailable. Existing open descriptors can still refer to old inodes; concurrent workload access is not a snapshot.

merge true requires both unpack true and replace true. After complete staging and verification, it combines directories and atomically replaces individual files and symlinks. Existing entries absent from the archive remain. Destination directory symlinks are not followed; directory/file conflicts fail explicitly. Same-filesystem hardlinks are retained. Crossing a destination mount requires copying file bytes and does not preserve hardlinks across filesystems. Merge is not atomic for the whole tree: errors, cancellation or timeout after application starts can leave completed changes. These changes are not rolled back.

Returns 204 only after completion. Transfers have a 300-second deadline and bounded buffers and handles. Disconnect or VM exit cancels the transfer. A lost response can leave an uncertain outcome; requests are not replayed automatically. This endpoint does not write to a completed result image.

A transfer timeout does not stop the instance. Before publication or merge starts, cancellation preserves the old destination and removes the temporary file or extraction tree. A timeout while awaiting the final response can occur after publication; it does not prove that no changes were made. An old-tree cleanup failure is reported as an error after publication; it does not roll back the new tree. The uploaded source object retains its normal lifetime. Automatically created parent directories have mode 0755 and can remain after errors.

The primary command’s timeout follows normal instance finalization: ordinary instances persist their filesystem, including successfully published uploads; disposable instances do not. Instance shutdown waits for pending upload cleanup. A timeout or crash of the execution environment can bypass this cleanup and does not produce a successfully persisted result image through normal finalization.

Arguments:
  • operationUuid – string — Example: 12345678-9abc-baba-deda-0123456789ab.

  • fileUuid – string

  • path – string — Absolute guest filename, or directory when unpack is true. Missing parents are created.

  • options.unpack – boolean | undefined — Extract tar, tar.gz or tar.bz2 instead of copying the stored bytes.

  • options.replace – boolean | undefined — Permit an existing destination. Without merge, directories are replaced in full.

  • options.merge – boolean | undefined — Merge verified archive contents. Requires unpack and replace. Can leave partial changes.

Returns:

Promise<null>

ContreeClient.inspectInstanceDownload(operationUuid, path)

GET /operations/{operation_uuid}/inspect/download — Download a file from a running instance

Reads through guest RPC without recording file contents in operation events. Requires LIST and the permission used to start this instance (SPAWN or SPAWN_DISPOSABLE). Reads include tmpfs and additional mounts visible to the guest runtime. procfs, sysfs, devices, sockets, and FIFOs are unavailable. Reads do not form a snapshot. The opened inode and initial size are used; later growth is excluded. Truncation or VM exit interrupts the response. A transfer has a 300-second deadline. No result-image fallback is performed.

Arguments:
  • operationUuid – string — The UUID of the running instance to inspect Example: 12345678-9abc-baba-deda-0123456789ab.

  • path – string — The path of the file to inspect inside the running instance, e.g. /etc/hosts

Returns:

Promise<Uint8Array>

ContreeClient.inspectInstanceDownloadStream(operationUuid, path)

Streaming variant of ContreeClient.inspectInstanceDownload().

Returns:

AsyncGenerator<Uint8Array>

ContreeClient.checkInstanceFile(operationUuid, path)

HEAD /operations/{operation_uuid}/inspect/download — Check if a file exists in running instance

Checks if a file exists in the specified running instance without returning the file content

Arguments:
  • operationUuid – string — The UUID of the running instance to inspect Example: 12345678-9abc-baba-deda-0123456789ab.

  • path – string — The path of the file to check inside the running instance, e.g. /etc/hosts

Returns:

Promise<boolean>

ContreeClient.inspectInstanceList(operationUuid, path)

GET /operations/{operation_uuid}/inspect/list — List files in running instance

Lists guest files without recording contents in operation events. Requires LIST and the permission used to start this instance. Reads do not form a snapshot. A directory can contain at most 10000 entries. procfs and sysfs cannot be listed.

Arguments:
  • operationUuid – string — The UUID of the running instance to inspect Example: 12345678-9abc-baba-deda-0123456789ab.

  • path – string — The path of the directory to inspect inside the running instance Example: /etc.

Returns:

Promise<DirectoryList>

ContreeClient.inspectInstanceArchive(operationUuid, path)

GET /operations/{operation_uuid}/inspect/archive — Download a file or a directory from running instance as tar archive

Streams the specified path inside the running instance root filesystem as a POSIX PAX tar archive. A directory becomes the archive root; a regular file becomes a single-entry archive. The response is chunked; total size is not known upfront. Served as an attachment, filename is the path with / replaced by _ plus .tar (e.g. /bin/true -> bin_true.tar). Requires LIST and the permission used to start this instance. Contents do not enter operation events. Reads do not form a snapshot. Traversal skips procfs and sysfs and preserves descendant symlinks. File changes or VM exit can interrupt the stream. Transfers have a 300-second deadline.

Arguments:
  • operationUuid – string — The UUID of the running instance to inspect Example: 12345678-9abc-baba-deda-0123456789ab.

  • path – string — The path of the file or directory to archive inside the running instance, e.g. /etc

Returns:

AsyncGenerator<Uint8Array>

ContreeClient.checkInstanceArchive(operationUuid, path)

HEAD /operations/{operation_uuid}/inspect/archive — Check if a path can be archived from running instance

Checks if a file or a directory exists in the specified running instance without streaming the archive

Arguments:
  • operationUuid – string — The UUID of the running instance to inspect Example: 12345678-9abc-baba-deda-0123456789ab.

  • path – string — The path of the file or directory to check inside the running instance, e.g. /etc

Returns:

Promise<boolean>

ContreeClient.inspectFindImageByTag(tag)

GET /inspect/ — Find image by tag

Redirects to the image inspection endpoint for the specified tag

Arguments:
  • tag – string — The tag of the image to inspect

Returns:

Promise<string>

ContreeClient.inspectImage(imageUuid)

GET /inspect/{image_uuid}/ — Inspect an image

Returns image metadata

Arguments:
  • imageUuid – string — The UUID of the image to inspect Example: 12345678-9abc-baba-deda-0123456789ab.

Returns:

Promise<Image>

ContreeClient.inspectImageDownload(imageUuid, path)

GET /inspect/{image_uuid}/download — Download a file from image

Returns file content

Arguments:
  • imageUuid – string — The UUID of the image to inspect Example: 12345678-9abc-baba-deda-0123456789ab.

  • path – string — The path of the file to inspect inside the image, e.g. /etc/hosts

Returns:

Promise<Uint8Array>

ContreeClient.inspectImageDownloadStream(imageUuid, path)

Streaming variant of ContreeClient.inspectImageDownload().

Returns:

AsyncGenerator<Uint8Array>

ContreeClient.checkImageFile(imageUuid, path)

HEAD /inspect/{image_uuid}/download — Check if a file exists in image

Checks if a file exists in the specified image without returning the file content

Arguments:
  • imageUuid – string — The UUID of the image to inspect Example: 12345678-9abc-baba-deda-0123456789ab.

  • path – string — The path of the file to check inside the image, e.g. /etc/hosts

Returns:

Promise<boolean>

ContreeClient.inspectImageArchive(imageUuid, path)

GET /inspect/{image_uuid}/archive — Download a file or a directory from image as tar archive

Streams the specified path inside the image root filesystem as a POSIX PAX tar archive. A directory becomes the archive root; a regular file becomes a single-entry archive. The response is chunked; total size is not known upfront. Served as an attachment, filename is the path with / replaced by _ plus .tar (e.g. /bin/true -> bin_true.tar).

Arguments:
  • imageUuid – string — The UUID of the image to inspect Example: 12345678-9abc-baba-deda-0123456789ab.

  • path – string — The path of the file or directory to archive inside the image, e.g. /etc

Returns:

AsyncGenerator<Uint8Array>

ContreeClient.checkImageArchive(imageUuid, path)

HEAD /inspect/{image_uuid}/archive — Check if a path can be archived from image

Checks if a file or a directory exists in the specified image without streaming the archive

Arguments:
  • imageUuid – string — The UUID of the image to inspect Example: 12345678-9abc-baba-deda-0123456789ab.

  • path – string — The path of the file or directory to check inside the image, e.g. /etc

Returns:

Promise<boolean>

ContreeClient.inspectImageList(imageUuid, path)

GET /inspect/{image_uuid}/list — List files in image

Returns files list

Arguments:
  • imageUuid – string — The UUID of the image to inspect Example: 12345678-9abc-baba-deda-0123456789ab.

  • path – string — The path of the directory to inspect inside the image Example: /etc.

Returns:

Promise<DirectoryList>

ContreeClient.inspectInstanceGrep(operationUuid, pattern, options?)

GET /operations/{operation_uuid}/inspect/grep — Search file contents in running instance

Regex content search inside the running instance’s root filesystem, through guest RPC. A Go converter translates supported Rust regex syntax to Go regexp.

Symlinks are never followed during traversal, hidden files are searched, .ignore and .gitignore rules within each search root are respected. A NUL byte in the first 64 KiB causes a file to be skipped; a later NUL ends that file’s search. Go regexp uses linear-time matching. The classes w/W, d/D, and s/S use Unicode semantics. Unicode properties and case folding are pinned to Unicode 16.0.0, matching the image engine. Scoped flags, nested class set operations, and bounded expansion of large repetitions are supported. Expanded patterns share a 1 MiB limit per request. Unsupported syntax returns 400 with a pattern index and byte offset. Unicode b/B, CRLF mode, non-ASCII byte mode, and Q…E are rejected. Use (?-u:b) for an ASCII word boundary. Smart case examines parsed literals.

Results are a flat, file-ordered list of lines. before/after request extra type: context lines around each type: match line, mirroring ripgrep’s –json message type field.

path may be repeated to search multiple roots in one call, the same way pattern/glob already can; results are concatenated in the given order and share the maxTotal budget across all of them. Results never enter operation events. Reads are live and do not form a snapshot. procfs, sysfs, devices, sockets, and FIFOs are not searched. Requires LIST and the permission used to start this instance. Searches have a 10-second budget per root and permit two concurrent searches per instance. Reaching the time, depth, or result limit sets truncated. Context lines count towards maxTotal. Display text is limited to 4096 bytes per line; matching can continue beyond this window.

Arguments:
  • operationUuid – string — The UUID of the running instance to inspect Example: 12345678-9abc-baba-deda-0123456789ab.

  • pattern – string | readonly string[] — Regex pattern to search for. May be repeated (max 16); patterns are OR-ed. Max 1024 characters each. Example: ^PermitRootLogin.

  • options.path – string | readonly string[] | null — File or directory to search inside the running instance. May be repeated (max 16) to search multiple roots; results are concatenated in the given order, sharing maxTotal across all paths. Defaults to the rootfs root. Example: /etc.

  • options.glob – string | readonly string[] | null — Glob to filter files (ripgrep -g semantics, “!” negates). May be repeated. Example: *.conf.

  • options.maxCount – number | null — Maximum matches per file (hard cap 10000).

  • options.maxTotal – number | null — Maximum total matches across all files (default 1000, hard cap 10000).

  • options.case – "sensitive" | "insensitive" | "smart" | null — Case sensitivity mode.

  • options.before – number | null — Lines of context to include before each match (ripgrep -B semantics, hard cap 50). For symmetric context (grep -C n), pass both before and after yourself.

  • options.after – number | null — Lines of context to include after each match (ripgrep -A semantics, hard cap 50).

Returns:

Promise<GrepResult>

ContreeClient.inspectImageGrep(imageUuid, pattern, options?)

GET /inspect/{image_uuid}/grep — Search file contents in image

Regex content search inside the image’s root filesystem, powered by ripgrep.

Symlinks are never followed during traversal, hidden files are searched, .gitignore-style files inside the image are ignored, and binary files (containing a NUL byte) are skipped. Rust regex syntax, linear-time matching.

Results are a flat, file-ordered list of lines. before/after request extra type: context lines around each type: match line, mirroring ripgrep’s –json message type field.

path may be repeated to search multiple roots in one call, the same way pattern/glob already can; results are concatenated in the given order and share the maxTotal budget across all of them.

Arguments:
  • imageUuid – string — The UUID of the image to inspect Example: 12345678-9abc-baba-deda-0123456789ab.

  • pattern – string | readonly string[] — Regex pattern to search for. May be repeated (max 16); patterns are OR-ed. Max 1024 characters each. Example: ^PermitRootLogin.

  • options.path – string | readonly string[] | null — File or directory to search inside the image. May be repeated (max 16) to search multiple roots; results are concatenated in the given order, sharing maxTotal across all paths. Defaults to the rootfs root. Example: /etc.

  • options.glob – string | readonly string[] | null — Glob to filter files (ripgrep -g semantics, “!” negates). May be repeated. Example: *.conf.

  • options.maxCount – number | null — Maximum matches per file (hard cap 10000).

  • options.maxTotal – number | null — Maximum total matches across all files (default 1000, hard cap 10000).

  • options.case – "sensitive" | "insensitive" | "smart" | null — Case sensitivity mode.

  • options.before – number | null — Lines of context to include before each match (ripgrep -B semantics, hard cap 50). For symmetric context (grep -C n), pass both before and after yourself.

  • options.after – number | null — Lines of context to include after each match (ripgrep -A semantics, hard cap 50).

Returns:

Promise<GrepResult>

ContreeClient.whoami()

GET /whoami — Get current token information

Returns information about the current authentication token, including the token UUID, expiration time, and a map of all known permissions with their granted status.

Returns:

Promise<WhoAmIResponse>

Helpers

ContreeClient.waitOperation(operationId, options?)

Uses instance events or polls image imports and returns the terminal response.

Arguments:
  • operationId – string

  • options.followEvents – boolean | null — default null selects by operation kind; true forces events and false forces polling.

  • options.timeout – number | null — bounds the whole wait in seconds, idle streams included; expiry rejects with a TimeoutError DOMException.

  • options.idleTimeout – number — seconds without incoming data before reconnecting; default 15. Ping frames reset it. Set 0 to disable it.

Returns:

Promise<OperationResponse>

ContreeClient.followOperationEvents(operationId, options?)

ContreeClient.iterOperationEvents() with follow: true and transparent reconnection: network drops, transport timeouts, in-band sse_error frames and retryable statuses (410/425/5xx) resume from the last received event id. Non-retryable HTTP statuses stop recovery and raise APIConnectionError with the status error as its cause. After terminal status, reads retained events with follow: false, keeping the cursor, filters, original deadline, and inactivity timeout. An unfiltered log must include completion. A filtered or explicitly resumed log may end at clean EOF. Incomplete or unavailable logs raise APIConnectionError. Interrupted retained reads use the configured RetryPolicy statuses, delays, and maxAttempts, or three attempts by default. Cancellation and malformed event data propagate without retry.

Arguments:
  • operationId – string

  • options.lastEventId – number | null

  • options.spid – number | null

  • options.since – number | null

  • options.timeout – number | null — overall deadline in seconds; expiry throws a TimeoutError DOMException.

  • options.idleTimeout – number — seconds without incoming data before reconnecting; default 15. Ping frames reset it. Set 0 to disable it.

Returns:

AsyncGenerator<OperationEvent>

ContreeClient.resolveImage(ref)

Resolves a UUID, tag:NAME or bare tag to the image UUID.

Arguments:
  • ref – string

Returns:

Promise<string>

ContreeClient.ensureFile(content, options?)

Uploads content unless the server already stores it: the sha256 (options.sha256 when known, computed locally otherwise) is probed via ContreeClient.getFile(), only a miss uploads. A ReadableStream cannot be hashed and replayed, so it skips deduplication.

Arguments:
  • content – Uint8Array | string | Blob | ReadableStream<Uint8Array>

  • options.sha256 – string | null

Returns:

Promise<FileResponse | File>

ContreeClient.iterImages(options?)

Lazy offset pagination over ContreeClient.listImages(): the listing filters plus pageSize (server-capped) and limit (total records; null iterates everything). Breaking out of the loop stops fetching. iterOperations() and iterFiles() mirror it for their listings.

Returns:

AsyncGenerator<Image>

Statuses and events

Operation statuses are wire strings: PENDING, ASSIGNED, EXECUTING, SUCCESS, FAILED, CANCELLED. Terminal: SUCCESS, FAILED, CANCELLED — membership via TERMINAL_STATUSES / ACTIVE_STATUSES sets or isTerminalStatus(status).

Event types: init, spawn, stdin, stdout, stderr, exit, truncated, size_cap, network, shutdown, inspect, file_upload, completion; each maps to its EventData* payload class below, unknown payloads stay plain objects (parseEventData).

Models

class FileItem(fields?)
FileItem.FileItem.size

number (required) — File size in bytes Example: 1024.

FileItem.FileItem.path

string (required) — File name (relative to the directory being listed) Example: passwd.

FileItem.FileItem.owner

string | number (required) — File owner name or UID Example: root.

FileItem.FileItem.group

string | number (required) — File group name or GID Example: root.

FileItem.FileItem.uid

number (required) — User ID of the file owner Example: 0.

FileItem.FileItem.gid

number (required) — Group ID of the file Example: 0.

FileItem.FileItem.mode

number (required) — File mode/permissions as integer (octal representation) Example: 33188.

FileItem.FileItem.mtime

number (required) — Last modification time as Unix timestamp Example: 1640995200.

number (required) — Number of hard links Example: 1.

FileItem.FileItem.isDir

boolean (required) — True if the item is a directory Example: false.

FileItem.FileItem.isRegular

boolean (required) — True if the item is a regular file Example: true.

boolean (required) — True if the item is a symbolic link Example: false.

FileItem.FileItem.isSocket

boolean (required) — True if the item is a socket Example: false.

FileItem.FileItem.isFifo

boolean (required) — True if the item is a FIFO/named pipe Example: false.

FileItem.FileItem.symlinkTo

string (required) — Target path if the item is a symbolic link, empty string otherwise

class DirectoryList(fields?)
DirectoryList.DirectoryList.path

string (required) — The directory path that was listed Example: /etc.

DirectoryList.DirectoryList.files

FileItem[] (required) — List of files and directories in the specified path

asText(short = false) formats an ls -l-style table; pass the boolean true for paths only.

toString() delegates to asText() with the default format.

class GrepSubmatch(fields?)
GrepSubmatch.GrepSubmatch.text

string (required) — The matched text Example: PermitRootLogin.

GrepSubmatch.GrepSubmatch.start

number (required) — Byte offset of the match start within the line Example: 1.

GrepSubmatch.GrepSubmatch.end

number (required) — Byte offset of the match end within the line Example: 16.

class GrepMatch(fields?)
GrepMatch.GrepMatch.path

string (required) — File path relative to the image rootfs Example: /etc/ssh/sshd_config.

GrepMatch.GrepMatch.lineNumber

number (required) — 1-based line number of the match Example: 57.

GrepMatch.GrepMatch.absoluteOffset

number (required) — Byte offset of the line from the start of the file Example: 1712.

GrepMatch.GrepMatch.lineText

string (required) — The matching line, including the line terminator (truncated at 4096 bytes) Example: #PermitRootLogin prohibit-password.

GrepMatch.GrepMatch.lineBytes

number (required) — Real byte length of the matching line; greater than lineText length when the line was capped Example: 8192.

GrepMatch.GrepMatch.submatches

GrepSubmatch[] (required) — Empty for context lines (they carry no submatches)

GrepMatch.GrepMatch.type

"match" | "context" (required) — Mirrors ripgrep’s –json message type: “match” is an actual match, “context” is a before/after context line requested via before/after. Example: match.

asText() formats one grep row, using - separators for context rows.

toString() delegates to asText() with the default format.

class GrepResult(fields?)
GrepResult.GrepResult.path

string (required) — The first path inside the image that was searched. When path was repeated, see each row’s own path for which root it actually came from. Example: /etc.

GrepResult.GrepResult.patterns

string[] (required) — The patterns that were searched for Example: ["^PermitRootLogin"].

GrepResult.GrepResult.matches

GrepMatch[] (required) — File-ordered lines; each is a match or (when before/after are set) surrounding context

GrepResult.GrepResult.truncated

boolean (required) — True when maxTotal or the search deadline stopped the search early Example: false.

asText() formats grep rows in response order, separating disjoint context groups with --.

toString() delegates to asText() with the default format.

class ImageImportRegistryCredentials(fields?)
ImageImportRegistryCredentials.ImageImportRegistryCredentials.username

string (optional) — Username for the registry authentication Example: myuser.

ImageImportRegistryCredentials.ImageImportRegistryCredentials.password

string (optional) — Password for the registry authentication Example: secret.

class ImageImportRegistry(fields?)
ImageImportRegistry.ImageImportRegistry.url

string (required) — URL of the container registry Example: docker://docker.io/busybox:latest.

ImageImportRegistry.ImageImportRegistry.credentials

ImageImportRegistryCredentials (optional)

class ImageImportRequest(fields?)
ImageImportRequest.ImageImportRequest.registry

ImageImportRegistry (required)

ImageImportRequest.ImageImportRequest.tag

string | null (optional) — Tag to identify the image when listing publicly available images. If omitted, the image will be private and only accessible by ID. Example: busybox:latest.

ImageImportRequest.ImageImportRequest.timeout

number (optional) — Maximum time in seconds to wait for the import operation to complete Example: 300.

class Image(fields?)
Image.Image.uuid

string (optional)

Image.Image.tag

string | null (optional) — Tag to identify the image Example: busybox:latest.

Image.Image.createdAt

string (optional) — ISO 8601 formatted timestamp of when the image was created Example: 2024-01-01T12:00:00+00:00.

Image.Image.operationUuid

string | null (optional) — UUID of the operation that created this image. Returns null when the image belongs to a different namespace (e.g. public images) or when the image was not created by an operation (e.g. shared images).

class ImageListResponse(fields?)
ImageListResponse.ImageListResponse.images

Image[] (optional) — List of publicly available images

class ImageImportMetadataRegistryCredentials(fields?)
ImageImportMetadataRegistryCredentials.ImageImportMetadataRegistryCredentials.username

string (optional) — Username for the registry authentication Example: myuser.

ImageImportMetadataRegistryCredentials.ImageImportMetadataRegistryCredentials.password

string (optional) — Always masked in the response is present Example: <MASKED>.

class ImageImportMetadataRegistry(fields?)
ImageImportMetadataRegistry.ImageImportMetadataRegistry.url

string (optional) — URL of the container registry Example: docker://docker.io/busybox:latest.

ImageImportMetadataRegistry.ImageImportMetadataRegistry.credentials

ImageImportMetadataRegistryCredentials (optional)

class ImageImportMetadata(fields?)
ImageImportMetadata.ImageImportMetadata.registry

ImageImportMetadataRegistry (optional)

ImageImportMetadata.ImageImportMetadata.tag

string | null (optional)

ImageImportMetadata.ImageImportMetadata.timeout

number (optional) — Maximum time in seconds to wait for the import operation to complete Example: 300.

class StreamRepr(fields?)
StreamRepr.StreamRepr.value

string (required) — Content of the stream Example: Y29tbWFuZCBvdXRwdXQK.

StreamRepr.StreamRepr.encoding

"ascii" | "base64" (required) — Encoding of the content Example: base64.

StreamRepr.StreamRepr.truncated

boolean (optional) — Whether the output was truncated Example: false.

Codec helpers: asBytes(), asText(), StreamRepr.fromBytes(bytes), StreamRepr.fromText(text).

toString() delegates to asText() with the default format.

class ClosableStreamRepr(fields?)

Stdin payload. Delivery to the child is always complete — stdin is never truncated on its way to the process. Only the recorded stdin events in the subprocess event log are capped by truncateOutputAt, same as stdout/stderr. This schema also carries a close flag controlling the pipe’s EOF.

ClosableStreamRepr.ClosableStreamRepr.value

string (required) — Content to write to stdin (may be empty for a close-only request) Example: aGVsbG8K.

ClosableStreamRepr.ClosableStreamRepr.encoding

"ascii" | "base64" (optional) — Encoding of the content

ClosableStreamRepr.ClosableStreamRepr.close

boolean (optional) — true (default) closes stdin (EOF) after writing value — the pre-existing one-shot behavior. false keeps the pipe open so more data can be sent later via POST /operations/{operationId}/subprocesses/{spid}/stdin.

Codec helpers: asBytes(), asText(), ClosableStreamRepr.fromBytes(bytes), ClosableStreamRepr.fromText(text).

toString() delegates to asText() with the default format.

class InstanceResourcesLimits(fields?)

Launch-time limits. CPU sets the VM’s vCPU count. memoryMib limits each process’s address space (RLIMIT_AS, soft and hard) and the whole process tree’s memory (cgroup memory.max). A request for 1 MiB is valid and enforces that limit on the workload. The backend independently selects a minimum VM RAM allocation for guest boot, networking and runtime services, for example 128 or 256 MiB. This minimum is an implementation detail and can change. It does not increase the requested workload limit. A small address-space limit can prevent the executable or runtime from loading. It includes stacks, libraries and reserved mappings; allocations can fail with ENOMEM even with overcommit enabled. Guest kernel and runtime consume part of VM RAM. Limits are maxima, not reservations. Guest root retains permission to modify cgroups.

InstanceResourcesLimits.InstanceResourcesLimits.cpu

number (optional) — Number of guest vCPUs.

InstanceResourcesLimits.InstanceResourcesLimits.memoryMib

number (optional) — Per-process address-space and process-tree memory limit in MiB (1048576 bytes).

InstanceResourcesLimits.InstanceResourcesLimits.maxLayerBytes

number (optional) — Maximum writable layer size in bytes. Example: 1073741824.

class ProcessResourcesLimits(fields?)

Launch-time limits for a subprocess and its descendants. Each omitted or null field inherits the requested operation limit, not the VM’s minimum boot memory. CPU/RAM cannot exceed the parent operation. Limits are maxima, not reservations. Concurrent processes share VM resources and can exhaust the aggregate budget. memoryMib sets RLIMIT_AS (soft and hard) before exec and memory.max for the tree. RLIMIT_AS includes reserved mappings, stacks and libraries; allocation or executable loading can fail with ENOMEM. Descendants inherit it. A local cgroup OOM kills this process tree. A VM-wide OOM can affect other processes. Guest root retains permission to modify cgroups.

ProcessResourcesLimits.ProcessResourcesLimits.cpu

number | null (optional) — Number of guest vCPUs available to the process tree. The runtime selects CPU affinity; CPU sets can overlap between subprocesses.

ProcessResourcesLimits.ProcessResourcesLimits.memoryMib

number | null (optional) — Per-process RLIMIT_AS and tree memory.max in MiB. Swap is disabled for this group.

class InstanceNetworking(fields?)
InstanceNetworking.InstanceNetworking.enabled

boolean (optional) — Enable network access for the instance. When false, the VM starts without a guest network interface.

InstanceNetworking.InstanceNetworking.policy

string[] (optional) — Network policies to apply, referenced by UUID or by tag prefixed with tag:. References - You can use your own policies and shared policies. - Your tag takes precedence over a shared tag with the same name. - Duplicate references and resolved policy UUIDs are removed while preserving first occurrence order. - Unknown or unavailable references return 404. - Deleted policies remain usable by UUID. Permissions Using policies requires only the permission to create the instance; network_policy is not required. Limits - At most 512 references may be supplied, including duplicates. - Before and after merging, the rules are limited to 16384 units in total: sum the number of ports across all rules, counting an all-port rule as 1. All IP versions and protocols share this limit. Repeated rules and ports across policies count again before merging. - Exceeding either limit returns 400. No policies Omitting this field or passing policy: [] allows all IPv4 destinations and global unicast IPv6 destinations on all ports. The API adds four explicit rules to effectivePolicy: TCP and UDP for IPv4 0.0.0.0/0 and IPv6 2000::/3, each with ports: [] (all ports). ICMP is also allowed to these destinations. IPv6 destinations outside 2000::/3, including unique-local and link-local addresses, require explicit policy rules. Empty policies A selected policy with no rules ({"cidrs": []}) allows nothing. If all selected policies are empty, effectivePolicy is {"cidrs": []} and all network traffic is denied. An empty policy combined with non-empty policies adds no permissions; the other policies’ rules still apply. Effective policy effectivePolicy contains the final combined network rules that will be applied to the operation. Rules are combined by merging CIDRs per protocol and port, then grouping ports for matching CIDRs and protocols. Example: ["12345678-9abc-baba-deda-0123456789ab","tag:github"].

class NetworkPolicyCIDRRule(fields?)
NetworkPolicyCIDRRule.NetworkPolicyCIDRRule.cidr

string (required) — IPv4 or IPv6 destination network in CIDR notation. Example: 192.0.2.0/24.

NetworkPolicyCIDRRule.NetworkPolicyCIDRRule.proto

"tcp" | "udp" (required)

NetworkPolicyCIDRRule.NetworkPolicyCIDRRule.ports

number[] (optional) — Allowed destination ports. Omitted or empty means all ports.

class NetworkPolicyCreateRequest(fields?)

An allowlist of destination networks, protocols, and ports. A policy with {"cidrs": []} allows nothing. Selecting only empty policies denies all network traffic. This differs from selecting no policies (networking.policy: []), which allows all IPv4 destinations (0.0.0.0/0) and global unicast IPv6 destinations (2000::/3) on all ports and adds these explicit rules to effectivePolicy.

NetworkPolicyCreateRequest.NetworkPolicyCreateRequest.cidrs

NetworkPolicyCIDRRule[] (required)

class InstanceNetworkingResponse(fields?)
InstanceNetworkingResponse.InstanceNetworkingResponse.enabled

boolean (optional) — Enable network access for the instance. When false, the VM starts without a guest network interface.

InstanceNetworkingResponse.InstanceNetworkingResponse.policy

string[] (optional) — Unique applied policy UUIDs in first occurrence order. Tag references are returned as UUIDs.

InstanceNetworkingResponse.InstanceNetworkingResponse.effectivePolicy

NetworkPolicyCreateRequest | null (optional) — The final combined network rules that will be applied to the operation. New instances always include an explicit effective policy, including when no policy references are specified. Omitting networking.policy or passing policy: [] allows all IPv4 and global unicast IPv6 destinations on all ports: this field contains four rules, TCP and UDP for both 0.0.0.0/0 (IPv4) and 2000::/3 (IPv6), with ports: [] on each rule. ICMP is also allowed to these destinations. IPv6 destinations outside 2000::/3 require explicit policy rules. Selecting only empty policies ({"cidrs": []}) instead produces {"cidrs": []}, which denies all network traffic. Empty policies add no permissions when combined with non-empty policies. Historical instance metadata may omit this field or contain null.

class NetworkPolicyTag(fields?)
NetworkPolicyTag.NetworkPolicyTag.tag

string (required) — Network policy tag name

NetworkPolicyTag.NetworkPolicyTag.uuid

string (required)

class NetworkPolicy(fields?)
NetworkPolicy.NetworkPolicy.uuid

string (required)

NetworkPolicy.NetworkPolicy.cidrs

NetworkPolicyCIDRRule[] (required)

class NetworkPolicyListItemSummary(fields?)
NetworkPolicyListItemSummary.NetworkPolicyListItemSummary.cidrs

number (required) — Number of CIDR rules in the policy, including repeated CIDRs.

class NetworkPolicyListItem(fields?)
NetworkPolicyListItem.NetworkPolicyListItem.uuid

string (required)

NetworkPolicyListItem.NetworkPolicyListItem.createdAt

Date (required) — Time when the policy was created.

NetworkPolicyListItem.NetworkPolicyListItem.tags

string[] (required) — Accessible tag names resolving to this policy, sorted by name. Empty when none exist.

NetworkPolicyListItem.NetworkPolicyListItem.summary

NetworkPolicyListItemSummary (required)

class NetworkPolicyListResponse(fields?)
NetworkPolicyListResponse.NetworkPolicyListResponse.policies

NetworkPolicyListItem[] (required)

class ExecSpec(fields?)

Process-execution surface shared between InstanceSpawnRequest (the main process) and POST /operations/{operationId}/subprocesses (additional subprocesses). VM-level concerns (image, hostname, disk limits, files, timeout, disposable, preserveEnv) live on InstanceSpawnRequest only.

ExecSpec.ExecSpec.command

string (required) — The command to execute. Same semantics as in InstanceSpawnRequest.command — when shell=true it is a shell expression, otherwise a path to an executable. Example: /bin/app.

ExecSpec.ExecSpec.resourcesLimits

ProcessResourcesLimits (optional)

ExecSpec.ExecSpec.args

string[] (optional) — Arguments to pass to the command if shell is set to false. Example: ["arg1","arg2"].

ExecSpec.ExecSpec.shell

boolean (optional) — Run command through a shell expression (args must be empty).

ExecSpec.ExecSpec.env

Record<string, string> | null (optional) — Environment variables to set in the child process.

ExecSpec.ExecSpec.cwd

string (optional) — Working directory; empty string means image / server default.

ExecSpec.ExecSpec.uid

number (optional) — User ID to run the process as.

ExecSpec.ExecSpec.gid

number (optional) — Group ID to run the process as.

ExecSpec.ExecSpec.stdin

ClosableStreamRepr (optional) — Bytes fed to the child’s stdin — honored for both the main process and exec’d subprocesses. With close=false the pipe stays open and more data can be written via POST /operations/{operationId}/subprocesses/{spid}/stdin.

ExecSpec.ExecSpec.truncateOutputAt

number (optional) — Maximum number of bytes to keep per stream (stdout, stderr, and stdin) in the subprocess event log. Does not affect delivery to the child — stdin is always delivered in full regardless of this cap. Defaults to 1 MiB; capped at 10 MiB. Example: 65535.

class FileSpec(fields?)
FileSpec.FileSpec.uuid

string (optional)

FileSpec.FileSpec.uid

number (optional) — User ID Example: 0.

FileSpec.FileSpec.gid

number (optional) — Group ID Example: 0.

FileSpec.FileSpec.mode

string | number (optional) — File mode in octal format (e.g., “0644”) Example: 0644.

class InstanceSpawnRequest(fields?)
InstanceSpawnRequest.InstanceSpawnRequest.command

string (required) — The command to execute. In case if shell is set to true, this MUST contain shell expression. For example echo hello world or ls -l /app. If shell is set to false, this must be a relative or absolute path to the executable inside the image rootfs. For example: /bin/app or /usr/bin/find. Do not forget pass necessary PATH variable to env field, by default PATH is set to /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin. Example: /bin/app.

InstanceSpawnRequest.InstanceSpawnRequest.image

string (required)

InstanceSpawnRequest.InstanceSpawnRequest.disposable

boolean (optional) — Creates a disposable execution environment no any state will be saved.

InstanceSpawnRequest.InstanceSpawnRequest.hostname

string (optional) — Hostname to set when execution. Example: container-name.

InstanceSpawnRequest.InstanceSpawnRequest.args

string[] (optional) — Arguments to pass to the command if shell is set to false. Example: ["arg1","arg2"].

InstanceSpawnRequest.InstanceSpawnRequest.shell

boolean (optional) — Whether to run the command through a shell. If true, the command must be a shell expression and all values from args will be ignored. If false, the command field must be a path to an executable and args will be used. When true, environment variables from the image are automatically inherited. When false, they are not - use the env field to pass them explicitly.

InstanceSpawnRequest.InstanceSpawnRequest.env

Record<string, string> | null (optional) — Environment variables to set in the container. These are merged with image-defined variables when shell is true. When shell is false, only variables specified here are available - image-defined variables are not inherited. Example: {"KEY1":"value1","KEY2":"value2"}.

InstanceSpawnRequest.InstanceSpawnRequest.preserveEnv

boolean (optional) — Preserve environment variables in resulting image after execution. When true, the image’s existing environment variables from metadata/env are merged with user-provided env values (user values take priority on conflicts), and the combined result is written back to metadata/env after command execution. Setting a variable to an empty string or null removes it from the preserved environment.

InstanceSpawnRequest.InstanceSpawnRequest.preserveCwd

boolean (optional) — Save the resolved initial working directory as the default in the resulting image. An empty or omitted cwd resolves to the image’s current workdir, or / if none exists. The metadata file is opened for writing only when its contents differ from the new value. Directory changes made by the command do not change the saved value. Requires disposable: false to retain the metadata in a resulting image.

InstanceSpawnRequest.InstanceSpawnRequest.cwd

string (optional) — Path to the working directory, must be absolute or a special value the empty string. It means the default working directory of the image or server default will be used. If field is omitted it will be set to the empty string. The directory will be created automatically if it does not exist. Example: /app.

InstanceSpawnRequest.InstanceSpawnRequest.uid

number (optional) — User ID to run the process as. Example: 0.

InstanceSpawnRequest.InstanceSpawnRequest.gid

number (optional) — Group ID to run the process as. Example: 0.

InstanceSpawnRequest.InstanceSpawnRequest.resourcesLimits

InstanceResourcesLimits (optional)

InstanceSpawnRequest.InstanceSpawnRequest.networking

InstanceNetworking (optional)

InstanceSpawnRequest.InstanceSpawnRequest.stdin

ClosableStreamRepr (optional)

InstanceSpawnRequest.InstanceSpawnRequest.timeout

number (optional) — Maximum execution time in seconds Example: 60.

InstanceSpawnRequest.InstanceSpawnRequest.truncateOutputAt

number (optional) — Maximum number of bytes to keep per stream (stdout, stderr, and stdin) in the subprocess event log. Does not affect stdin delivery to the child, which always receives the complete stream regardless of this cap. Default is 1048576 (1 MiB). The maximum value is 10485760 (10 MiB). Example: 65535.

InstanceSpawnRequest.InstanceSpawnRequest.files

Record<string, FileSpec> (optional) — Map of absolute file paths to file metadata Example: {"/root/hello.txt":{"uuid":"a9165a5d-5c86-4bd8-8ee4-ae46c....

class InstanceResultResources(fields?)
InstanceResultResources.InstanceResultResources.blockInput

number (optional) — Block input operations

InstanceResultResources.InstanceResultResources.blockOutput

number (optional) — Block output operations

InstanceResultResources.InstanceResultResources.cost

number (optional) — Operation cost

InstanceResultResources.InstanceResultResources.elapsedTime

number (optional) — Elapsed wall time

InstanceResultResources.InstanceResultResources.involuntarySwitches

number (optional) — Number of involuntary context switches

InstanceResultResources.InstanceResultResources.maxRss

number (optional) — Maximum resident set size in KB

InstanceResultResources.InstanceResultResources.monotonicTime

number (optional) — Monotonic time measurement

InstanceResultResources.InstanceResultResources.pageFaults

number (optional) — Number of page faults

InstanceResultResources.InstanceResultResources.pageFaultsIo

number (optional) — Number of page faults requiring I/O

InstanceResultResources.InstanceResultResources.sharedMemory

number (optional) — Shared memory size

InstanceResultResources.InstanceResultResources.signals

number (optional) — Number of signals received

InstanceResultResources.InstanceResultResources.swaps

number (optional) — Number of swaps

InstanceResultResources.InstanceResultResources.systemCpuTime

number (optional) — System CPU time used

InstanceResultResources.InstanceResultResources.unsharedMemory

number (optional) — Unshared memory size

InstanceResultResources.InstanceResultResources.userCpuTime

number (optional) — User CPU time used

InstanceResultResources.InstanceResultResources.voluntarySwitches

number (optional) — Number of voluntary context switches

class InstanceResultState(fields?)
InstanceResultState.InstanceResultState.continued

boolean (optional) — Whether the process was continued from a stop

InstanceResultState.InstanceResultState.coreDump

boolean (optional) — Whether a core dump was generated

InstanceResultState.InstanceResultState.exitCode

number (optional) — Process exit code

InstanceResultState.InstanceResultState.pid

number (optional) — Process ID

InstanceResultState.InstanceResultState.signal

number (optional) — Signal that caused termination, if any

InstanceResultState.InstanceResultState.stopped

boolean (optional) — Whether the process was stopped

InstanceResultState.InstanceResultState.timedOut

boolean (optional) — Whether process had been killed because operation timeout was reached

InstanceResultState.InstanceResultState.oomKilled

boolean (optional) — Whether an OOM kill was observed in the process tree’s cgroup.

class InstanceResult(fields?)

Result of an instance execution

InstanceResult.InstanceResult.resources

InstanceResultResources (optional)

InstanceResult.InstanceResult.state

InstanceResultState (optional)

InstanceResult.InstanceResult.stdout

StreamRepr (optional)

InstanceResult.InstanceResult.stderr

StreamRepr (optional)

class InstanceSpawnResponse(fields?)
InstanceSpawnResponse.InstanceSpawnResponse.uuid

string (optional)

InstanceSpawnResponse.InstanceSpawnResponse.command

string (optional)

InstanceSpawnResponse.InstanceSpawnResponse.image

string (optional)

InstanceSpawnResponse.InstanceSpawnResponse.hostname

string (optional)

InstanceSpawnResponse.InstanceSpawnResponse.args

string[] (optional)

InstanceSpawnResponse.InstanceSpawnResponse.shell

boolean (optional)

InstanceSpawnResponse.InstanceSpawnResponse.env

Record<string, string> | null (optional)

InstanceSpawnResponse.InstanceSpawnResponse.preserveEnv

boolean (optional)

InstanceSpawnResponse.InstanceSpawnResponse.cwd

string (optional)

InstanceSpawnResponse.InstanceSpawnResponse.uid

number (optional)

InstanceSpawnResponse.InstanceSpawnResponse.gid

number (optional)

InstanceSpawnResponse.InstanceSpawnResponse.resourcesLimits

InstanceResourcesLimits (optional)

InstanceSpawnResponse.InstanceSpawnResponse.networking

InstanceNetworkingResponse (optional)

InstanceSpawnResponse.InstanceSpawnResponse.stdin

ClosableStreamRepr (optional)

InstanceSpawnResponse.InstanceSpawnResponse.timeout

number (optional)

InstanceSpawnResponse.InstanceSpawnResponse.truncateOutputAt

number (optional)

InstanceSpawnResponse.InstanceSpawnResponse.disposable

boolean (optional)

InstanceSpawnResponse.InstanceSpawnResponse.files

Record<string, FileSpec> (optional)

InstanceSpawnResponse.InstanceSpawnResponse.result

InstanceResult | null (optional)

class OperationSummary(fields?)
OperationSummary.OperationSummary.uuid

string (optional)

OperationSummary.OperationSummary.kind

"image_import" | "instance" (optional) — Type of the operation

OperationSummary.OperationSummary.status

OperationStatus (optional) — Current state of the instance operation Example: success.

OperationSummary.OperationSummary.error

string | null (optional) — Error message if the operation failed Example: Container image not found.

OperationSummary.OperationSummary.createdAt

string (optional) — ISO 8601 formatted timestamp when the operation was created Example: 2024-01-01T12:00:00+00:00.

OperationSummary.OperationSummary.duration

number | null (optional) — Operation duration in seconds

OperationSummary.OperationSummary.imageSize

number | null (optional) — Bytes written for the resulting image/layer(s). null when not measured (e.g. disposable instance, non-SUCCESS operations).

OperationSummary.OperationSummary.consumedCpu

number | null (optional) — Total CPU time consumed by the operation, in seconds. null when not measured.

OperationSummary.OperationSummary.consumedMemory

number | null (optional) — Peak resident memory used by the operation’s execution environment, in KiB. null when not measured. Shared resident pages are included.

OperationSummary.OperationSummary.imageUuid

string | null (optional) — UUID of the source image this operation was run on. Set for INSTANCE operations, null for IMAGE_IMPORT.

OperationSummary.OperationSummary.resultImageUuid

string | null (optional) — UUID of the image produced by this operation. Only set for completed (SUCCESS) operations, null otherwise.

class OperationInstanceMetadata(fields?)
OperationInstanceMetadata.OperationInstanceMetadata.command

string (required) — The command to execute. In case if shell is set to true, this MUST contain shell expression. For example echo hello world or ls -l /app. If shell is set to false, this must be a relative or absolute path to the executable inside the image rootfs. For example: /bin/app or /usr/bin/find. Do not forget pass necessary PATH variable to env field, by default PATH is set to /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin. Example: /bin/app.

OperationInstanceMetadata.OperationInstanceMetadata.image

string (required)

OperationInstanceMetadata.OperationInstanceMetadata.disposable

boolean (optional) — Creates a disposable execution environment no any state will be saved.

OperationInstanceMetadata.OperationInstanceMetadata.hostname

string (optional) — Hostname to set when execution. Example: container-name.

OperationInstanceMetadata.OperationInstanceMetadata.args

string[] (optional) — Arguments to pass to the command if shell is set to false. Example: ["arg1","arg2"].

OperationInstanceMetadata.OperationInstanceMetadata.shell

boolean (optional) — Whether to run the command through a shell. If true, the command must be a shell expression and all values from args will be ignored. If false, the command field must be a path to an executable and args will be used. When true, environment variables from the image are automatically inherited. When false, they are not - use the env field to pass them explicitly.

OperationInstanceMetadata.OperationInstanceMetadata.env

Record<string, string> | null (optional) — Environment variables to set in the container. These are merged with image-defined variables when shell is true. When shell is false, only variables specified here are available - image-defined variables are not inherited. Example: {"KEY1":"value1","KEY2":"value2"}.

OperationInstanceMetadata.OperationInstanceMetadata.preserveEnv

boolean (optional) — Preserve environment variables in resulting image after execution. When true, the image’s existing environment variables from metadata/env are merged with user-provided env values (user values take priority on conflicts), and the combined result is written back to metadata/env after command execution. Setting a variable to an empty string or null removes it from the preserved environment.

OperationInstanceMetadata.OperationInstanceMetadata.preserveCwd

boolean (optional) — Save the resolved initial working directory as the default in the resulting image. An empty or omitted cwd resolves to the image’s current workdir, or / if none exists. The metadata file is opened for writing only when its contents differ from the new value. Directory changes made by the command do not change the saved value. Requires disposable: false to retain the metadata in a resulting image.

OperationInstanceMetadata.OperationInstanceMetadata.cwd

string (optional) — Path to the working directory, must be absolute or a special value the empty string. It means the default working directory of the image or server default will be used. If field is omitted it will be set to the empty string. The directory will be created automatically if it does not exist. Example: /app.

OperationInstanceMetadata.OperationInstanceMetadata.uid

number (optional) — User ID to run the process as. Example: 0.

OperationInstanceMetadata.OperationInstanceMetadata.gid

number (optional) — Group ID to run the process as. Example: 0.

OperationInstanceMetadata.OperationInstanceMetadata.resourcesLimits

InstanceResourcesLimits (optional)

OperationInstanceMetadata.OperationInstanceMetadata.networking

InstanceNetworkingResponse (optional)

OperationInstanceMetadata.OperationInstanceMetadata.stdin

ClosableStreamRepr (optional)

OperationInstanceMetadata.OperationInstanceMetadata.timeout

number (optional) — Maximum execution time in seconds Example: 60.

OperationInstanceMetadata.OperationInstanceMetadata.truncateOutputAt

number (optional) — Maximum number of bytes to keep per stream (stdout, stderr, and stdin) in the subprocess event log. Does not affect stdin delivery to the child, which always receives the complete stream regardless of this cap. Default is 1048576 (1 MiB). The maximum value is 10485760 (10 MiB). Example: 65535.

OperationInstanceMetadata.OperationInstanceMetadata.files

Record<string, FileSpec> (optional) — Map of absolute file paths to file metadata Example: {"/root/hello.txt":{"uuid":"a9165a5d-5c86-4bd8-8ee4-ae46c....

OperationInstanceMetadata.OperationInstanceMetadata.result

InstanceResult (optional)

class OperationResult(fields?)

Result of the operation, if any

OperationResult.OperationResult.image

string | null (optional)

OperationResult.OperationResult.tag

string | null (optional) — Tag assigned to the imported image Example: busybox:latest.

class OperationResponse(fields?)
OperationResponse.OperationResponse.uuid

string (optional)

OperationResponse.OperationResponse.kind

"image_import" | "instance" (optional) — Type of the operation

OperationResponse.OperationResponse.status

OperationStatus (optional)

OperationResponse.OperationResponse.error

string | null (optional)

OperationResponse.OperationResponse.createdAt

string (optional) — ISO 8601 formatted timestamp when the operation was created Example: 2024-01-01T12:00:00+00:00.

OperationResponse.OperationResponse.duration

number | null (optional)

OperationResponse.OperationResponse.imageSize

number | null (optional) — Bytes written for the resulting image/layer(s). null when not measured (e.g. disposable instance, non-SUCCESS operations).

OperationResponse.OperationResponse.consumedCpu

number | null (optional) — Total CPU time consumed by the operation, in seconds. null when not measured.

OperationResponse.OperationResponse.consumedMemory

number | null (optional) — Peak resident memory used by the operation’s execution environment, in KiB. null when not measured. Shared resident pages are included.

OperationResponse.OperationResponse.imageUuid

string | null (optional) — UUID of the source image this operation was run on. Set for INSTANCE operations, null for IMAGE_IMPORT.

OperationResponse.OperationResponse.resultImageUuid

string | null (optional) — UUID of the image produced by this operation. Only set for completed (SUCCESS) operations, null otherwise.

OperationResponse.OperationResponse.metadata

OperationInstanceMetadata | ImageImportMetadata (optional)

OperationResponse.OperationResponse.result

OperationResult (optional) — Result of the operation, if any

class Error(fields?)
Error.Error.error

unknown (required) — Error message or structured validation errors Example: Some error occurred, this is an example of error message.

Error.Error.status

number (optional) — HTTP status code Example: 500.

Error.Error.traceback

string[] (optional)

class FileResponse(fields?)
FileResponse.FileResponse.uuid

string (required)

FileResponse.FileResponse.sha256

string (required) — SHA256 hash of the file content Example: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7....

FileResponse.FileResponse.size

number (required) — File size in bytes; -1 if unknown Example: 1024.

class File(fields?)
File.File.uuid

string (required)

File.File.sha256

string (required) — SHA256 hash of the file content

File.File.size

number (required) — File size in bytes; -1 if unknown Example: 1024.

File.File.createdAt

Date (required) — When the file was first uploaded by this namespace

File.File.updatedAt

Date (required) — Updated on each upload of the same file

class FilesListResponse(fields?)
FilesListResponse.FilesListResponse.files

File[] (optional)

class WhoAmIResponse(fields?)
WhoAmIResponse.WhoAmIResponse.tokenUuid

string (required) — UUID of the authentication token Example: a1b2c3d4-e5f6-7890-abcd-ef1234567890.

WhoAmIResponse.WhoAmIResponse.tokenExpiration

number | null (required) — Token expiration time as Unix timestamp, or null if not set Example: 1735689600.

WhoAmIResponse.WhoAmIResponse.permissions

Record<string, boolean> (required) — Map of all known permission names to their granted status. Keys are permission names (e.g., import, spawn, list), values indicate whether the token has the permission. Example: {"import":true,"spawn":true,"spawn_disposable":false,"lis....

WhoAmIResponse.WhoAmIResponse.operationsStat

Record<string, number> (required) — Operation statistics (reserved for future use)

WhoAmIResponse.WhoAmIResponse.limits

Record<string, number> (optional) — Map of resource limit names to their values for the current token. Example: {"instance_max_timeout":3600,"instance_max_concurrency":1....

class OperationEvent(fields?)

One event in the operation’s event log.

Process events carry a Spawned Process ID (spid) as their routing identity: spid=0 is the daemon (init / network / shutdown / size_cap, plus any synthetic stderr emitted before a child existed), spid=1 is the main process from InstanceMetadata, and spid>=2 are exec’d children (Phase 3+). Spids are Registry-assigned, monotonic, and never recycled within an operation; the kernel PID (when needed for debugging) lives inside the per-type data payload.

System events (completion) describe the operation as a whole, not a specific child process — they omit spid entirely.

OperationEvent.OperationEvent.id

number (required) — Sequential id assigned at append time. Strictly increasing within a single operation’s event log; gaps are possible (rare, after a transient producer-side serialization failure). Use this with Last-Event-Id / ?since= to resume a dropped SSE stream. Example: 42.

OperationEvent.OperationEvent.ts

Date (required) — UTC wall-clock time when the event was emitted. Example: 2026-06-08T20:00:00.123456789Z.

OperationEvent.OperationEvent.type

OperationEventType (required)

OperationEvent.OperationEvent.data

EventData | Record<string, unknown> (required) — Per-type payload. Clients should switch on type and validate data against the corresponding schema below.

OperationEvent.OperationEvent.spid

number (optional) — Spawned Process ID — present on process-scoped events (init, spawn, stdin, stdout, stderr, exit, truncated, size_cap, network, shutdown, inspect, file_upload). Absent on operation-scoped system events (completion), which don’t tie to a specific child. Example: 1.

class EventInspectParametersOptions(fields?)
EventInspectParametersOptions.EventInspectParametersOptions.patterns

string[] | null (required)

EventInspectParametersOptions.EventInspectParametersOptions.globs

string[] | null (required)

EventInspectParametersOptions.EventInspectParametersOptions.case

string (required)

EventInspectParametersOptions.EventInspectParametersOptions.maxCount

number (required)

EventInspectParametersOptions.EventInspectParametersOptions.maxTotal

number (required)

EventInspectParametersOptions.EventInspectParametersOptions.before

number (required)

EventInspectParametersOptions.EventInspectParametersOptions.after

number (required)

class EventInspectParameters(fields?)

Parameters for the method named in EventDataInspect. Path methods (stat/list/open/archive/grep/upload) record path. Grep also records options. Upload records fileUuid, unpack, replace, and merge. Read/write record handle, offset, and size; write size is the input chunk length, not an acknowledgement. Close/finish record handle. Binary payloads are excluded.

EventInspectParameters.EventInspectParameters.path

string (optional)

EventInspectParameters.EventInspectParameters.fileUuid

string (optional)

EventInspectParameters.EventInspectParameters.unpack

boolean (optional)

EventInspectParameters.EventInspectParameters.replace

boolean (optional)

EventInspectParameters.EventInspectParameters.merge

boolean (optional)

EventInspectParameters.EventInspectParameters.handle

string (optional)

EventInspectParameters.EventInspectParameters.offset

number (optional)

EventInspectParameters.EventInspectParameters.size

number (optional)

EventInspectParameters.EventInspectParameters.options

EventInspectParametersOptions (optional)

class EventDataInspect(fields?)

Metadata for a guest inspect RPC. Init emits a started/completed pair with the same requestId. Event IDs order the starts independently of completion order. A returned handle links subsequent reads, writes, finish, close, and file_upload events. All events use spid=0. Request parameters are recorded even when the method rejects them. A successful open/upload only allocates a handle; it does not complete the transfer. Read events report RPC bytes, not HTTP client receipt. File contents, directory listings, and grep matches are never recorded. Events are flushed to the journal and bypass the stream size cap. A missing completion can indicate an interrupted or lost event. These records support a future replay implementation; replay is not automatic.

EventDataInspect.EventDataInspect.requestId

string (required) — Opaque identifier shared by the request and result events.

EventDataInspect.EventDataInspect.method

"stat" | "list" | "open" | "archive" | "grep" | "read" | "close" | "upload" | "write" | "finish" (required)

EventDataInspect.EventDataInspect.phase

"started" | "completed" (required)

EventDataInspect.EventDataInspect.params

EventInspectParameters (optional)

EventDataInspect.EventDataInspect.status

"success" | "error" | "cancelled" | "timeout" (optional)

EventDataInspect.EventDataInspect.error

string | null (optional) — Error category only; null on success. No exception text or file contents.

EventDataInspect.EventDataInspect.handle

string (optional) — Present after a successful open, archive, grep, or upload.

EventDataInspect.EventDataInspect.bytes

number (optional) — Bytes returned by a successful read.

EventDataInspect.EventDataInspect.eof

boolean (optional) — Present after a successful read; true at the end of its stream.

class EventDataFileUpload(fields?)

Init emits this event once after publication or cleanup of an accepted upload. It is emitted even if the host disconnects or Finish loses its response. A rejected upload has only its inspect request/result pair. Success means publication finished. Error or cancellation can leave a partially applied merge, as specified by the upload endpoint. The event contains metadata only, uses spid=0, bypasses the stream size cap, and is flushed before shutdown. Recording does not extend the source file’s TTL or guarantee its availability for future replay.

EventDataFileUpload.EventDataFileUpload.handle

string (required)

EventDataFileUpload.EventDataFileUpload.fileUuid

string (required)

EventDataFileUpload.EventDataFileUpload.path

string (required) — Clean absolute destination path.

EventDataFileUpload.EventDataFileUpload.unpack

boolean (required)

EventDataFileUpload.EventDataFileUpload.replace

boolean (required)

EventDataFileUpload.EventDataFileUpload.merge

boolean (required)

EventDataFileUpload.EventDataFileUpload.bytes

number (required) — Source bytes consumed from the upload pipe, including on failure. For an archive, counts compressed/source bytes, not extracted bytes. This is not a count of bytes successfully published to the destination.

EventDataFileUpload.EventDataFileUpload.status

"success" | "error" | "cancelled" | "timeout" (required)

EventDataFileUpload.EventDataFileUpload.error

string | null (required) — Error category only; null on success.

class EventDataInit(fields?)

Operation-level startup snapshot. hostname, kernel, machine, bootId are best-effort — omitted if the environment couldn’t provide them.

EventDataInit.EventDataInit.startedAt

Date (required) — Example: 2026-06-08T20:00:00.000000000Z.

EventDataInit.EventDataInit.runtimePath

string (required) — Internal runtime directory for the operation. Example: /run/contreeinitd.

EventDataInit.EventDataInit.verbose

boolean (required) — Example: false.

EventDataInit.EventDataInit.initPid

number (required) — PID of the operation’s init process. Example: 1.

EventDataInit.EventDataInit.hostname

string (optional) — Example: vm-abc123.

EventDataInit.EventDataInit.kernel

string (optional) — uname release + version, space-separated. Example: 6.10.0-generic #1 SMP PREEMPT.

EventDataInit.EventDataInit.machine

string (optional) — Example: x86_64.

EventDataInit.EventDataInit.bootId

string (optional) — Operation-unique boot identifier. Example: 5e0a3f24-7c2d-4f50-8e1d-9b3c8d7e6a4f.

class EventDataSpawn(fields?)

Process spawn parameters. env values for keys ending in TOKEN/SECRET/PASSWORD/API_KEY/CREDENTIALS/AUTHORIZATION are replaced with the literal string <MASKED> before emission.

EventDataSpawn.EventDataSpawn.pid

number (required) — PID assigned to the process. Example: 4242.

EventDataSpawn.EventDataSpawn.command

string (required) — Example: /bin/sh.

EventDataSpawn.EventDataSpawn.args

string[] (required) — Example: ["-c","echo hi"].

EventDataSpawn.EventDataSpawn.shell

boolean (required) — If true, the command is wrapped in <shell> -c <command> (so the args / command may differ from the user’s input). Example: true.

EventDataSpawn.EventDataSpawn.cwd

string (required) — Example: /work.

EventDataSpawn.EventDataSpawn.uid

number (required) — Example: 1000.

EventDataSpawn.EventDataSpawn.gid

number (required) — Example: 1000.

EventDataSpawn.EventDataSpawn.timeout

number (required) — Per-process SIGKILL deadline in seconds. Example: 60.

EventDataSpawn.EventDataSpawn.truncateAt

number (required) — Per-stream cap (bytes) above which stdout/stderr/stdin chunks stop being emitted and the stream’s truncated event fires on EOF. Example: 1048576.

EventDataSpawn.EventDataSpawn.resourcesLimits

ProcessResourcesLimits (optional)

EventDataSpawn.EventDataSpawn.cpuAffinity

number[] (optional) — Effective guest vCPU IDs available to this process tree.

EventDataSpawn.EventDataSpawn.env

Record<string, string> (optional) — Environment as passed to the process. Values for secret-suffix keys are replaced with <MASKED>. Example: {"PATH":"/usr/bin:/bin","DATABASE_PASSWORD":"<MASKED>"}.

class EventDataStream(fields?)

Payload for stdin / stdout / stderr events. Encoding is ascii when every byte is printable plus \\n / \\r / \\t; base64 otherwise. Chunks are at most a few KB each — the natural read granularity from a pipe.

EventDataStream.EventDataStream.value

string (required) — Example: hello world.

EventDataStream.EventDataStream.encoding

"ascii" | "base64" (required) — Example: ascii.

EventDataStream.EventDataStream.truncated

boolean (optional) — Always false on per-chunk stream events. When a stream crosses its per-stream cap a separate truncated-type event is emitted on EOF carrying the cumulative emitted/dropped totals. Example: false.

Codec helpers: asBytes(), asText(), EventDataStream.fromBytes(bytes), EventDataStream.fromText(text).

toString() delegates to asText() with the default format.

class EventResources(fields?)

Resource usage snapshot for the process. Time fields are in microseconds; memory in kilobytes (maxRssKb) or platform-specific units (sharedMemory / unsharedMemory). Some kernels populate fewer fields than others; expect zeroes for unsupported counters.

EventResources.EventResources.userTimeUs

number (required)

EventResources.EventResources.sysTimeUs

number (required)

EventResources.EventResources.maxRssKb

number (required)

EventResources.EventResources.sharedMemory

number (required)

EventResources.EventResources.unsharedMemory

number (required)

EventResources.EventResources.swaps

number (required)

EventResources.EventResources.minorFaults

number (required)

EventResources.EventResources.majorFaults

number (required)

EventResources.EventResources.voluntaryCtxSwitches

number (required)

EventResources.EventResources.involuntaryCtxSwitches

number (required)

EventResources.EventResources.blockInputOps

number (required)

EventResources.EventResources.blockOutputOps

number (required)

EventResources.EventResources.ipcMsgsSent

number (required)

EventResources.EventResources.ipcMsgsReceived

number (required)

EventResources.EventResources.signalsReceived

number (required)

class EventDataExit(fields?)

Process lifecycle close-out. Carries the exit code OR the kill signal (signal = -1 means normal exit), the timedOut flag (true only when the process’s per-process timeout fired — distinguishes from an external signal/kill), wall-clock duration, and a snapshot of resource usage.

EventDataExit.EventDataExit.pid

number (required) — PID of the process that just exited. Example: 4242.

EventDataExit.EventDataExit.code

number (required) — Exit code (0..255) if the process exited normally; -1 if killed by signal. Example: 0.

EventDataExit.EventDataExit.signal

number (required) — Signal number if killed by signal; -1 if normal exit. Example: -1.

EventDataExit.EventDataExit.timedOut

boolean (required) — True only if the process’s own timeout fired the kill. An externally-driven kill (signal / kill / cancel) leaves timedOut=false. Example: false.

EventDataExit.EventDataExit.durationMs

number (required) — Wall-clock time from spawn to exit. Example: 1234.

EventDataExit.EventDataExit.resources

EventResources (required)

EventDataExit.EventDataExit.oomKilled

boolean (optional) — An OOM kill was observed in this process tree. Missing in older events.

EventDataExit.EventDataExit.coreDump

boolean (optional) — True when the terminating signal produced a core dump. Absent in events recorded before the field was added — treat missing as false. Example: false.

class EventDataTruncated(fields?)

Per-stream summary emitted once on stream EOF when the stream’s truncateAt cap was crossed during its lifetime. Carries the final cumulative emitted/dropped totals (not partial numbers at cap-hit time). Absent if the stream never crossed the cap.

EventDataTruncated.EventDataTruncated.stream

"stdin" | "stdout" | "stderr" (required) — Example: stdout.

EventDataTruncated.EventDataTruncated.bytesEmitted

number (required) — Bytes that were delivered before the cap kicked in. Example: 1048576.

EventDataTruncated.EventDataTruncated.bytesDropped

number (required) — Bytes consumed from the producer but suppressed by the cap. Example: 4096.

class EventDataSizeCap(fields?)

Emitted at most once per operation when the cumulative event-log size approached its budget. After this marker, further stream events (stdin / stdout / stderr) are dropped; service events continue so the lifecycle stays observable.

EventDataSizeCap.EventDataSizeCap.limitBytes

number (required) — Size budget at which dropping kicked in. Example: 104857600.

EventDataSizeCap.EventDataSizeCap.fileSize

number (required) — Approximate cumulative event-log size at cap-hit. Example: 104800000.

class NetworkInterface(fields?)
NetworkInterface.NetworkInterface.name

string (required) — Example: eth0.

NetworkInterface.NetworkInterface.rxBytes

number (required)

NetworkInterface.NetworkInterface.rxPackets

number (required)

NetworkInterface.NetworkInterface.rxErrs

number (required)

NetworkInterface.NetworkInterface.rxDrop

number (required)

NetworkInterface.NetworkInterface.txBytes

number (required)

NetworkInterface.NetworkInterface.txPackets

number (required)

NetworkInterface.NetworkInterface.txErrs

number (required)

NetworkInterface.NetworkInterface.txDrop

number (required)

class EventDataNetworkConfigured(fields?)

Subset of network params that were applied — empty keys are omitted, so the object only carries what was requested.

EventDataNetworkConfigured.EventDataNetworkConfigured.ip4

string (optional) — Example: 10.0.0.5/24.

EventDataNetworkConfigured.EventDataNetworkConfigured.ip4Gw

string (optional) — Example: 10.0.0.1.

EventDataNetworkConfigured.EventDataNetworkConfigured.ip6

string (optional) — Example: fc10:c0::33/64.

EventDataNetworkConfigured.EventDataNetworkConfigured.ip6Gw

string (optional) — Example: fc10:c0::1.

EventDataNetworkConfigured.EventDataNetworkConfigured.gwMac

string (optional) — Gateway MAC address. Example: ee:d0:a7:48:b5:98.

EventDataNetworkConfigured.EventDataNetworkConfigured.nameserver

string (optional) — Example: 8.8.8.8.

class EventDataNetwork(fields?)

Per-interface counters plus the configured network state. Emitted once at the end of the network setup phase, so the counters represent the initial baseline. Absent entirely for network-less operations.

EventDataNetwork.EventDataNetwork.interfaces

NetworkInterface[] (required)

EventDataNetwork.EventDataNetwork.configured

EventDataNetworkConfigured (optional) — Subset of network params that were applied — empty keys are omitted, so the object only carries what was requested.

EventDataNetwork.EventDataNetwork.error

string (optional) — Set if the per-interface counter read failed; interfaces then holds an empty list. Best-effort — failure does not block shutdown.

class EventDataShutdown(fields?)

Stream-terminating marker emitted right before the operation winds down. Distinct from the network event so consumers can recognize a clean shutdown without parsing payload- specific data.

EventDataShutdown.EventDataShutdown.stoppedAt

Date (required) — Example: 2026-06-08T20:01:34.567890123Z.

EventDataShutdown.EventDataShutdown.reason

"job_complete" | "timeout" | "spawn_failed" | "signal" (required) — Short categorical reason for the shutdown: * job_complete — process exited normally; * timeout — the operation timeout fired; * spawn_failed — the process couldn’t be started; * signal — terminated by an external signal. Additional categories may be added.

class EventDataCompletion(fields?)

Terminal system-event payload, emitted once when the operation reaches one of SUCCESS, FAILED, CANCELLED. Carries the operation outcome and rollup counters for the log + image artifacts. Always the last event in the log; the event itself has no spid (operation-scoped, not process-scoped).

EventDataCompletion.EventDataCompletion.status

OperationStatus (required) — Terminal operation status.

EventDataCompletion.EventDataCompletion.durationMs

number (required) — Wall-clock duration of the handler in milliseconds. Example: 4327.

EventDataCompletion.EventDataCompletion.resultImageUuid

string | null (optional) — UUID of the result image the operation produced. Present on every SUCCESS that persists an image — for runs that wrote no new layer, this is the image UUID the operation was spawned from (per the spec). Distinct from the spec uuid only when persist produced a new image. null for disposable runs (no image was persisted at all) and for FAILED / CANCELLED outcomes. Example: 019eef27-7ecb-7771-8184-aaf5fa596ce2.

EventDataCompletion.EventDataCompletion.error

string | null (optional) — Short human-readable error message when status is FAILED or CANCELLED. null on success. Example: spawn failed: exec /run/entrypoint: no such file.

EventDataCompletion.EventDataCompletion.imageSizeBytes

number (optional) — Size of the result image’s runtime layer in bytes. 0 for failed/cancelled operations and for disposables (no image persisted). Example: 134217728.

EventDataCompletion.EventDataCompletion.consumedCpu

number | null (optional) — Total CPU time consumed by the operation, in seconds; null when unmeasured.

EventDataCompletion.EventDataCompletion.consumedMemory

number | null (optional) — Peak resident memory used by the operation’s execution environment, in KiB; null when unmeasured.

class ListNetworkPolicyTagsResponse(fields?)
ListNetworkPolicyTagsResponse.ListNetworkPolicyTagsResponse.tags

NetworkPolicyTag[] (required)