Create an environment
POST
/environments
Base URL
https://app.testsigma.com/api/v1
Create a new environment with variables for dynamic test configuration.
Authenticate with your API key as a
Bearer token in the
Authorization header. Generate a key →REQUEST BODY
name | Name of the new environment. |
description | Optional description. |
projectId | ID of the project to create the environment in. |
variables | Array of key-value pairs. Each entry needs key, value, isEncrypted, projectId. |
RESPONSE ATTRIBUTES
id | ID of the newly created environment. |
name | Environment name. |
variables | Created variables with generated IDs. |
REQUEST
curl -X POST \
'https://app.testsigma.com/api/v1/environments' \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"name": "QA Environment",
"description": "Environment for QA testing",
"projectId": 9,
"variables": [
{
"key": "Url",
"value": "https://qa.testsigma.com",
"isEncrypted": false,
"projectId": 9
},
{
"key": "ApiKey",
"value": "your-api-key",
"isEncrypted": true,
"projectId": 9
}
]
}'const response = await fetch('https://app.testsigma.com/api/v1/environments', {
method: 'POST',
headers: {
'Authorization': 'Bearer <API_KEY>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "QA Environment",
"description": "Environment for QA testing",
"projectId": 9,
"variables": [
{
"key": "Url",
"value": "https://qa.testsigma.com",
"isEncrypted": false,
"projectId": 9
},
{
"key": "ApiKey",
"value": "your-api-key",
"isEncrypted": true,
"projectId": 9
}
]
})
});
const data = await response.json();import requests
response = requests.post(
'https://app.testsigma.com/api/v1/environments',
headers={
'Authorization': 'Bearer <API_KEY>',
'Content-Type': 'application/json'
},
json={
"name": "QA Environment",
"description": "Environment for QA testing",
"projectId": 9,
"variables": [
{
"key": "Url",
"value": "https://qa.testsigma.com",
"isEncrypted": false,
"projectId": 9
},
{
"key": "ApiKey",
"value": "your-api-key",
"isEncrypted": true,
"projectId": 9
}
]
}
)
data = response.json()RESPONSE200OK
{
"id": 12,
"name": "QA Environment",
"description": "Environment for QA testing",
"projectId": 9,
"createdById": 9,
"createdDate": 1732300000000,
"variables": [
{
"id": 15,
"key": "Url",
"value": "https://qa.testsigma.com",
"isEncrypted": false,
"projectId": 9
}
]
}