Environments

envless.environments.listAll()

Collect every environment in a project

ts
listAll(project: string, options?: ScopedSortedListOptions): Promise<Array<EnvironmentSummaryResource>>

Walks every page of the environments in a project and resolves one flat array. limit sets the page size, capped at 100, not the number of rows you get back, so raising or lowering it changes the request count and nothing else.

All rows are buffered in memory before the promise settles, and each row has the same fields list returns, exposed and updatedAt included. Environment counts are small by design, since the allowance is per project rather than per workspace, so this is usually the read you want.

Example

ts
const environments = await envless.environments.listAll('api')

console.log(environments.length)

Parameters

ParameterTypeRequiredDescription
projectstringYesProject slug or uniqueId that owns the environments.
options.productstringNoProduct slug that disambiguates an ambiguous project slug.
options.limitnumberNoPage size used for each underlying request, capped at 100.
options.offsetnumberNoRows to skip before collection starts.
options.searchstringNoCase insensitive substring match on the environment name or slug.
options.orderstringNoasc or desc sorts by creation time, oldest or newest first. Anything else, or nothing, sorts by name.
options.signalAbortSignalNoCancels every request in the walk.

Returns

Array<EnvironmentSummaryResource> with one entry per environment in the project.

Reads the environments collection. list returns one page as { items, pagination }, listAll collects every page into an array, and iterate streams one item at a time without buffering the whole set.

Worth knowing

  • An ambiguous project slug fails on the first request, so nothing is collected and no partial array is returned.
  • Aborting through options.signal rejects the whole call; there is no partial result to recover.

Required scopes

environments:read

Underlying endpoint

GET /projects/{slug}/environments

Request and response schema, every error code, and a live playground.

In Python

envless.environments.list_all()

The same method in envless-sdk, the Python SDK, with the same request, retries and errors.

In Ruby

Envless.environments.list_all

The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.

In PHP

$envless->environments->listAll()

The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.