Variables

envless.variables.list()

Read one page of variables in an environment

ts
list(project: string, environment: string, options?: ScopedListOptions): Promise<Page<VariableResource>>

Fetches one page of the variables in an environment, sorted by name A to Z. Soft deleted variables are excluded.

Every value and defaultValue comes back as ciphertext, because the server holds no key material and cannot decrypt anything. Run each one through decryptValue with the workspace passphrase and the workspaceId from envless.me.get(). Rows written before ciphertext was enforced can still hold plaintext, so test with isCiphertext rather than reading a failed decrypt as corruption. Pagination is limit and offset only, and a limit above 100 is rejected with 400 request.invalid_pagination rather than clamped.

Example

ts
const page = await envless.variables.list('api', 'production', { limit: 50 })

console.log(page.pagination.totalCount)
console.log(page.items.map((variable) => variable.name))

Parameters

ParameterTypeRequiredDescription
projectstringYesProject slug the environment belongs to.
environmentstringYesEnvironment slug to read variables from.
options.limitnumberNoPage size between 1 and 100.
options.offsetnumberNoNumber of variables to skip before the page starts.
options.productstringNoProduct slug, needed when the project slug is not unique in the workspace.
options.signalAbortSignalNoCancels the request.

Returns

Page<VariableResource> holding items plus a pagination envelope with totalCount and hasMore.

Reads the variables 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 project locked by the workspace plan refuses reads as well as writes, with 402 plan.upgrade_required.
  • A duplicate project slug across two products is 409 project.ambiguous_product. Retry with options.product.

Required scopes

variables:read

Underlying endpoint

GET /projects/{slug}/environments/{environmentSlug}/variables

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

In Python

envless.variables.list()

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

In Ruby

Envless.variables.list

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

In PHP

$envless->variables->list()

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