/** @return list<KeyResource> */
public function listAll(
?int $limit = null,
?int $offset = null,
?string $search = null,
?string $order = null,
int|float|null $timeout = null,
): arrayWalks the pages and returns a flat array of every live key in the workspace. A workspace is capped at 100 live keys and the walk requests 100 rows at a time, so in practice this costs a single request.
The pagination envelope is discarded, so totalCount and hasMore are gone. Use list when you need those numbers, or iterate when you want to stop as soon as you find the key you were after.
Revoked keys are absent, so the length of this array is the current live count and not a historical total. That makes it the right input for a cleanup pass over stale credentials.
Example
use Envless\Envless;
$envless = new Envless();
$keys = $envless->keys->listAll();
foreach ($keys as $key) {
if ($key['active'] && $key['lastUsedAt'] === null) {
echo $key['prefix'], ' has never been used', PHP_EOL;
}
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
$limit | int | No | Page size used while walking, capped at 100 and defaulting to 100. |
$offset | int | No | Row the walk starts from, so earlier keys are left out of the result. |
$search | string | No | Case insensitive substring match against name and prefix, applied to every page. |
$order | string | No | Defaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt. |
$timeout | int|float | No | Seconds 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
list<KeyResource> holding each live key in the workspace.
Reads the keys 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
- A failure on any page fails the whole call and the rows already collected are lost.
- Filtering on
activestill leaves disabled keys in the array. Disabled is not the same as revoked, and only revoked keys drop out of the collection.
Required scopes
keys:read
Underlying endpoint
GET /keys
Request and response schema, every error code, and a live playground.
In TypeScript
envless.keys.listAll()
The same method in @goenvless/sdk, with the same request, retries and errors.