curl --request POST \
--url https://api.empirical.run/api/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>",
"playwright_projects_match": [
"<string>"
],
"playwright_projects_ignore": [
"<string>"
],
"scheduled_trigger": "<string>",
"scheduled_concurrency": {
"group": "<string>"
}
}
'import requests
url = "https://api.empirical.run/api/environments"
payload = {
"name": "<string>",
"slug": "<string>",
"playwright_projects_match": ["<string>"],
"playwright_projects_ignore": ["<string>"],
"scheduled_trigger": "<string>",
"scheduled_concurrency": { "group": "<string>" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
slug: '<string>',
playwright_projects_match: ['<string>'],
playwright_projects_ignore: ['<string>'],
scheduled_trigger: '<string>',
scheduled_concurrency: {group: '<string>'}
})
};
fetch('https://api.empirical.run/api/environments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.empirical.run/api/environments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'slug' => '<string>',
'playwright_projects_match' => [
'<string>'
],
'playwright_projects_ignore' => [
'<string>'
],
'scheduled_trigger' => '<string>',
'scheduled_concurrency' => [
'group' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.empirical.run/api/environments"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"playwright_projects_match\": [\n \"<string>\"\n ],\n \"playwright_projects_ignore\": [\n \"<string>\"\n ],\n \"scheduled_trigger\": \"<string>\",\n \"scheduled_concurrency\": {\n \"group\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.empirical.run/api/environments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"playwright_projects_match\": [\n \"<string>\"\n ],\n \"playwright_projects_ignore\": [\n \"<string>\"\n ],\n \"scheduled_trigger\": \"<string>\",\n \"scheduled_concurrency\": {\n \"group\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.empirical.run/api/environments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"playwright_projects_match\": [\n \"<string>\"\n ],\n \"playwright_projects_ignore\": [\n \"<string>\"\n ],\n \"scheduled_trigger\": \"<string>\",\n \"scheduled_concurrency\": {\n \"group\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"environment": {
"id": 123,
"project_id": 123,
"slug": "<string>",
"name": "<string>",
"playwright_projects_match": [
"<string>"
],
"playwright_projects_ignore": [
"<string>"
],
"is_disabled": true,
"env_files": [
"<string>"
],
"scheduled_trigger": "<string>",
"scheduled_concurrency": {
"group": "<string>",
"on_conflict": "cancel"
},
"reporter_config": {
"schema_version": 1,
"reporters": [
{
"reporter_type": "slack_run_status",
"slack_channel_ids": [
2
]
}
]
},
"created_at": "<string>",
"updated_at": "<string>"
}
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}Create an environment
Creates an environment in the scoped project. Rejected for projects managed by environments.yaml.
curl --request POST \
--url https://api.empirical.run/api/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>",
"playwright_projects_match": [
"<string>"
],
"playwright_projects_ignore": [
"<string>"
],
"scheduled_trigger": "<string>",
"scheduled_concurrency": {
"group": "<string>"
}
}
'import requests
url = "https://api.empirical.run/api/environments"
payload = {
"name": "<string>",
"slug": "<string>",
"playwright_projects_match": ["<string>"],
"playwright_projects_ignore": ["<string>"],
"scheduled_trigger": "<string>",
"scheduled_concurrency": { "group": "<string>" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
slug: '<string>',
playwright_projects_match: ['<string>'],
playwright_projects_ignore: ['<string>'],
scheduled_trigger: '<string>',
scheduled_concurrency: {group: '<string>'}
})
};
fetch('https://api.empirical.run/api/environments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.empirical.run/api/environments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'slug' => '<string>',
'playwright_projects_match' => [
'<string>'
],
'playwright_projects_ignore' => [
'<string>'
],
'scheduled_trigger' => '<string>',
'scheduled_concurrency' => [
'group' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.empirical.run/api/environments"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"playwright_projects_match\": [\n \"<string>\"\n ],\n \"playwright_projects_ignore\": [\n \"<string>\"\n ],\n \"scheduled_trigger\": \"<string>\",\n \"scheduled_concurrency\": {\n \"group\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.empirical.run/api/environments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"playwright_projects_match\": [\n \"<string>\"\n ],\n \"playwright_projects_ignore\": [\n \"<string>\"\n ],\n \"scheduled_trigger\": \"<string>\",\n \"scheduled_concurrency\": {\n \"group\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.empirical.run/api/environments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"playwright_projects_match\": [\n \"<string>\"\n ],\n \"playwright_projects_ignore\": [\n \"<string>\"\n ],\n \"scheduled_trigger\": \"<string>\",\n \"scheduled_concurrency\": {\n \"group\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"environment": {
"id": 123,
"project_id": 123,
"slug": "<string>",
"name": "<string>",
"playwright_projects_match": [
"<string>"
],
"playwright_projects_ignore": [
"<string>"
],
"is_disabled": true,
"env_files": [
"<string>"
],
"scheduled_trigger": "<string>",
"scheduled_concurrency": {
"group": "<string>",
"on_conflict": "cancel"
},
"reporter_config": {
"schema_version": 1,
"reporters": [
{
"reporter_type": "slack_run_status",
"slack_channel_ids": [
2
]
}
]
},
"created_at": "<string>",
"updated_at": "<string>"
}
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Display name.
1URL-friendly identifier; unique within the project.
1Playwright project names to include. Items must not start with '!'.
Playwright project names to exclude.
Cron expression for scheduled triggers, or null.
Concurrency group and policy scheduled runs are triggered with. Omit to keep the current value; null to fall back to the project's legacy concurrency setting.
Show child attributes
Show child attributes
Reporter configuration for the environment. Slack channel ids must be active registered channels of the project's organization (GET /api/v2/slack/channels).
Show child attributes
Show child attributes
Response
The created environment.
Response payload.
Show child attributes
Show child attributes
Was this page helpful?