Members

envless.members.list_all()

Collect every workspace member into one list

def list_all(
    *,
    limit: int | None = None,
    offset: int | None = None,
    search: str | None = None,
    role_id: str | None = None,
    timeout: float | None = None,
) -> list[MemberResource]

Walks every page and returns the flattened member list. Membership counts are small compared with variables, so this is usually the right call for building a role table or a seat report.

limit= sets the page size used while walking, not a cap on how many members come back. Asking for a limit of 5 still returns everyone, just in more round trips. Nothing is returned until the last page lands.

Example

from envless import envless

members = envless.members.list_all()

roles = [member['role'] for member in members]
admins = [
    role for role in roles if role and role['name'] == 'Admin'
]

print(len(members), len(admins))

Parameters

ParameterTypeRequiredDescription
limitintNoPage size used while walking, clamped to 100.
offsetintNoRow to start the walk from.
searchstrNoCase insensitive substring match on the member name, email or role name.
role_idstrNoOnly members holding this role, by the role id from roles.list.
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[MemberResource] holding every accepted member of the workspace.

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

  • Page size defaults to the API maximum of 100 and is clamped there, so a larger limit buys nothing.
  • Key off member['id'] rather than member['user']['id'], since user can be None and only id is accepted by the write routes.

Required scopes

members:read

Underlying endpoint

GET /members

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

In TypeScript

envless.members.listAll()

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