Versions

envless.versions.list_all_entries()

Collect every version entry for rotation

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

Walks every page and returns one list holding every version entry in the environment. This is the shape a rotation wants: decrypt each value and defaultValue with the old key, re-encrypt with the new one, then write the results back in batches through reencrypt_entries.

It holds the entire encrypted history of the environment in memory at once, and the server rebuilds that history on every request, so prefer iterate_entries on a large environment. limit= only sets the page size used while walking, clamped to 100, it does not cap how many entries come back.

rotate_workspace_passphrase from the package root already does this walk plus the re-encryption and the batched write back for both live variables and history, so call this directly only when you need a custom rotation.

Example

from envless import envless

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

print(sum(1 for entry in entries if entry['value']))

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[VersionEntryResource] holding every entry across every version of the environment.

Reads the entries 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

  • Entries with a None value do occur. Skip them instead of feeding them to a decrypt call.
  • Split the list into batches of at most 200 before writing it back, since a longer entries list is rejected with 400.

Required scopes

versions:read and variables:read

Underlying endpoint

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

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

In TypeScript

envless.versions.listAllEntries()

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