/ api reference
Environments
An environment is where a project's deployments run: production exists from the start, others such as staging are added as needed. Each has its own current deployment, domains and variables.
- get/environments/{environmentId}Get an environment
- get/projects/{projectId}/environmentsList a project's environments
- patch/environments/{environmentId}Rename an environment
- delete/environments/{environmentId}Delete an environment
- post/projects/{projectId}/environmentsCreate an environment
Get an environment
/api/v1/environments/{environmentId}The environment, its current deployment (activeDeploymentId) and its variables. A secret variable never carries its value. suspendedReason is inactive or hibernated when the environment was paused for inactivity.
Requires Viewer key or above (workspace.read)
Parameters
environmentIdstringin pathrequired
Responses
200The environment.Response fields
idstringrequiredprojectIdstringrequirednamestringrequiredworkerNamestringrequiredactiveDeploymentIdstring | nullrequiredsuspendedReason"inactive" | "hibernated" | nullrequiredsuspendedAtstring | nullrequiredneverHibernatebooleanrequiredvariablesobject[]required2 shapes
One of:
secret: false
keystringrequiredsecretfalserequiredvaluestringrequirednotestring | nullrequiredupdatedAtstringrequired
secret: true
keystringrequiredsecrettruerequirednotestring | nullrequiredupdatedAtstringrequired
createdAtstringrequired
404No such environment in this workspace.
List a project's environments
/api/v1/projects/{projectId}/environmentsOldest first, so the production environment (the project's productionEnvironmentId) comes first. Variables aren't included: get an environment for them.
Requires Viewer key or above (workspace.read)
Parameters
projectIdstringin pathrequired
Responses
200The environments.Response fields
idstringrequiredprojectIdstringrequirednamestringrequiredworkerNamestringrequiredactiveDeploymentIdstring | nullrequiredsuspendedReason"inactive" | "hibernated" | nullrequiredsuspendedAtstring | nullrequiredneverHibernatebooleanrequiredcreatedAtstringrequired
404No such project in this workspace.
Rename an environment
/api/v1/environments/{environmentId}Changes the name only: the environment keeps its id, deployments, domains and variables.
Requires Developer key or above (project.update)
Parameters
environmentIdstringin pathrequired
Body
namestringrequiredat most 19 characters · matches ^[a-z0-9-]+$
Responses
200The updated environment.Response fields
idstringrequiredprojectIdstringrequirednamestringrequiredworkerNamestringrequiredactiveDeploymentIdstring | nullrequiredsuspendedReason"inactive" | "hibernated" | nullrequiredsuspendedAtstring | nullrequiredneverHibernatebooleanrequiredvariablesobject[]required2 shapes
One of:
secret: false
keystringrequiredsecretfalserequiredvaluestringrequirednotestring | nullrequiredupdatedAtstringrequired
secret: true
keystringrequiredsecrettruerequirednotestring | nullrequiredupdatedAtstringrequired
createdAtstringrequired
404No such environment in this workspace.409The project already has an environment with that name.
Delete an environment
/api/v1/environments/{environmentId}Takes the environment offline and deletes its domains, environment variables and queued builds. A project's production environment can't be deleted: delete the project instead.
Requires Developer key or above (project.update)
Parameters
environmentIdstringin pathrequired
Responses
204Deleted.404No such environment in this workspace.409It's the project's production environment (code: production_environment).
Create an environment
/api/v1/projects/{projectId}/environmentsAdds an environment, such as staging, next to the project's production one. It has no deployment and no domain until you deploy to it.
Requires Developer key or above (project.update)
Parameters
projectIdstringin pathrequired
Body
namestringrequiredat most 19 characters · matches ^[a-z0-9-]+$
Responses
201The created environment.Response fields
idstringrequiredprojectIdstringrequirednamestringrequiredworkerNamestringrequiredactiveDeploymentIdstring | nullrequiredsuspendedReason"inactive" | "hibernated" | nullrequiredsuspendedAtstring | nullrequiredneverHibernatebooleanrequiredvariablesobject[]required2 shapes
One of:
secret: false
keystringrequiredsecretfalserequiredvaluestringrequirednotestring | nullrequiredupdatedAtstringrequired
secret: true
keystringrequiredsecrettruerequirednotestring | nullrequiredupdatedAtstringrequired
createdAtstringrequired
402The project already has as many environments as your plan allows (quota: environments).Body: see Errors
404No such project in this workspace.409The project already has an environment with that name.