> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hopx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Environment Variables

> Get all global environment variables in the sandbox using the HopX VM Agent API. Retrieve environment variable values for configuration, debugging, or processing. Learn how to use GET /env endpoint to access all environment variables, handle sensitive values, and process environment data. Includes request examples and response formats.

Retrieve all global environment variables set in the sandbox. Sensitive values (containing KEY, SECRET, PASSWORD, TOKEN) are masked for security.

## Endpoint

```
GET /env
```

## Request

### Headers

```
Authorization: Bearer YOUR_JWT_TOKEN
```

### Example Request

```bash theme={null}
curl https://sandbox_abc123xyz.hopx.dev/env \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

## Response

### Success (200 OK)

```json theme={null}
{
  "env_vars": {
    "PATH": "/usr/local/bin:/usr/bin:/bin",
    "HOME": "/root",
    "DATABASE_URL": "postgres://localhost/mydb",
    "API_KEY": "***MASKED***",
    "SECRET_TOKEN": "***MASKED***"
  }
}
```

## Status Codes

| Code | Description  |
| ---- | ------------ |
| 200  | Success      |
| 401  | Unauthorized |

## Use Cases

### View All Variables

```bash theme={null}
curl https://sandbox_abc123xyz.hopx.dev/env \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" | jq '.env_vars'
```

### Check Specific Variable

```bash theme={null}
curl https://sandbox_abc123xyz.hopx.dev/env \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" | jq -r '.env_vars.DATABASE_URL'
```

## Related

* **SDK**: [sandbox.env.get()](/sdk/python/environment-variables#get) - Python SDK method
* [CLI Environment Variables](/cli/commands/env) - Environment variables from CLI

## Next Steps

* **[Set Environment Variables](/api/vm-agent/set-env)** - Replace all variables
* **[Update Environment Variables](/api/vm-agent/update-env)** - Merge variables
