iterate(project: string, options?: ScopedSortedListOptions): AsyncGenerator<EnvironmentSummaryResource, void, undefined>Yields environments one at a time and fetches the next page only when the current one is exhausted, so breaking out of the loop stops the remaining requests. Page size follows limit up to 100 and offset picks the starting row.
The walk advances its offset by the number of rows it just consumed, so creating or deleting environments in the same project mid-loop can skip a row or hand you one twice. Neither this nor listAll is a snapshot: both walk offsets, so a create or delete between pages can shift a row. Every yielded value is the summary shape, which carries exposed and updatedAt alongside the identifiers.
Example
for await (const environment of envless.environments.iterate('api')) {
console.log(environment.slug)
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project | string | Yes | Project slug or uniqueId that owns the environments. |
options.product | string | No | Product slug that disambiguates an ambiguous project slug. |
options.limit | number | No | Page size used for each underlying request, capped at 100. |
options.offset | number | No | Row to start the walk from. |
options.search | string | No | Case insensitive substring match on the environment name or slug. |
options.order | string | No | asc or desc sorts by creation time, oldest or newest first. Anything else, or nothing, sorts by name. |
options.signal | AbortSignal | No | Cancels the in-flight page request and ends the walk. |
Returns
An AsyncGenerator that yields EnvironmentSummaryResource values, one per environment.
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
- This returns a generator, not a promise: no request is sent until the loop pulls the first value.
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.iterate()
The same method in envless-sdk, the Python SDK, with the same request, retries and errors.
In Ruby
Envless.environments.iterate
The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.
In PHP
$envless->environments->iterate()
The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.