Skip to main content

Environments API

An environment is a saved size (CPU, memory, storage, GPU) with an optional container image of its own. Workspaces, jobs, apps and workflows run at an environment's size when you give its id (environmentId), instead of spelling out their resources. An environment with a base image or Dockerfile instructions is built into an image, versioned: each change builds a new version, and what tracks the environment moves to it once the build succeeds.

All endpoints require authentication via the X-API-Key header and the scope shown.


Environment Object​

FieldTypeDescription
_idstringThe environment's id: the environmentId workspaces, jobs, apps and workflows take
namestringUnique within the organization
descriptionstringWhat it is for
vcpunumberCPU cores
memoryGbnumberMemory in GB
storageGbnumberEphemeral storage in GB
gpuCountnumberGPUs (0 for none)
gpuTypestring | nullThe GPU type when gpuCount is above 0
enabledbooleanA disabled environment cannot be chosen
isPublicbooleanEvery user may use it
sharedWithstring[]Users it is shared with, who may use and change it
usedBystring[]Users it is shared with to use only
ownerId, ownerNamestringWho created it (absent on the platform's own sizes)
organizationIdstring | nullIts organization (null for the platform's own sizes)
baseImagestringThe image a build starts from
dockerfilestringInstructions a build adds after the base image
buildStatusstringThe current version's build: pending, building, success or failed
buildErrorstring | nullWhy the build failed
buildLogsstring[]The build's log lines (on one environment, not in the list)
imageNamestringThe built image of the current version
builtAtstringWhen it was built
currentVersionnumberThe version workloads that track the environment run
versionsobject[]Every version: version, baseImage, dockerfile, buildStatus, buildError, imageName, createdAt, builtAt
providesobjectWhat the image offers a workspace's IDEs (for example jupyter: installable), with probedAt
usageCount, inUsenumber, booleanHow many apps, jobs, workspaces, workflows and models run on it (on one environment, and in the list with includeUsage); an environment in use keeps its size
createdAt, updatedAtstringISO 8601

GET /api/v1/environments​

The environments you may use: the platform's sizes, your organization's and those shared with you.

Scope: workspaces:read

Query Parameters

ParameterTypeRequiredDescription
enabledOnlybooleanNoOnly enabled environments
includeUsagebooleanNoAdd how many resources run on each (usageCount, inUse)
limitintegerNoResults per page
cursorstringNometa.nextCursor of the previous page

Response 200 OK: a page of the environments you may use, meta.nextCursor set while more remain.


POST /api/v1/environments​

Create an environment. With a baseImage or dockerfile, its image builds as version 1: poll the environment until buildStatus is success. An environment for a workflow builds FROM the platform's workflow-worker image.

Scope: workspaces:write

Request Body

FieldTypeRequiredDescription
namestringYesUnique within your organization
descriptionstringNoWhat it is for
cpunumberNoCPU cores (default 1)
memoryGbnumberNoMemory in GB (default 4)
storageGbnumberNoEphemeral storage in GB (default 20)
gpuCountnumberNoGPUs (default 0)
gpuTypestringNoGPU type, with gpuCount above 0 (for example nvidia-t4)
isPublicbooleanNoEvery user may use it
baseImagestringNoThe image to build from
dockerfilestringNoInstructions to add after the base image (no FROM when baseImage is set)

Response 201 Created: the new environment.


GET /api/v1/environments/:id​

An environment, with its build state and versions.

Scope: workspaces:read

ParameterTypeRequiredDescription
idstringYesEnvironment id

Response 200 OK: the environment.


PATCH /api/v1/environments/:id​

Change an environment. A new baseImage or dockerfile builds a new version. Its size cannot change while something uses it.

Scope: workspaces:write

ParameterTypeRequiredDescription
idstringYesEnvironment id

Request Body (every field optional)

FieldTypeDescription
name, descriptionstringIts name and description
cpu, memoryGb, storageGb, gpuCountnumberIts size
gpuTypestringGPU type
enabledbooleanEnable or disable it
isPublicbooleanEvery user may use it (administrators only)
baseImage, dockerfilestringA new image recipe (builds a new version)

Response 200 OK: the updated environment.


DELETE /api/v1/environments/:id​

Delete an environment and its images. An environment that an app, job, workspace, workflow or model still uses is refused (422 resource-in-use, naming what uses it).

Scope: workspaces:write

ParameterTypeRequiredDescription
idstringYesEnvironment id

Response 204 No Content


GET /api/v1/environments/base-image-status​

Whether each environment's image is built from what its base image tag points to now.

Scope: workspaces:read

Response 200 OK: statuses, by environment id, each with its baseImage and a status: current (built from the tag's present digest), outdated (the tag has moved since; rebuild to take the new base) or unknown (the base is not in this deployment's registry, with the reason).


POST /api/v1/environments/:id/rebuild​

Build an environment again, as a new version, from its base image tag's present digest. The versions in use keep running until the build succeeds; then what tracks the environment moves to the new version.

Scope: workspaces:write

ParameterTypeRequiredDescription
idstringYesEnvironment id

Response 200 OK: { "status": "rebuilding", "fromVersion", "toVersion" }, or { "status": "current" } when the image is already built from the present digest.