---
title: "Get one environment variable of a project by its ID"
method: GET
path: "/projects/{project_id}/env-vars/{var_id}"
tags: ["Projects"]
---

# Get one environment variable of a project by its ID

`GET /projects/{project_id}/env-vars/{var_id}`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/env-vars/{var_id}`
- Auth: HTTP bearer

Returns the variable exactly as the list does: a regular variable's value
is masked as `***` and a secret's is `null`. Read a regular value with
`GET /projects/{project_id}/env-vars/{key}/value?var_id={var_id}`, which
needs the reveal permission and is audit-logged.

## Path parameters

- `project_id` integer, required
- `var_id` integer, required

## Response `200`

The environment variable, value masked

- EnvironmentVariableResponse
  - `created_at` string, date-time, required
  - `environments` EnvironmentInfo[], required
    - `current_deployment_id` integer, nullable
    - `id` integer, required
    - `main_url` string, required
    - `name` string, required
  - `id` integer, required
  - `include_in_preview` boolean, required: Include this environment variable in preview environments
  - `is_secret` boolean, required: Whether the stored value is write-only. Marked secrets always have `value: None` in API responses and cannot be revealed.
  - `key` string, required
  - `secret_suggestion` SecretSuggestionResponse, nullable: Why a regular environment variable should probably be a secret.
    - `message` string, required: One sentence for the operator, e.g. "DATABASE_URL contains a password in its connection string".
    - `reason` 'connection_string_password' | 'private_key' | 'provider_token' | 'json_web_token' | 'credential_name', required: Why a regular variable looks like it holds a credential.
  - `updated_at` string, date-time, required
  - `value` string, nullable: Plaintext for regular variables in create/update responses, or `"***"` in list responses. Always `None` for marked secrets. Only regular variables can be read through the audited per-variable reveal endpoint.

## Other responses

- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Project or variable not found
- `500`: Internal server error

## Changes

- **2026-11-26** `e1864d950604`: 2 breaking
  - the `created_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `200`
  - the `updated_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `200`
- **2026-11-25** `cd6cbc9c9868`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/env-vars/:var_id/get.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
