Create a test environment, such as UAT or Staging, in a Jira space. Your automation can then use that name when recording Test Runs.
Endpoints
Action | Method | Endpoint |
Create a test environment | POST |
|
Confirm and use the environment | GET |
|
Add the endpoint path to your Vansah base URL.
Before you begin
Create a Vansah API token with Jira access configured for your workspace.
The token account needs Jira administrator or Jira space administrator permission for this operation.
Choose a name not already used by an active environment in that Jira space. You can list existing environments first.
This create endpoint rejects a new environment when the Jira space already has 50 active environment records.
The examples use Bash and cURL. Set VANSAH_URL to your Vansah base URL without a trailing slash and VANSAH_TOKEN to your API token. Replace the example name and Jira space key with your own values.
1. Prepare the JSON request
Endpoint: POST /api/v2/properties/environment
Save this complete body as environment.json to create UAT in the DEMO Jira space:
{
"name": "UAT",
"project": {
"key": "DEMO"
}
}
Parent object | JSON field | Type | Example value | Use |
Request body |
| String |
| Required. A nonempty name of 1–255 characters. Use a meaningful plain-text name. |
|
| String |
| The destination Jira space key. Include it in the request as shown. |
JSON path project.key refers to the Jira space key. Use the key inside the project object as shown. Avoid the placeholder name -, which is excluded from environment-list results.
2. Create the environment
Endpoint: POST /api/v2/properties/environment
curl --request POST \
--url "$VANSAH_URL/api/v2/properties/environment" \
--header "Authorization: $VANSAH_TOKEN" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data-binary @environment.json
Header | Value |
| Your Vansah API token directly, without a Bearer prefix. |
|
|
|
|
Run the command from the directory containing environment.json. This create request does not use pagination or filtering parameters.
3. Read the response
Endpoint: POST /api/v2/properties/environment
A successful creation returns HTTP 200. The response message is Updated successfully:
{
"success": true,
"message": "Updated successfully",
"data": {
"identifier": "f94d0e7d-1edb-41ed-bdf2-ae827922bf87",
"name": "UAT"
}
}
Response JSON path | How to use it |
| The saved environment name. Use it in Test Run requests that accept an environment name. |
| Save this returned value if you later follow an operation that requires an environment identifier, such as renaming the environment. |
The identifier shown is synthetic; use the value returned by your own request if it is needed later.
4. Confirm and use the environment
Endpoint: GET /api/v2/properties/environments
Look up the environment in the same Jira space:
curl --request GET --get \
--url "$VANSAH_URL/api/v2/properties/environments" \
--header "Authorization: $VANSAH_TOKEN" \
--header "Accept: application/json" \
--data-urlencode "projectKey=DEMO" \
--data-urlencode "startAt=0"
Find UAT in the returned names. See List Test Environments for the response and pagination.
Use that name in the environment property when you create a Test Run. To change it later, follow Update an Environment.
Errors and troubleshooting
An existing active name returns HTTP 400, for example:
{
"success": false,
"errorCode": 1390,
"message": "Duplicate environment(UAT)",
"data": []
}
HTTP status | Meaning |
| Invalid or missing name/space, duplicate name, 50-record creation limit, or a creation failure. |
| Missing, invalid, expired, or inactive token, missing Jira authorization, or a Jira permission lookup that rejects authentication. |
| The account is blocked or lacks administrator permission. |
| The Jira permission lookup is temporarily unavailable. This error uses errorCode 1400. |
Message or issue | What to check |
| Read JSON path |
| Reuse the existing environment or choose another name. Duplicate errors use errorCode 1390. |
| Review active environments in the Jira space before adding another. |
| Include the correct Jira space key in the project object. |
| Check Jira administrator or Jira space administrator permission for the token account. |
| Check the environment list before retrying. If the failure continues, contact Vansah Support with the request and response after removing the token. |
Validation responses can include an errors array without an error code. A successful retry may not be needed if the environment already appears in the list.
