Docs

Get a variable

GET
/variables/{variable_name}

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}.

Authorization

headerAuthorizationBearer <token>

Scope: variable.read

Path Parameters

variable_name*string

The name of the variable.

Match^\w+$
Length1 <= length <= 255

Query Parameters

project_id*string

The unique identifier of the project

Match^[a-zA-Z0-9_-]+$
kind?string

The kind of value to address. Omit it for both kinds.

Value in"primary""preview"

Response Body

The variable was retrieved successfully.

application/json
  1. response

One variable's values, per kind. A kind with no value is absent.

Properties1 <= properties
primary?|||

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.

Example Request
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" });
Example Response
{  "primary": "string",  "preview": "string"}

Was this helpful?