Invites

$envless->invites->revoke()

Revoke a pending invitation

php
/** @return RevokedInviteResource */
public function revoke(string $id, int|float|null $timeout = null): array

Soft-deletes the invitation and kills the link in the email immediately. The recipient is not told, and the seat the invite was holding against your plan limit is released, so this is what you call before inviting someone else on a full plan.

There is no way to undo this. To reach the same address again, call $envless->members->invite(), which now succeeds because no pending invite is blocking the email. Note that revoking has no effect on anyone who already accepted: once accepted the invite is gone from this collection and the person is a member, so use $envless->members->remove() instead.

id must be an invite id from a list call. Passing an email address or a slug produces a 404 rather than a validation error, and so does an invite that was already revoked or accepted.

Example

php
use Envless\Envless;

$envless = new Envless();

$invites = $envless->invites->listAll(search: 'dana@example.com');

if ($invites !== []) {
    $revoked = $envless->invites->revoke($invites[0]['id']);

    echo $revoked['email'], PHP_EOL;
}

Parameters

ParameterTypeRequiredDescription
$idstringYesInvite id taken from a list call, ids only.
$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

RevokedInviteResource with the id and email of the invitation that was revoked.

Worth knowing

  • Emits member.invite_revoked.
  • A 404 with invite.not_found is the response for an already revoked invite, so this call is not idempotent.

Required scopes

members:write

Underlying endpoint

DELETE /invites/{id}

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

In TypeScript

envless.invites.revoke()

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