---
title: Get Environment Variable
description: Retrieves a specific environment variable for a given project by its ID, including its value.
docs_index: /docs/llms.txt
lastUpdated: 2026-10-23
product: v0 API
type: reference
prerequisites:
  - /docs/api/v1/quickstart
related:
  - /docs/api/v2/guides/environment-variables
---

> For an index of all documentation, see [/docs/llms.txt](/docs/llms.txt).

Retrieves a specific environment variable for a given project by its ID, including its value.

#### `GET /v1/projects/{projectId}/env-vars/{environmentVariableId}`

> **Deprecated**: v1 environment variables were connected to v0 Projects, which are deprecated. To read environment variables for a chat, see the [Environment Variables guide](/docs/api/v2/guides/environment-variables).

## Usage

```typescript
import { v0 } from 'v0-sdk'

const result = await v0.projects.getEnvVar({
  projectId: 'project_abc123',
  environmentVariableId: 'env_def456',
  decrypted: 'true',
})

console.log(result)
```

```bash
curl -X GET https://api.v0.dev/v1/projects/project_abc123/env-vars/env_def456?decrypted=true   -H "Authorization: Bearer $V0_API_KEY"   -H "Content-Type: application/json"
```

## API Signature

### Request

#### Path Parameters

- `projectId: string` The unique identifier of the project that owns the environment variable.
- `environmentVariableId: string` The unique identifier of the environment variable to retrieve.

#### Query Parameters

- `decrypted?: 'true' | 'false'` Whether to return decrypted values. Defaults to false (encrypted).

### Response

- `object: 'environment_variable'`
- `data: object`

---

For a semantic overview of all documentation, see [/docs/sitemap.md](/docs/sitemap.md)

For an index of all available documentation, see [/docs/llms.txt](/docs/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/docs/agents.md](/docs/agents.md)