Creates a new cloud environment to host Agent sessions.
Request headers
|
Header |
Required |
Description |
|
|
Yes |
|
|
|
Yes |
|
Request body
|
Parameter |
Type |
Required |
Description |
|
|
string |
Yes |
The name of the environment. |
|
|
string |
No |
A description of the environment. |
|
|
object |
Yes |
The environment configuration. |
|
|
string |
Yes |
The environment type. The value is always |
|
|
object |
No |
Network access configuration. |
|
|
string |
No |
The network type. Valid values are |
|
|
array |
No |
A list of hosts to allow network access to. Required when the network type is |
|
|
boolean |
No |
Whether to allow package managers to access the network. |
|
|
object |
No |
Specifies packages to pre-install. |
|
|
array |
No |
A list of apt packages to pre-install. |
|
|
array |
No |
A list of pip packages to pre-install. |
|
|
array |
No |
A list of npm packages to pre-install. |
|
|
object |
No |
A set of key-value pairs to associate with the environment. |
Example request
curl -s -X POST "https://api.qoder.com.cn/api/v1/cloud/environments" \
-H "Authorization: Bearer $QODER_PAT" \
-H "Content-Type: application/json" \
-d '{
"name": "doc-test-env",
"config": {
"type": "cloud",
"networking": {
"type": "limited"
},
"packages": {
"apt": ["curl"]
}
}
}'
Example response
HTTP 201 Created
{
"id": "env_019e3bb39b6774d8878cd0b9d237574b",
"type": "environment",
"name": "doc-test-env",
"description": "",
"status": "ready",
"config": {
"type": "cloud",
"networking": {
"type": "limited"
},
"packages": {
"apt": ["curl"]
}
},
"archived": false,
"archived_at": null,
"created_at": "2026-05-18T15:28:07.017808Z",
"updated_at": "2026-05-18T15:28:07.017808Z"
}
Response fields
|
Parameter |
Type |
Description |
|
|
string |
The unique identifier for the environment. The value is prefixed with |
|
|
string |
The resource type. The value is always |
|
|
string |
The name of the environment. |
|
|
string |
The description of the environment. |
|
|
string |
The status of the environment. Possible values are |
|
|
object |
The environment configuration. |
|
|
boolean |
Indicates whether the environment is archived. |
|
|
string|null |
The ISO 8601 timestamp when the environment was archived. Returns |
|
|
string |
The ISO 8601 timestamp when the environment was created. |
|
|
string |
The ISO 8601 timestamp when the environment was last updated. |
Error codes
|
HTTP |
Type |
Description |
|
400 |
|
The request parameters are invalid. For example, the |
|
401 |
|
Authentication failed. The Personal Access Token (PAT) is invalid or has expired. |
|
403 |
|
You do not have permission to perform this action. |
|
409 |
|
An environment with the same name already exists. |