Postman API
  1. Environments
Postman API
  • API
    • Get all APIs
      GET
    • Create API
      POST
    • Delete an API
      DELETE
    • Single API
      GET
    • Update an API
      PUT
    • Get All API Versions
      GET
    • Create API Version
      POST
    • Delete an API Version
      DELETE
    • Get an API Version
      GET
    • Update an API Version
      PUT
    • Get contract test relations
      GET
    • Get documentation relations
      GET
    • Get environment relations
      GET
    • Get integration test relations
      GET
    • Get monitor relations
      GET
    • Get linked relations
      GET
    • Create relations
      POST
    • Create Schema
      POST
    • Get Schema
      GET
    • Update Schema
      PUT
    • Create collection from schema
      POST
    • Get test suite relations
      GET
    • Sync relations with schema
      PUT
  • Collections
    • All Collections
    • Create Collection
    • Create a Fork
    • Merge a Fork
    • Delete Collection
    • Single Collection
    • Update Collection
  • Environments
    • All Environments
      GET
    • Create Environment
      POST
    • Delete Environment
      DELETE
    • Single Environment
      GET
    • Update Environment
      PUT
  • Import
    • Import exported data
    • Import external API specification
  • User
    • API Key Owner
  • Mocks
    • All Mocks
    • Create Mock
    • Delete Mock
    • Single Mock
    • Update Mock
    • Publish Mock
    • Unpublish Mock
  • Monitors
    • All Monitors
    • Create Monitor
    • Delete Monitor
    • Single Monitor
    • Update Monitor
    • Run a Monitor
  • Webhooks
    • Create Webhook
  • Workspaces
    • All workspaces
    • Create Workspace
    • Delete Workspace
    • Single workspace
    • Update Workspace
  1. Environments

Create Environment

POST
/environments
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-Key request header or apikey URL query parameter.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.getpostman.com/environments' \
--header 'Content-Type: application/json' \
--data-raw '{
    "environment": {
        "name": "Sample Environment Name (required)",
        "values": [
            {
                "key": "variable_name_1",
                "value": "The value of the variable"
            },
            {
                "key": "variable_name_2",
                "value": ""
            }
        ]
    }
}'
Response Response Example
200 - Successful Response
{
  "environment": {
    "id": "f158266e-306b-4702-a2b9-e4ede7878b7a",
    "name": "Sample Environment Name (required)",
    "uid": "5665-f158266e-306b-4702-a2b9-e4ede7878b7a"
  }
}

Request

Body Params application/json
environment
object 
optional
name
string 
optional
Example:
Sample Environment Name (required)
values
array [object {2}] 
optional
Examples

Responses

🟢200Successful Response
application/json
Body
environment
object 
optional
id
string 
optional
Example:
f158266e-306b-4702-a2b9-e4ede7878b7a
name
string 
optional
Example:
Sample Environment Name (required)
uid
string 
optional
Example:
5665-f158266e-306b-4702-a2b9-e4ede7878b7a
🟠400Failure Response
Previous
All Environments
Next
Delete Environment
Built with