> For the complete documentation index, see [llms.txt](https://docs.discloud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.discloud.com/en/api-and-integrations/api-overview/environment-variable.md).

# Environment variable

## List account variables

> Returns all environment variables in the account scope (decrypted).

```json
{"openapi":"3.0.3","info":{"title":"Discloud API","version":"2.0.0"},"tags":[{"name":"Environment Variables","description":"Operations about environment variables (account, project and app)"}],"servers":[{"url":"https://api.discloud.app/v2","description":"API Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"api-token"}},"schemas":{"Error":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/env/account":{"get":{"tags":["Environment Variables"],"summary":"List account variables","description":"Returns all environment variables in the account scope (decrypted).","operationId":"getAccountEnvVars","responses":{"200":{"description":"Variables returned successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Replace account variables

> Replaces the entire set of environment variables in the account scope.

```json
{"openapi":"3.0.3","info":{"title":"Discloud API","version":"2.0.0"},"tags":[{"name":"Environment Variables","description":"Operations about environment variables (account, project and app)"}],"servers":[{"url":"https://api.discloud.app/v2","description":"API Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"api-token"}},"schemas":{"Error":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/env/account":{"put":{"tags":["Environment Variables"],"summary":"Replace account variables","description":"Replaces the entire set of environment variables in the account scope.","operationId":"setAccountEnvVars","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["vars"],"properties":{"vars":{"type":"object","additionalProperties":{"type":"string"},"description":"Key/value map with the variables"}}}}}},"responses":{"200":{"description":"Variables saved successfully","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid variables","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Remove account variables

> Removes all environment variables in the account scope.

```json
{"openapi":"3.0.3","info":{"title":"Discloud API","version":"2.0.0"},"tags":[{"name":"Environment Variables","description":"Operations about environment variables (account, project and app)"}],"servers":[{"url":"https://api.discloud.app/v2","description":"API Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"api-token"}},"schemas":{"Error":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/env/account":{"delete":{"tags":["Environment Variables"],"summary":"Remove account variables","description":"Removes all environment variables in the account scope.","operationId":"deleteAccountEnvVars","responses":{"200":{"description":"Variables removed successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## List project variables

> Returns the environment variables of a project (decrypted). Requires project management permission.

```json
{"openapi":"3.0.3","info":{"title":"Discloud API","version":"2.0.0"},"tags":[{"name":"Environment Variables","description":"Operations about environment variables (account, project and app)"}],"servers":[{"url":"https://api.discloud.app/v2","description":"API Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"api-token"}},"schemas":{"Error":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/env/project/{projectID}":{"get":{"tags":["Environment Variables"],"summary":"List project variables","description":"Returns the environment variables of a project (decrypted). Requires project management permission.","operationId":"getProjectEnvVars","parameters":[{"name":"projectID","in":"path","required":true,"description":"Project ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Variables returned successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"No permission to access the project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Replace project variables

> Replaces the entire set of environment variables of a project.

```json
{"openapi":"3.0.3","info":{"title":"Discloud API","version":"2.0.0"},"tags":[{"name":"Environment Variables","description":"Operations about environment variables (account, project and app)"}],"servers":[{"url":"https://api.discloud.app/v2","description":"API Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"api-token"}},"schemas":{"Error":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/env/project/{projectID}":{"put":{"tags":["Environment Variables"],"summary":"Replace project variables","description":"Replaces the entire set of environment variables of a project.","operationId":"setProjectEnvVars","parameters":[{"name":"projectID","in":"path","required":true,"description":"Project ID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["vars"],"properties":{"vars":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"responses":{"200":{"description":"Variables saved successfully","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid variables","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"No permission to manage the project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Remove project variables

> Removes all environment variables of a project.

```json
{"openapi":"3.0.3","info":{"title":"Discloud API","version":"2.0.0"},"tags":[{"name":"Environment Variables","description":"Operations about environment variables (account, project and app)"}],"servers":[{"url":"https://api.discloud.app/v2","description":"API Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"api-token"}},"schemas":{"Error":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/env/project/{projectID}":{"delete":{"tags":["Environment Variables"],"summary":"Remove project variables","description":"Removes all environment variables of a project.","operationId":"deleteProjectEnvVars","parameters":[{"name":"projectID","in":"path","required":true,"description":"Project ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Variables removed successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"No permission to manage the project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## List app variables

> Returns the environment variables of an app (decrypted). Requires config\_app permission.

```json
{"openapi":"3.0.3","info":{"title":"Discloud API","version":"2.0.0"},"tags":[{"name":"Environment Variables","description":"Operations about environment variables (account, project and app)"}],"servers":[{"url":"https://api.discloud.app/v2","description":"API Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"api-token"}},"schemas":{"Error":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/env/app/{appID}":{"get":{"tags":["Environment Variables"],"summary":"List app variables","description":"Returns the environment variables of an app (decrypted). Requires config_app permission.","operationId":"getAppEnvVars","parameters":[{"name":"appID","in":"path","required":true,"description":"Application ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Variables returned successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"No permission to access the app","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Application not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Replace app variables

> Replaces the entire set of environment variables of an app.

```json
{"openapi":"3.0.3","info":{"title":"Discloud API","version":"2.0.0"},"tags":[{"name":"Environment Variables","description":"Operations about environment variables (account, project and app)"}],"servers":[{"url":"https://api.discloud.app/v2","description":"API Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"api-token"}},"schemas":{"Error":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/env/app/{appID}":{"put":{"tags":["Environment Variables"],"summary":"Replace app variables","description":"Replaces the entire set of environment variables of an app.","operationId":"setAppEnvVars","parameters":[{"name":"appID","in":"path","required":true,"description":"Application ID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["vars"],"properties":{"vars":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"responses":{"200":{"description":"Variables saved successfully","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid variables","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"No permission to manage the app","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Application not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Remove app variables

> Removes all environment variables of an app.

```json
{"openapi":"3.0.3","info":{"title":"Discloud API","version":"2.0.0"},"tags":[{"name":"Environment Variables","description":"Operations about environment variables (account, project and app)"}],"servers":[{"url":"https://api.discloud.app/v2","description":"API Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"api-token"}},"schemas":{"Error":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}},"paths":{"/env/app/{appID}":{"delete":{"tags":["Environment Variables"],"summary":"Remove app variables","description":"Removes all environment variables of an app.","operationId":"deleteAppEnvVars","parameters":[{"name":"appID","in":"path","required":true,"description":"Application ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Variables removed successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"No permission to manage the app","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Application not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```
