Versions

envless.versions.list_all()

Collect every version of an environment

def list_all(
    project: str,
    environment: str,
    *,
    limit: int | None = None,
    offset: int | None = None,
    product: str | None = None,
    timeout: float | None = None,
) -> list[VersionResource]

Walks every page and returns the flattened list of versions, newest first. An environment is capped at 1000 versions on every plan, so the result stays bounded even on a long lived project.

limit= is the page size used while walking, not a cap on how many versions come back: a limit of 5 still returns the whole history, just in more round trips. It is clamped to the API maximum of 100, so asking for more buys nothing.

Example

from envless import envless

versions = envless.versions.list_all(
    'api', 'production', product='billing'
)

print(
    len(versions), versions[0]['label'] if versions else None
)

Parameters

ParameterTypeRequiredDescription
projectstrYesProject slug or project uniqueId.
environmentstrYesEnvironment slug, since an environment uniqueId will not resolve here.
productstrNoProduct slug used to disambiguate a project slug shared across products.
limitintNoPage size used while walking, clamped to 100.
offsetintNoRow to start the walk from.
timeoutfloatNoSeconds each attempt of this call may take, the response body included, before it raises EnvlessNetworkError with is_timeout set. Overrides the client's timeout for this call, and 0 turns the limit off.

Returns

list[VersionResource] holding every snapshot taken for the environment.

Reads the versions collection. list returns one page as a dict with items and pagination, list_all collects every page into a list, and iterate yields one item at a time, fetching the next page only when the loop reaches it. On AsyncEnvless, iterate is an async iterator for async for.

Worth knowing

  • Nothing is returned until the final page lands. Use iterate when you want to act on versions as they arrive.
  • Rows carry variableCount only, so reading the values behind every version costs one envless.versions.get per row.
  • On the Free plan only the latest version is listed; the older ones are stored but need Dev or above to be read, and reading one there is 402 plan.upgrade_required.

Required scopes

versions:read

Underlying endpoint

GET /projects/{slug}/environments/{environmentSlug}/versions

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

In TypeScript

envless.versions.listAll()

The same method in @goenvless/sdk, with the same request, retries and errors.