List Environment Variables
Overview
Retrieves all environment variables for a specified project. Environment variables can be global (same value for all environments) or environment-specific (different values per environment).
Endpoint
GET /apiops/projects/{projectName}/environmentVariables/
Authentication
Requires a Personal API Access Token.
Header
Authorization: Bearer YOUR_TOKEN
Request
Headers
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer {token} | Yes |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name (can be “admin” for admin project) |
Query Parameters
None.
Response
Success Response (200 OK)
{
"success": true,
"resultList": [
{
"projectId": "project-id",
"name": "API_BASE_URL",
"description": "Base URL for API calls",
"global": false,
"globalValue": null,
"globalVisible": true,
"projectName": "MyProject",
"environmentValueList": [
{
"environmentName": "production",
"value": "https://api.production.example.com",
"visible": true
},
{
"environmentName": "staging",
"value": "https://api.staging.example.com",
"visible": true
}
]
},
{
"projectId": "project-id",
"name": "API_KEY",
"description": "API Key for external service",
"global": true,
"globalValue": "secret-api-key-12345",
"globalVisible": false,
"projectName": "MyProject",
"environmentValueList": null
}
],
"resultCount": 2
}
Response Fields
| Field | Type | Description |
|---|---|---|
| success | boolean | Indicates if the request was successful |
| resultList | array[object] | List of environment variables |
| resultCount | integer | Total number of environment variables |
Environment Variable Object
| Field | Type | Description |
|---|---|---|
| projectId | string | Project ID |
| name | string | Environment variable name (unique identifier) |
| description | string | Environment variable description |
| global | boolean | Whether the variable is global (true) or environment-specific (false) |
| globalValue | string|null | Global value (if global=true). Null if globalVisible=false (secret) |
| globalVisible | boolean | Whether global value is visible (if global=true) |
| projectName | string | Project name |
| environmentValueList | array[object]|null | List of environment-specific values (if global=false). See Environment Value Object |
Environment Value Object (environmentValueList)
| Field | Type | Description |
|---|---|---|
| environmentName | string | Environment name |
| value | string|null | Value for this environment. Null if visible=false (secret) |
| visible | boolean | Whether the value is visible (not secret) |
Notes
- Secret values (
visible=falseorglobalVisible=false) are masked (returned asnull) in list responses - Global variables have
global=trueand useglobalValue - Environment-specific variables have
global=falseand useenvironmentValueList - Empty list (
[]) is returned if no variables exist - For admin project, all variables are returned (including from other projects)
Error Response (401 Unauthorized)
{
"error": "unauthorized_client",
"error_description": "Invalid token"
}
Error Response (404 Not Found)
{
"error": "not_found",
"error_description": "Project(MyProject) was not found or user does not have privilege to access it!"
}
cURL Example
curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/environmentVariables/" \
-H "Authorization: Bearer YOUR_TOKEN"
Notes and Warnings
- Secret Values:
- Secret values are masked (returned as
null) in list responses - Use Get Environment Variable endpoint to retrieve values if you have permission
- Secret values are masked (returned as
- Global vs Environment-Specific:
- Global variables (
global=true) have a single value for all environments - Environment-specific variables (
global=false) have different values per environment
- Global variables (
- Admin Project:
- For admin project, all variables are returned
- Includes variables from other projects
- Permissions:
- Requires
ROLE_API_SECURITYpermission - User must have access to the project
- Requires
Related Documentation
- Get Environment Variable - Get a specific environment variable
- Create Environment Variable - Create a new environment variable