curl --request POST \
--url https://api.tela.com/environment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"resourceType": "prompt",
"resourceId": "95cec438-6080-44fe-8275-28b16bd40178",
"name": "staging"
}
'import requests
url = "https://api.tela.com/environment"
payload = {
"resourceType": "prompt",
"resourceId": "95cec438-6080-44fe-8275-28b16bd40178",
"name": "staging"
}
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({
resourceType: 'prompt',
resourceId: '95cec438-6080-44fe-8275-28b16bd40178',
name: 'staging'
})
};
fetch('https://api.tela.com/environment', 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.tela.com/environment",
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([
'resourceType' => 'prompt',
'resourceId' => '95cec438-6080-44fe-8275-28b16bd40178',
'name' => 'staging'
]),
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.tela.com/environment"
payload := strings.NewReader("{\n \"resourceType\": \"prompt\",\n \"resourceId\": \"95cec438-6080-44fe-8275-28b16bd40178\",\n \"name\": \"staging\"\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.tela.com/environment")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"resourceType\": \"prompt\",\n \"resourceId\": \"95cec438-6080-44fe-8275-28b16bd40178\",\n \"name\": \"staging\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tela.com/environment")
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 \"resourceType\": \"prompt\",\n \"resourceId\": \"95cec438-6080-44fe-8275-28b16bd40178\",\n \"name\": \"staging\"\n}"
response = http.request(request)
puts response.read_body{
"id": "2f1c9a7e-3b4d-4e5f-8a6b-1c2d3e4f5a6b",
"resourceType": "prompt",
"resourceId": "95cec438-6080-44fe-8275-28b16bd40178",
"name": "staging",
"isSystem": false,
"currentVersionId": null,
"workspaceId": "3f55cfd9-4427-4887-a181-d9ad39967802",
"createdBy": "jane@example.com",
"deletedBy": null,
"createdAt": "2025-06-01T12:00:00.000Z",
"updatedAt": "2025-06-01T12:00:00.000Z",
"deletedAt": null
}Create environment
Creates a custom environment for a canvas. The name is trimmed and must satisfy the environment name rules: lowercase letters, digits and single hyphens, at most 64 characters, not a reserved name (production, promoted, latest, draft) and not a UUID.
curl --request POST \
--url https://api.tela.com/environment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"resourceType": "prompt",
"resourceId": "95cec438-6080-44fe-8275-28b16bd40178",
"name": "staging"
}
'import requests
url = "https://api.tela.com/environment"
payload = {
"resourceType": "prompt",
"resourceId": "95cec438-6080-44fe-8275-28b16bd40178",
"name": "staging"
}
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({
resourceType: 'prompt',
resourceId: '95cec438-6080-44fe-8275-28b16bd40178',
name: 'staging'
})
};
fetch('https://api.tela.com/environment', 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.tela.com/environment",
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([
'resourceType' => 'prompt',
'resourceId' => '95cec438-6080-44fe-8275-28b16bd40178',
'name' => 'staging'
]),
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.tela.com/environment"
payload := strings.NewReader("{\n \"resourceType\": \"prompt\",\n \"resourceId\": \"95cec438-6080-44fe-8275-28b16bd40178\",\n \"name\": \"staging\"\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.tela.com/environment")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"resourceType\": \"prompt\",\n \"resourceId\": \"95cec438-6080-44fe-8275-28b16bd40178\",\n \"name\": \"staging\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tela.com/environment")
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 \"resourceType\": \"prompt\",\n \"resourceId\": \"95cec438-6080-44fe-8275-28b16bd40178\",\n \"name\": \"staging\"\n}"
response = http.request(request)
puts response.read_body{
"id": "2f1c9a7e-3b4d-4e5f-8a6b-1c2d3e4f5a6b",
"resourceType": "prompt",
"resourceId": "95cec438-6080-44fe-8275-28b16bd40178",
"name": "staging",
"isSystem": false,
"currentVersionId": null,
"workspaceId": "3f55cfd9-4427-4887-a181-d9ad39967802",
"createdBy": "jane@example.com",
"deletedBy": null,
"createdAt": "2025-06-01T12:00:00.000Z",
"updatedAt": "2025-06-01T12:00:00.000Z",
"deletedAt": null
}Authorizations
Body
Environment name. Lowercase letters, digits and single hyphens between segments (no leading, trailing or consecutive hyphens), at most 64 characters. Leading/trailing whitespace is trimmed before validation.
production is the system environment every canvas has; it is the only reserved name you can publish to.
The names production, promoted, latest and draft are reserved and cannot be used for custom
environments, and a custom name cannot be a UUID.
The same rules apply to the environment_name field of POST /v2/chat/completions, which runs the
version currently published to that environment of the given canvas_id (environment_name cannot be
combined with version_id or application_id, and returns 404 when the environment does not exist or
has no published version).
64^[a-z0-9]+(?:-[a-z0-9]+)*$"staging"
Response
Environment created
An environment of a canvas. Timestamps are ISO 8601 strings.
Environment name. Lowercase letters, digits and single hyphens between segments (no leading, trailing or consecutive hyphens), at most 64 characters. Leading/trailing whitespace is trimmed before validation.
production is the system environment every canvas has; it is the only reserved name you can publish to.
The names production, promoted, latest and draft are reserved and cannot be used for custom
environments, and a custom name cannot be a UUID.
The same rules apply to the environment_name field of POST /v2/chat/completions, which runs the
version currently published to that environment of the given canvas_id (environment_name cannot be
combined with version_id or application_id, and returns 404 when the environment does not exist or
has no published version).
64^[a-z0-9]+(?:-[a-z0-9]+)*$"staging"