---
title: "Retrieve a single variable"
method: GET
path: "/api/v4/projects/{id}/variables/{key}"
tags: ["ci_variables"]
---

# Retrieve a single variable

`GET /api/v4/projects/{id}/variables/{key}`

## Request

- Base URL: `https://gitlab.com`
- URL: `https://gitlab.com/api/v4/projects/{id}/variables/{key}`
- Auth: none declared

Retrieves details of a specified variable. If there are multiple variables with the same key, use `filter` to select the correct `environment_scope`.

## Path parameters

- `id` string, required
- `key` string, required

## Query parameters

- `filter[environment_scope]` string

## Response `200`

Retrieve a single variable

- APIEntitiesCiVariable: API_Entities_Ci_Variable model
  - `variable_type` string, required
  - `key` string, required
  - `value` string, required
  - `hidden` boolean
  - `protected` boolean
  - `masked` boolean
  - `raw` boolean
  - `environment_scope` string
  - `description` string

## Other responses

- `404`: Variable Not Found

---

[API](https://skmtc.dev/gitlab/apis/gitlab-api.md) - [All operations](https://skmtc.dev/gitlab/apis/gitlab-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gitlab/apis/gitlab-api/revisions/b234947ef3f2?raw)
