API keys

envless.keys.listAll()

Collect every API key into one array

ts
listAll(options?: SortedListOptions): Promise<Array<KeyResource>>

Walks the pages and resolves with 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

ts
const keys = await envless.keys.listAll()

const idle = keys.filter((key) => key.active && key.lastUsedAt === null)

console.log(idle.map((key) => key.prefix))

Parameters

ParameterTypeRequiredDescription
options.limitnumberNoPage size used while walking, capped at 100 and defaulting to 100.
options.offsetnumberNoRow the walk starts from, so earlier keys are left out of the result.
options.searchstringNoCase insensitive substring match against name and prefix, applied to every page.
options.orderstringNoDefaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt.
options.signalAbortSignalNoCancels every request in the walk.

Returns

Array<KeyResource> holding each live key in the workspace.

Reads the keys collection. list returns one page as { items, pagination }, listAll collects every page into an array, and iterate streams one item at a time without buffering the whole set.

Worth knowing

  • A failure on any page rejects the whole call and the rows already collected are lost.
  • Filtering on active still 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 Python

envless.keys.list_all()

The same method in envless-sdk, the Python SDK, with the same request, retries and errors.

In Ruby

Envless.keys.list_all

The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.

In PHP

$envless->keys->listAll()

The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.