Ana içeriğe geç

List Environment Variables

Endpoint​

GET /apiops/projects/{projectName}/environmentVariables/

Authentication​

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request​

Headers​

HeaderValueRequired
AuthorizationBearer {token}Yes

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name (can be "admin" for admin project)

Query Parameters​

None.

Response​

Success Response (200 OK)​

{
"status": "SUCCESS",
"resultList": [
{
"projectId": "project-id",
"name": "API_BASE_URL",
"description": "Base URL for API calls",
"global": false,
"globalVisible": true,
"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,
"globalVisible": false,
"environmentValueList": null
}
],
"resultCount": 2
}

Response Fields​

FieldTypeDescription
statusstring"SUCCESS" when the request completes successfully
resultListarray[object]List of environment variables
resultCountintegerTotal number of environment variables

Environment Variable Object​

FieldTypeDescription
projectIdstringProject ID
namestringEnvironment variable name (unique identifier)
descriptionstringEnvironment variable description
globalbooleanWhether the variable is global (true) or environment-specific (false)
globalVisiblebooleanWhether global value is visible (if global=true)
projectNamestringProject name
environmentValueListarray[object]|nullList of environment-specific values (if global=false). See Environment Value Object

Environment Value Object (environmentValueList)​

FieldTypeDescription
environmentNamestringEnvironment name
valuestring|nullValue for this environment. Null if visible=false (secret)
visiblebooleanWhether the value may be read back. false marks it Secret. Does not control encryption: every value is stored encrypted

Notes​

  • All values are stored encrypted at rest. Values that are not Secret (visible=true / globalVisible=true) are returned decrypted in list responses, so a CI/CD pipeline can read the real configuration
  • Secret values (visible=false or globalVisible=false) are always returned as null and can never be read back through any endpoint
  • Global variables have global=true and use globalValue
  • Environment-specific variables have global=false and use environmentValueList
  • Empty list ([]) is returned if no variables exist
  • For admin project, all variables are returned (including from other projects)

Error Response (401 Unauthorized)​

{
"status": "FAILURE",
"resultMessage": "Token is not valid!"
}

Error Response (400 Bad Request)​

{
"status": "FAILURE",
"resultMessage": "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"

Permissions​

User must have GLOBAL_SETTINGS + VIEW permission in the project (or at least one project permission if the asset category is not configured). See Environment Variables API.

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
  • 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
  • Admin Project:

    • For admin project, all variables are returned
    • Includes variables from other projects