Identity

$envless->me->get()

Read the identity behind the API key

php
/** @return IdentityResource */
public function get(int|float|null $timeout = null): array

Returns the user the key belongs to, the workspace it is bound to, and a summary of the key itself. This is the only method that needs no scope, so it works with any valid key and is the cheapest way to check that a credential is still live.

Use it at startup to discover workspaceId, which you need for every encryption and decryption call. A key is permanently bound to one workspace, so this value never changes for a given key and is safe to cache for the process lifetime.

Example

php
use Envless\Envless;

$envless = new Envless();

$identity = $envless->me->get();

echo $identity['user']['email'], PHP_EOL;
echo $identity['workspaceId'], PHP_EOL;

Parameters

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

IdentityResource with user, workspaceId and key.

Worth knowing

  • key is null only when the request was authenticated by something other than an API key.
  • A failure here means the credential itself is bad. Every other method would fail the same way.

Required scopes

None. Any valid API key can call this.

Underlying endpoint

GET /me

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

In TypeScript

envless.me.get()

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