Dashboard
ReferenceEnvironments

Reorder environments

PUT
/api/v1/environments/order

Sets the order of every environment in the workspace. The dashboard lists environments in this order and opens the first one. A new environment copies its flag values from the last one.

Requires a management key.

Returns the environments in their new order. Returns 409 unless the list names every environment in the workspace exactly once.

Authorization

bearer
headerAuthorizationBearer <token>

Send a credential in the Authorization header: Authorization: Bearer <token>. Each credential belongs to one environment of one workspace, so the API never takes a workspace or environment in the URL.

  • Management key (ffk_…, secret): manages flags, segments, environments, and API keys, and reads the audit log and analytics. It can also do everything an evaluation key can.
  • Evaluation key (ffk_…, secret): for server SDKs. It evaluates flags, reads flag definitions for local evaluation, and sends telemetry.
  • Public token (ffp_…, not secret): for browser and mobile apps. It evaluates flags through OFREP and sends telemetry. It cannot read flag definitions.

Keep secret keys on your server. A 401 response means the credential is missing or not valid. A 403 response means the credential is valid but its role cannot perform the operation.

Request Body

application/json
  1. body

The new environment order.

environmentIds*array<string>

Every environment ID in the workspace, in the new order. Partial lists are rejected.

Items1 <= items

Response Body

OK

application/json
  1. response
[index: integer]?

A deployment stage in a workspace, such as development or production. Each environment has its own flag values, enabled states, and targeting rules. Every API key belongs to one environment.

Example Request
curl -X PUT 'https://api.toggld.io/api/v1/environments/order' \  -H 'Content-Type: application/json' \  -d '{  "environmentIds": [    "env_9a2c4e6b-1f3d-4b5a-8c7e-0d2f4a6c8e1b",    "env_3f6b2a9c-1d4e-4f7a-8b2c-5e9d0a1f3c7b"  ]}'
Example Response
[  {    "id": "env_3f6b2a9c-1d4e-4f7a-8b2c-5e9d0a1f3c7b",    "tenantId": "t_5b9e2c4a-8f1d-4a7c-b3e6-9d0c2f5a8b1e",    "isProduction": true,    "position": 1,    "color": "red",    "key": "production",    "name": "Production",    "createdAt": "2026-05-01T12:00:00.000Z"  }]