Skip to main content

App Environments API

The App Environments API allows you to manage app environments in Quave Cloud. You can create, retrieve, and delete app environments.

Make sure to read the Get Started document to understand how the API works.

Note: All endpoints in this API accept only the user token.

Create App Environment

To create a new app environment, send a POST request to the /api/public/v1/app-env endpoint. Below are the required fields:

FieldTypeDescription
accountIdStringThe ID of the account.
appIdStringThe ID of the app.
nameStringThe name of the app environment.
regionStringThe region for the app environment (must be one of the allowed values).

Optional fields:

FieldTypeDescription
branchStringThe Git branch to use. Required for apps that use GitHub.
zCloudsNumberThe number of zClouds to use (1, 2, 4, or 8). Defaults to 1.
envVarsArrayThe environment variables to set in the app environment. See Environment Variables Object for more details.

Example:

curl -X POST \
-H 'Authorization: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"accountId": "5f7b1b7b7b7b7b7b7b7b7b7b",
"appId": "5f7b1b7b7b7b7b7b7b7b7b7c",
"name": "Production",
"region": "us-5",
"branch": "main",
"zClouds": 2
}' \
https://api.quave.cloud/api/public/v1/app-env

Example Response:

{
"appEnvId": "5f7b1b7b7b7b7b7b7b7b7b7d"
}

The response contains the appEnvId of the newly created app environment.

Get App Environment

To retrieve an app environment, send a GET request to the /api/public/v1/app-env endpoint. You need to provide the appEnvId as a query parameter.

Query Parameters

ParameterTypeRequiredDescription
appEnvIdStringYesThe ID of the app environment to retrieve.
decryptBooleanNoWhether to decrypt secret environment variables. Defaults to false. Requires admin permission.

Basic Example (without decryption)

curl -X GET \
-H 'Authorization: YOUR_TOKEN' \
https://api.quave.cloud/api/public/v1/app-env?appEnvId=5f7b1b7b7b7b7b7b7b7b7b7d

Example Response:

{
"appEnvId": "5f7b1b7b7b7b7b7b7b7b7b7d",
"name": "Production",
"slug": "production",
"region": "us-5",
"gitBranch": "main",
"cliEnvName": null,
"allowUserCliToken": false,
"envVars": [
{
"_id": "abc123",
"name": "PUBLIC_VAR",
"value": "some-value",
"type": "DEPLOY",
"isSecret": false
},
{
"_id": "def456",
"name": "SECRET_KEY",
"value": "***SECRET***",
"type": "DEPLOY",
"isSecret": true
}
]
}

Example with Decryption (Admin Only)

To decrypt secret environment variables, add decrypt=true as a query parameter. This requires admin permission on the account.

curl -X GET \
-H 'Authorization: YOUR_TOKEN' \
'https://api.quave.cloud/api/public/v1/app-env?appEnvId=5f7b1b7b7b7b7b7b7b7b7b7d&decrypt=true'

Example Response:

{
"appEnvId": "5f7b1b7b7b7b7b7b7b7b7b7d",
"name": "Production",
"slug": "production",
"region": "us-5",
"gitBranch": "main",
"cliEnvName": null,
"allowUserCliToken": false,
"envVars": [
{
"_id": "abc123",
"name": "PUBLIC_VAR",
"value": "some-value",
"type": "DEPLOY",
"isSecret": false
},
{
"_id": "def456",
"name": "SECRET_KEY",
"value": "actual-secret-value-123",
"type": "DEPLOY",
"isSecret": true
}
]
}

If the user does not have admin permission, the API will return:

{
"error": "Admin permission required to decrypt secrets"
}

Response Fields

The response contains various fields describing the app environment configuration. Below are the fields returned:

FieldTypeDescription
appEnvIdStringThe app environment ID.
nameStringThe name of the app environment.
slugStringThe slug of the app environment.
regionStringThe region for the app environment.
gitBranchStringThe Git branch used for the app environment. For apps that don't use GitHub, the value will be cli.
cliEnvNameStringThe CLI environment name.
allowUserCliTokenBooleanWhether the app environment allows user CLI tokens for deployments.
envVarsArrayArray of environment variables. See Environment Variables Object.

Note: Secret environment variables will have their values masked as ***SECRET*** unless decrypt=true is provided with admin credentials.

Update App Environment

To update an existing app environment, send a PUT request to the /api/public/v1/app-env endpoint. All fields are optional - only provide the fields you want to update.

Request Body Fields

FieldTypeRequiredDescription
appEnvIdStringYesThe ID of the app environment to update.
nameStringNoThe new name for the app environment.
regionStringNoThe new region for the app environment (must be one of the allowed values).
branchStringNoThe new Git branch to use. Cannot be empty for apps that use GitHub.
zCloudsNumberNoThe new number of zClouds to use (1, 2, 4, or 8).
envVarsArrayNoThe new environment variables. See Environment Variables Object.

Note: When updating envVars, the entire array replaces the existing environment variables. Make sure to include all environment variables you want to keep.

Example: Update Name and zClouds

curl -X PUT \
-H 'Authorization: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"appEnvId": "5f7b1b7b7b7b7b7b7b7b7b7d",
"name": "Production v2",
"zClouds": 4
}' \
https://api.quave.cloud/api/public/v1/app-env

Example: Update Environment Variables

curl -X PUT \
-H 'Authorization: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"appEnvId": "5f7b1b7b7b7b7b7b7b7b7b7d",
"envVars": [
{
"name": "API_KEY",
"value": "new-api-key-value",
"type": "DEPLOY",
"isSecret": true
},
{
"name": "DEBUG",
"value": "true",
"type": "BOTH",
"isSecret": false
}
]
}' \
https://api.quave.cloud/api/public/v1/app-env

Example Response

{
"appEnvId": "5f7b1b7b7b7b7b7b7b7b7b7d"
}

Notes

  • Secret environment variables will be automatically encrypted before storage
  • If you're updating the region, the system will mark the environment as "changing region" and trigger necessary infrastructure updates
  • Changes to resources (zClouds), branch, or environment variables will generate "pending changes" that will be applied on the next deployment

Delete App Environment

To delete an app environment, send a DELETE request to the /api/public/v1/app-env endpoint. You need to provide the appEnvId as a query parameter.

Example:

curl -X DELETE \
-H 'Authorization: YOUR_TOKEN' \
https://api.quave.cloud/api/public/v1/app-env?appEnvId=5f7b1b7b7b7b7b7b7b7b7b7d

Example Response:

{
"message": "App Env deleted successfully"
}

Note: Deleting an app environment may have significant consequences. Make sure you want to perform this action before proceeding.

Environment Variables Object

The envVars field is an array of environment variables. Each environment variable is an object with the following fields:

FieldTypeDescription
nameStringThe environment variable name.
valueStringThe environment variable value.
typeStringThe type of the environment variable. Possible values are DEPLOY, BUILD, or BOTH.
isSecretBooleanWhether the environment variable is secret and should be encrypted.