Invites

envless.invites.list()

List pending invitations in the workspace

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

Returns one page of invitations that are still outstanding. An invite leaves this list the moment it is accepted, at which point it becomes a row in members.list, and a revoked invite is soft-deleted and never reappears, so an empty page means nothing is waiting rather than nothing was ever sent.

Expired invites are still returned, with status set to expired. That field is derived from expiresAt when the row is read, so the same invite can flip from pending to expired between two calls without any write happening in between. Treat an expired row as dead: revoke it and send a fresh invitation through members.invite.

search matches the invited email address only, and it will not match role names. Ordering is fixed to newest sent first, so passing order= changes nothing.

Example

from envless import envless

page = envless.invites.list(search='api', limit=50)

print(
    [
        (invite['email'], invite['status'])
        for invite in page['items']
    ]
)
print(page['pagination']['totalCount'])

Parameters

ParameterTypeRequiredDescription
limitintNoRows per page, a whole number from 1 to 100.
offsetintNoWhole number of rows to skip before the page starts.
searchstrNoCase insensitive substring match on the invited email address.
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[InviteResource] with items and a pagination envelope counting every pending invite.

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

  • role is None when the role the invite was created against has since been deleted.
  • A 400 with request.invalid_pagination names the offending parameter in error.field.

Required scopes

members:read

Underlying endpoint

GET /invites

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

In TypeScript

envless.invites.list()

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