Environments
Preview

Create an environment

The caller becomes the environment's owner.

POST
/environments
cookiebetter-auth.session_token<token>

Better Auth session cookie. Production uses the __Secure- prefixed name.

Idempotency-Key?string

Makes retries safe. A repeated key with the same request returns the first result and sets Idempotent-Replayed: true. The same key with a different request answers 409 idempotency.key_reused, and while the first request is still running 409 idempotency.in_progress. Results are kept for 24 hours. Server errors and refusals for lack of sign-in or permission are not kept, so a retry runs again.

Match^[A-Za-z0-9_.:-]+$
Length1 <= length <= 255
application/json
  1. body
name*string
Length1 <= length <= 48
description?string
Lengthlength <= 500
class*string
Length1 <= length <= 40
order?integer

Leaving it out puts a new environment last and keeps an existing one where it is. comesAfter wins when both are sent.

Range0 <= value <= 10000
comesAfter?string

The id of the environment this one follows in the default order, or an empty string to put it first. The environments after that place move down one. Leaving it out keeps the place the environment has.

selector?

Up to 50 key and value pairs.

Propertiesproperties <= 50
archived?boolean
Defaultfalse

Response Body

The created environment.

application/json
  1. response
view*"full"
Value in"full"
id*string
Formatuuid
name*string
description*string
class*string

A label that says what kind of environment this is, such as production or staging.

order*integer

Place in lists, lowest first.

selector*

Up to 50 key and value pairs.

Propertiesproperties <= 50
archived*boolean
clusterCount*integer
deploymentCount*integer

The deployments placed in the environment or on one of its clusters. Set when one environment is read, 0 in a list.

pipelineCount*integer

The active pipelines with a stage in the environment. Set when one environment is read, 0 in a list.

owners*array<string>

User ids of the environment's owners, oldest first.

ownerTeam*|

The team that owns the environment, or null. People own it through the owner role.

createdAt*string
Formatdate-time
updatedAt*string
Formatdate-time
Example Request
curl -X POST 'https://wardn.example.com/api/v1/environments' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "class": "string"}'
Example Response
{  "view": "full",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "name": "string",  "description": "string",  "class": "production",  "order": 0,  "selector": {    "property1": "string",    "property2": "string"  },  "archived": true,  "clusterCount": 0,  "deploymentCount": 0,  "pipelineCount": 0,  "owners": [    "string"  ],  "ownerTeam": {    "id": "string",    "name": "string"  },  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}