Skip to content
Shoal
Shoal

API reference

Environments

List environments and create new ones.

List environments

GET/projects/{project}/environments

Returns all environments in display order.

Headers

Authorizationstringrequired
Bearer <token>

Path parameters

projectstringrequired
Project id, e.g. prj_8d2kq.

Request

Terminal
curl https://api.shoal.dev/v2/projects/prj_8d2kq/environments \
  -H "Authorization: Bearer $SHOAL_TOKEN"
TypeScript
const { data } = await api.environments.list("prj_8d2kq");
Python
envs = api.environments.list("prj_8d2kq")

Response

JSON
{
  "data": [
    { "key": "development", "protected": false, "color": "#5b8def" },
    { "key": "production", "protected": true, "color": "#e5484d" }
  ]
}

Create an environment

POST/projects/{project}/environments

Creates an environment and its server and client keys. Flags start switched off.

Headers

Authorizationstringrequired
Bearer <token>

Path parameters

projectstringrequired
Project id, e.g. prj_8d2kq.

Body parameters

keystringrequired
e.g. staging.
protectedbooleanoptionalDefault: false
Require comments (and optionally approvals) for changes.
copyFromstringoptional
Copy flag state from another environment.

Request

Terminal
curl -X POST https://api.shoal.dev/v2/projects/prj_8d2kq/environments \
  -H "Authorization: Bearer $SHOAL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "key": "staging", "copyFrom": "development" }'
TypeScript
const env = await api.environments.create("prj_8d2kq", { key: "staging", copyFrom: "development" });
Python
env = api.environments.create("prj_8d2kq", key="staging", copy_from="development")

Response

JSON
{
  "key": "staging",
  "protected": false,
  "keys": { "server": "sk_stg_…", "client": "ck_stg_…" }
}

Type to search. Results come from a local index — nothing leaves your browser.

↑ ↓ to navigate↵ to openMiniSearch · local