post https://api.split.io/internal/api/v2/environments/ws/
Creates an environment
The Authorization Bearer (Admin API Key authorizing the request) must have one of the following roles and scopes:
- API_ALL_GRANTED
- API_ADMIN
- API_WORKSPACE_ADMIN
- GLOBAL
- WORKSPACE
To learn more about Admin API Key roles and scopes, see API keys overview.
With Skip Approvals
Skipping approvals requires passing the approvalSkippableBy attribute in the payload. However, it’s only allowed if the approvers are required or restricted. Also, as for this current version Administrators must be the only group that can skip the approvals.
curl --location --request POST 'https://app.split.io/internal/api/v2/environments/ws/12417780-8aa5-11ec-b903-d66b067dacc0' \
--header 'Authorization: Bearer <api_key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "workspace name",
"production": "false",
"changePermissions": {
"areApprovalsRequired": true,
"areApproversRestricted": true,
"approvers": [ ],
"areEditorsRestricted": false,
"editors": [],
"approvalSkippableBy": [
{
"id": "<admin_group_id>",
"name": "Administrators",
"type": "group"
}
]
},
"dataExportPermissions": {
"areExportersRestricted": false,
"exporters": []
},
"envType":"stage"
}'
{
"id": "<env_id>",
"type": "environment",
"name": "workspace_name",
"environmentType": "pre_production",
"changePermissions": {
"areApprovalsRequired": true,
"approvalSkippableBy": [
{
"id": "<admin_group_id>",
"name": "Administrators",
"type": "group"
}
]
},
"dataExportPermissions": {},
"orgId": "dd3c0800-30f1-11e7-ba78-12395d4a9634",
"creationTime": 1658765348027,
"production": false,
"status": "ACTIVE",
"workspaceIds": [
"12417780-8aa5-11ec-b903-d66b067dacc0"
],
"permissioningEnabled": false,
"apiTokens": [
{
"name": "client-side - 12417 - 1cda8",
"type": "api_key",
"id": "...",
"apiKeyType": "browser"
},
{
"name": "server-side",
"type": "api_key",
"id": "...",
"apiKeyType": "sdk"
}
]
}
{
"code": 400,
"message": "Only a single Administrators group can skip approval.",
"details": "",
"transactionId": "6959a5d1eb47893815fd14da8e699c24"
}
{
"code": 400,
"message": "Only Administrators group can skip approval. {id} is not an Administrators group.",
"details": "",
"transactionId": "5e85123605b9d50a6dde68b73144d34c"
}