Create Environment
POST https://api.getpostman.com/environments
A sample body is added to the request that conforms to the following JSON schema:
{
"type": "object",
"properties": {
"environment": {
"type": "object",
"properties": {
"name": {
"type": "string",
"maxLength": 254,
"minLength": 1
},
"values": {
"type": "array",
"maxItems": 100,
"additionalItems": false,
"items": {
"type": "object",
"properties": {
"key": {
"type": "string",
"maxLength": 254
"minLength": 1
},
"value": { "type": "string" },
"enabled": { "type": "boolean" }
},
"required": ["key", "value"]
}
}
},
"required": ["name"]
}
},
"required": ["environment"]
}
On successful creation of the environment, the API returns the environment name and id.
You can also specify the context of a workspace to create an environment in directly by passing the workspace as a query param.
Requires API Key as
X-Api-Keyrequest header orapikeyURL query parameter.
Request Params
| Key | Datatype | Required | Description |
|---|---|---|---|
workspace | string | Optional. A workspace ID. |
Request Body
{"environment"=>{"name"=>"{{environmentName}}", "values"=>[{"key"=>"{{environmentVariableName}}", "value"=>"{{environmentVariableValue}}"}]}}
HEADERS
| Key | Datatype | Required | Description |
|---|---|---|---|
Content-Type | string |
RESPONSES
status: OK
{"environment":{"id":"5daabc50-8451-43f6-922d-96b403b4f28e","name":"Test Environment","uid":"12345678-5daabc50-8451-43f6-922d-96b403b4f28e"}}