def get(id, timeout: nil)def get: (String id, ?timeout: seconds?) -> version_detail_resourceReads one snapshot with the variables captured in it, addressed by version id and scoped to the workspace behind the key. There is no environment scoped read for a single version, ids are the only way in, and a label such as v3 is refused: this wants the uuid v7 id from a list row.
The returned value is a flattened version row plus a variables array of Hashes holding name and value, sorted by name, where value is the ciphertext exactly as it stood when the version was taken. Decrypt it with the workspace key that was in force at snapshot time, which is not necessarily the current one.
The snapshot also stores defaultValue, type, visibility and required per entry, and a rollback restores all of them, but this response deliberately exposes only name and value. Use Envless.versions.list_entries when you need the stored defaultValue ciphertext.
Example
require "envless/sdk"
id = "0191f0c4-6d2a-7c31-9a4b-8f2e1d5c7a90"
version = Envless.versions.get(id)
version[:variables].each do |variable|
puts "#{variable[:name]} #{variable[:value]}"
endParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | String | Yes | Version uniqueId, a uuid v7 taken from a list row. |
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
version_detail_resource, the version row plus a variables array of Hashes holding name and value, where value is ciphertext.
Worth knowing
- Requires both
versions:readandvariables:read. A key holding only one fails withauth.scope_missing. - The version lookup runs before the key project restriction, so a 403 here confirms the version exists while a 404 means it does not.
- A
valueofnilmeans the entry was captured with no value, not that the read was denied. - On the Free plan only the latest version of an environment is readable. Any older id fails with status 402 and code
plan.upgrade_required(error.resourceversion); older versions and rollback need Dev or above.
Required scopes
versions:read and variables:read
Underlying endpoint
GET /versions/{id}
Request and response schema, every error code, and a live playground.
In TypeScript
envless.versions.get()
The same method in @goenvless/sdk, with the same request, retries and errors.