Environments API
List and manage workspace environments used as promote and deploy targets.
Environments (typically dev, staging, prod) are created with a workspace and used by promotion and deploy flows.
See also: Environment Promotion · Workspaces
List / create (workspace)
| Method | Path | Permission | Notes |
|---|---|---|---|
GET | /v1/workspaces/{workspace_id}/environments | read | |
POST | same | write | Body: { "name": "qa" } |
PATCH | …/environments/{environment_id} | write | name?, status? (active|suspended), site_label?, site_access?, site_access_roles?. The site_* fields need ddl too; see Site settings |
DELETE | …/environments/{environment_id} | delete | 409 while it would open apps to more people; see Site settings |
Environment names start with a lowercase letter, then use lowercase letters, digits and hyphens, and end with a letter or digit (up to 63 characters, for example qa-1). Names are trimmed and lowercased; anything else is 422. Creating a name that already exists in the workspace is 409.
Each environment has id, workspace_id, name, status, created_at and the site fields below.
Site settings
Each environment can have its own Shell site; see A Shell site for each environment. Rolling out: until it's on for your region, site_host is null and site_access can't be changed from inherit (409).
| Field | Meaning |
|---|---|
site_label | The environment's name in its site address: {site}.{site_label}.app.groundfloor.cloud, where {site} is the workspace's subdomain, else its slug. prod is the plain {site}.app.groundfloor.cloud. Set from the name when the environment is created, unique in the workspace, and unchanged by a rename. null = no site of its own |
site_access | Who can open the site: inherit (default; the same people as prod), roles (only site users holding one of site_access_roles) or public (no sign-in) |
site_access_roles | The roles allowed with roles. Up to 50; Groundfloor's own system roles aren't allowed |
site_host | Read-only: the environment's site address, without a custom domain. null when sites per environment are off for your region, the environment is suspended, or its label has no site. With them on (shell_env_sites_enabled) and an active prod environment in the workspace, null means this environment's apps are on no Shell site |
PATCH body, for example:
{ "site_access": "roles", "site_access_roles": ["staff"] }- Send
"site_label": nullto remove the label. A label used by another environment of the workspace is409. Labels are one DNS label: lowercase letters, digits and-, up to 63 characters. Onlydev,stagingandprodget a site. rolesneeds at least one role (422).site_access_roleswith any other value is422; leavingrolesclears the list.publicis accepted only while the workspace's sign-in mode isnone(422otherwise). If sign-in is turned on later, a storedpubliccounts asinherit.inherit, and apps with no environment, follow the prod environment's rule. A storedrolesrule is applied even where sites per environment aren't on yet.- Changing any
site_*field needsddlon the workspace (Admin or Owner); site users get403. Changes are recorded in the audit log with the values before and after. DELETEof an environment withsite_access: "roles"is409while it has live apps. For the prod environment, removing or changing itsprodlabel is also409while live apps follow its rule. Setsite_accesstoinherit, or archive or move the apps, first.
GET /v1/me/capabilities also returns shell_env_sites_enabled (whether sites per environment are on for your region; site_access can be changed only then) and env_site_labels (the labels that get a site, for example ["dev", "staging", "prod"]).
Get by id
GET /v1/environments/{environment_id}Permission: read on the environment
Promote channels
Promotion is not a single environments endpoint — use the resource APIs:
| Channel | Compare / promote |
|---|---|
| Secrets | /v1/workspaces/{id}/secrets/compare|promote |
| Flags | Flags API |
| Apps | Apps API |
| Coderunners | Coderunners API |