getById(id: string, options?: RequestScope): Promise<VariableResource>Reads one live variable by id, without needing to know which project or environment it belongs to. Ids never change, so this is the stable address for sync clients and for ids arriving in webhook payloads, while get is the one to use when you know the environment and the human name.
The lookup is scoped to the workspace behind the key and joins through the environment and project, so a soft deleted variable, or one whose environment or project was deleted, is invisible and answers 404.
The response identifies its home only through environmentId. There is no project or environment slug in it, so keep your own mapping if you need to build a name addressed call afterwards.
Example
const variable = await envless.variables.getById('a7f2c1e0-8b4d-4c11-9f3a-2d5e6b7c8d90')
console.log(variable.name, variable.environmentId)Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Variable id from a list response or a webhook payload. |
options.signal | AbortSignal | No | Cancels the request. |
Returns
VariableResource for that id, with ciphertext value and defaultValue.
Worth knowing
- Existence is checked before the project restriction, so a 403 from a project restricted key confirms the variable exists.
- No
producthint is needed on the id routes, the lookup already resolves through the workspace.
Required scopes
variables:read
Underlying endpoint
GET /variables/{id}
Request and response schema, every error code, and a live playground.
In Python
envless.variables.get_by_id()
The same method in envless-sdk, the Python SDK, with the same request, retries and errors.
In Ruby
Envless.variables.get_by_id
The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.
In PHP
$envless->variables->getById()
The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.