Invites

$envless->invites->list()

List pending invitations in the workspace

php
/** @return Page<InviteResource> */
public function list(
    ?int $limit = null,
    ?int $offset = null,
    ?string $search = null,
    int|float|null $timeout = null,
): Page

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 $envless->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 $envless->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

php
use Envless\Envless;

$envless = new Envless();

$page = $envless->invites->list(search: 'api', limit: 50);

foreach ($page->items as $invite) {
    echo "{$invite['email']} {$invite['status']}", PHP_EOL;
}

echo $page->pagination['totalCount'], PHP_EOL;

Parameters

ParameterTypeRequiredDescription
$limitintNoRows per page, a whole number from 1 to 100.
$offsetintNoWhole number of rows to skip before the page starts.
$searchstringNoCase insensitive substring match on the invited email address.
$timeoutint|floatNoSeconds each attempt of this call may take, the response body included, before it throws Envless\Exception\NetworkException with isTimeout() true. 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 an Envless\Result\Page with items and pagination, listAll collects every page into an array, and iterate returns a Generator that yields one item at a time, fetching the next page only when the loop gets there.

Worth knowing

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