Skip to content

List environments

GET /v1/environments

Lists the environments a session can run in, which is the default cloud environment (env_default).

A session can run only in an environment from this list. The API has no call to create environments.

The key must have the tasks:read capability. For what each capability allows, see Keys.

Query parameters

NameTypeRequiredDefaultDescription
limitintegerNo20The maximum number of environments to return per page. Must be between 1 and 100.
pagestringNoThe next_page value from the previous response. Leave it out to get the first page.
include_archivedbooleanNofalseHas no effect, because environments are never archived.

Response

Returns 200 with the environments in data. Pass next_page as page to get the next page. next_page is null on the last page.

{
"data": [
{
"id": "env_default",
"archived_at": null,
"config": {
"type": "cloud",
"networking": {
"type": "unrestricted"
},
"packages": {
"apt": [],
"cargo": [],
"gem": [],
"go": [],
"npm": [],
"pip": []
}
},
"created_at": "2026-10-14T00:00:00.000Z",
"description": "The platform's own runtime. Every session runs here.",
"metadata": {},
"name": "default",
"type": "environment",
"updated_at": "2026-10-14T00:00:00.000Z"
}
],
"next_page": null
}

Errors

This endpoint can return these errors as well as the common errors.

Statuserror.typeCause and fix
400invalid_request_errorlimit is outside 1 to 100. Send a value from 1 to 100.
400invalid_request_errorpage is not a next_page value from this API. Send the next_page value from the previous response, unchanged.

Example

cURL
curl -sS "$CONTEXT_BASE_URL/v1/environments" -H "x-api-key: $CONTEXT_API_KEY"
Python
for env in client.beta.environments.list():
print(env.id, env.name)
TypeScript
for await (const env of client.beta.environments.list()) console.log(env.id, env.name)