def list(
project: str,
environment: str,
*,
limit: int | None = None,
offset: int | None = None,
product: str | None = None,
timeout: float | None = None,
) -> Page[VersionResource]async 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'])import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
page = await envless.versions.list('api', 'production', limit=50)
for version in page['items']:
print(version['label'], version['variableCount'])
asyncio.run(main())Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project | str | Yes | Project slug or project uniqueId. |
environment | str | Yes | Environment slug, since an environment uniqueId will not resolve here. |
product | str | No | Product slug used to disambiguate a project slug shared across products. |
limit | int | No | Rows per page, a whole number from 1 to 100. |
offset | int | No | Rows to skip before the page starts. |
timeout | float | No | Seconds 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.