Products

$envless->products->access->revoke()

Revoke a member grant on a product

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

Removes a member grant from a product. A missing grant is not an error: the call still succeeds, with 'revoked' => false, so read that flag instead of treating a successful call as proof that something was removed.

Revoking the membership belonging to the key owner is refused, and that guard is what stops an integration locking itself out of a private product. Revoking on a public product deletes the stored row and changes nothing about who can read the product.

Example

php
use Envless\Envless;

$envless = new Envless();

$memberId = '8f1c0e42-9b7a-4d21-9d0e-3a41c7f5b210';
$result = $envless->products->access->revoke('billing', $memberId);

if (!$result['revoked']) {
    echo 'that member had no grant on the product', PHP_EOL;
}

Parameters

ParameterTypeRequiredDescription
$slugstringYesProduct slug, or the product uniqueId when the value is UUID shaped.
$memberIdstringYesWorkspace member id whose grant is being removed, never a user id.
$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

RevokedProductAccessResource with the member id and a revoked flag.

Worth knowing

  • The call is idempotent, so running it twice is safe and the second run returns 'revoked' => false.
  • An unknown member id is still rejected, so 'revoked' => false only ever means the member existed without a grant.

Required scopes

product-access:write

Underlying endpoint

DELETE /products/{slug}/access/{memberId}

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

In TypeScript

envless.products.access.revoke()

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