Get a variable
Reads one variable by name, with its value per kind. A name with no
value for the requested kind answers var.not_found. A secret reads
back as {"secret": true}.
AuthorizationBearer <token>Scope: variable.read
variable_name*stringThe name of the variable.
^\w+$1 <= length <= 255project_id*stringThe unique identifier of the project
^[a-zA-Z0-9_-]+$kind?stringThe kind of value to address. Omit it for both kinds.
"primary""preview"The variable was retrieved successfully.
application/json- response
One variable's values, per kind. A kind with no value is absent.
1 <= propertiesprimary?|||One resolved variable. A non-secret variable is its value; a secret is an object saying so and withholding the value.
The two forms mirror the update body, so a value read here can be written back unchanged — with the one asymmetry that a secret read back has no value to write.
preview?|||One resolved variable. A non-secret variable is its value; a secret is an object saying so and withholding the value.
The two forms mirror the update body, so a value read here can be written back unchanged — with the one asymmetry that a secret read back has no value to write.
import { configureZitadel, getApi } from "@zitadel/api/config";// In the browser, through the SDK proxy: the session cookie authenticates the call.const client = getApi(configureZitadel({ projectId: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" }));const variable = await client.getVariable("GITHUB_CLIENT_ID", { project_id: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" });{ "primary": "string", "preview": "string"}Was this helpful?