def list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
order: str | None = None,
timeout: float | None = None,
) -> Page[KeyResource]async def list(
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
order: str | None = None,
timeout: float | None = None,
) -> Page[KeyResource]Returns one page of the workspace API keys. No read ever exposes a secret or its hash, so the only identifying value on a row is prefix, the non secret leading characters of the credential. Match on that when you need to line a row up against a key you already hold.
Revoked keys are soft-deleted and are excluded from this list permanently, so the page counts live keys only and never doubles as an audit trail.
Ordering defaults to name, A to Z. order= set to asc or desc switches to createdAt, oldest or newest first, and any other value, including a typo, falls back to name order without complaint. search= matches name and prefix and nothing else.
Example
from envless import envless
page = envless.keys.list(search='ci', limit=50, order='desc')
for key in page['items']:
print(key['prefix'], key['active'], key['lastUsedAt'])import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
page = await envless.keys.list(search='ci', limit=50, order='desc')
for key in page['items']:
print(key['prefix'], key['active'], key['lastUsedAt'])
asyncio.run(main())Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | int | No | Rows per page, a whole number from 1 to 100. |
offset | int | No | Whole number of keys to skip before the page starts. |
search | str | No | Case insensitive substring match against name and prefix. |
order | str | No | Defaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt. |
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[KeyResource] with items and a pagination envelope counting the full filtered set.
Reads the keys 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
- A key fenced to specific projects cannot call this at all. The endpoint refuses it with
403 auth.key_project_restricted, and so dokeys.get(),keys.update()andkeys.delete().keys.create()is the only key method a fenced key keeps, and thereprojectIdsmust be a non empty subset of the caller's own fence. Reading the list needs a key with no fence. - Holding
keys:readdoes not open the route for a fenced key. The scope is checked first, so a fenced key without it sees403 auth.scope_missingand a fenced key with it sees403 auth.key_project_restricted. prefixis safe to log.scopeson each row is the effective map after clamping, not what was requested.
Required scopes
keys:read
Underlying endpoint
GET /keys
Request and response schema, every error code, and a live playground.
In TypeScript
envless.keys.list()
The same method in @goenvless/sdk, with the same request, retries and errors.