def list_all(limit: nil, offset: nil, search: nil, order: nil, timeout: nil)def list_all: (
?limit: Integer?,
?offset: Integer?,
?search: (String | Symbol)?,
?order: ("name" | "asc" | "desc")?,
?timeout: seconds?
) -> Array[key_resource]Walks 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
require "envless/sdk"
keys = Envless.keys.list_all
idle = keys.select { |key| key[:active] && key[:lastUsedAt].nil? }
puts idle.map { |key| key[:prefix] }Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit: | Integer | No | Page size used while walking, capped at 100 and defaulting to 100. |
offset: | Integer | No | Row the walk starts from, so earlier keys are left out of the result. |
search: | String | Symbol | No | Case insensitive substring match against name and prefix, applied to every page. |
order: | "name" | "asc" | "desc" | No | Defaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt. |
timeout: | Integer | Float | Rational | No | Seconds each attempt of this call may take, redirects and the response body included, before it raises Envless::NetworkError with timeout? set. Overrides the client's timeout for this call, and 0 turns the limit off. |
Returns
Array[key_resource] holding each live key in the workspace.
Reads the keys collection. list returns one page as an Envless::Page with items and pagination, list_all collects every page into an array, and iterate yields one item at a time to a block, fetching the next page only when it gets there. Without a block, iterate returns an Enumerator.
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.