Invites

Envless.invites.list

List pending invitations in the workspace

def list(limit: nil, offset: nil, search: nil, timeout: nil)

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

ruby
require "envless/sdk"

page = Envless.invites.list(search: "api", limit: 50)

page.items.each do |invite|
  puts "#{invite[:email]} #{invite[:status]}"
end

puts page.pagination[:totalCount]

Parameters

ParameterTypeRequiredDescription
limit:IntegerNoRows per page, a whole number from 1 to 100.
offset:IntegerNoWhole number of rows to skip before the page starts.
search:String | SymbolNoCase insensitive substring match on the invited email address.
timeout:Integer | Float | RationalNoSeconds each attempt of this call may take, redirects and the response body included, before it raises Envless::NetworkError with timeout? set. Overrides the client's timeout for this call, and 0 turns the limit off.

Returns

Page[invite_resource] with items and a pagination envelope counting every pending invite.

Reads the invites collection. list returns one page as an Envless::Page with items and pagination, list_all collects every page into an array, and iterate yields one item at a time to a block, fetching the next page only when it gets there. Without a block, iterate returns an Enumerator.

Worth knowing

  • role is nil 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.