Versions

envless.versions.list()

Read one page of environment versions

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

Returns one page of the snapshots taken for an environment, newest first, as items plus the raw pagination envelope. Rows are metadata only: label, note, variableCount, environmentId and createdAt, with no variables and no ciphertext. Pass a row id to envless.versions.get for the contents.

Nothing is fetched past the page you asked for, so read pagination['hasMore'] before assuming you hold the whole history. label is assigned server side as v1, v2 and so on from a count of existing versions, which means it is not unique forever. Treat id as the identity and never look a version up by label.

Example

from envless import envless

page = envless.versions.list('api', 'production', limit=50)

for version in page['items']:
    print(version['label'], version['variableCount'])

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.
limitintNoRows per page, a whole number from 1 to 100.
offsetintNoRows to skip before the page starts.
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

Page[VersionResource] with items and the pagination envelope.

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

  • Versions always come back newest first.
  • An environment holds at most 1000 versions on every plan, so the history is bounded no matter how old the project is.
  • 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.list()

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