curl --request POST \
--url https://api.tela.com/environment/publish-by-name \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"resourceType": "prompt",
"resourceId": "95cec438-6080-44fe-8275-28b16bd40178",
"envName": "staging",
"versionId": "76065caa-c519-441a-8fe2-cc43e29664ab",
"autoCreate": true
}
'import requests
url = "https://api.tela.com/environment/publish-by-name"
payload = {
"resourceType": "prompt",
"resourceId": "95cec438-6080-44fe-8275-28b16bd40178",
"envName": "staging",
"versionId": "76065caa-c519-441a-8fe2-cc43e29664ab",
"autoCreate": True
}
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',
envName: 'staging',
versionId: '76065caa-c519-441a-8fe2-cc43e29664ab',
autoCreate: true
})
};
fetch('https://api.tela.com/environment/publish-by-name', 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/publish-by-name",
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',
'envName' => 'staging',
'versionId' => '76065caa-c519-441a-8fe2-cc43e29664ab',
'autoCreate' => true
]),
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/publish-by-name"
payload := strings.NewReader("{\n \"resourceType\": \"prompt\",\n \"resourceId\": \"95cec438-6080-44fe-8275-28b16bd40178\",\n \"envName\": \"staging\",\n \"versionId\": \"76065caa-c519-441a-8fe2-cc43e29664ab\",\n \"autoCreate\": true\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/publish-by-name")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"resourceType\": \"prompt\",\n \"resourceId\": \"95cec438-6080-44fe-8275-28b16bd40178\",\n \"envName\": \"staging\",\n \"versionId\": \"76065caa-c519-441a-8fe2-cc43e29664ab\",\n \"autoCreate\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tela.com/environment/publish-by-name")
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 \"envName\": \"staging\",\n \"versionId\": \"76065caa-c519-441a-8fe2-cc43e29664ab\",\n \"autoCreate\": true\n}"
response = http.request(request)
puts response.read_body{
"environment": {
"id": "2f1c9a7e-3b4d-4e5f-8a6b-1c2d3e4f5a6b",
"resourceType": "prompt",
"resourceId": "95cec438-6080-44fe-8275-28b16bd40178",
"name": "staging",
"isSystem": false,
"currentVersionId": "76065caa-c519-441a-8fe2-cc43e29664ab",
"workspaceId": "3f55cfd9-4427-4887-a181-d9ad39967802",
"createdBy": "jane@example.com",
"deletedBy": null,
"createdAt": "2025-06-01T12:00:00.000Z",
"updatedAt": "2025-06-03T10:12:45.000Z",
"deletedAt": null
},
"version": {
"id": "76065caa-c519-441a-8fe2-cc43e29664ab",
"promptId": "95cec438-6080-44fe-8275-28b16bd40178",
"title": "Contract analysis v3",
"titleLocked": false,
"content": null,
"markdownContent": null,
"variables": [
{
"name": "document",
"type": "file",
"required": true
}
],
"configuration": {
"model": "gpt-4.1",
"temperature": 0
},
"promoted": false,
"draft": false,
"originVersionId": "1b2c3d4e-5f60-4718-9a2b-3c4d5e6f7a8b",
"workspaceId": "3f55cfd9-4427-4887-a181-d9ad39967802",
"workflowSpec": null,
"graph": null,
"isWorkflow": false,
"createdBy": "jane@example.com",
"updatedBy": "jane@example.com",
"deletedBy": null,
"createdAt": "2025-06-02T15:40:00.000Z",
"updatedAt": "2025-06-03T10:12:45.000Z",
"deletedAt": null,
"promptCustomTags": [],
"message": {
"id": "9c8b7a6f-5e4d-4c3b-a2f1-0e9d8c7b6a5f",
"role": "system",
"content": "You are a contract analyst. Summarize the key clauses of {{document}}.",
"markdownContent": null,
"promptVersionId": "76065caa-c519-441a-8fe2-cc43e29664ab",
"index": 0,
"createdBy": "jane@example.com",
"updatedBy": "jane@example.com",
"createdAt": "2025-06-02T15:40:00.000Z",
"updatedAt": "2025-06-02T15:40:00.000Z",
"deletedAt": null
},
"messages": [
{
"id": "9c8b7a6f-5e4d-4c3b-a2f1-0e9d8c7b6a5f",
"role": "system",
"content": "You are a contract analyst. Summarize the key clauses of {{document}}.",
"markdownContent": null,
"promptVersionId": "76065caa-c519-441a-8fe2-cc43e29664ab",
"index": 0,
"createdBy": "jane@example.com",
"updatedBy": "jane@example.com",
"createdAt": "2025-06-02T15:40:00.000Z",
"updatedAt": "2025-06-02T15:40:00.000Z",
"deletedAt": null
}
]
}
}Publish a version to an environment
Publishes a prompt version to the environment identified by envName and returns the updated environment together with the published version.
curl --request POST \
--url https://api.tela.com/environment/publish-by-name \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"resourceType": "prompt",
"resourceId": "95cec438-6080-44fe-8275-28b16bd40178",
"envName": "staging",
"versionId": "76065caa-c519-441a-8fe2-cc43e29664ab",
"autoCreate": true
}
'import requests
url = "https://api.tela.com/environment/publish-by-name"
payload = {
"resourceType": "prompt",
"resourceId": "95cec438-6080-44fe-8275-28b16bd40178",
"envName": "staging",
"versionId": "76065caa-c519-441a-8fe2-cc43e29664ab",
"autoCreate": True
}
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',
envName: 'staging',
versionId: '76065caa-c519-441a-8fe2-cc43e29664ab',
autoCreate: true
})
};
fetch('https://api.tela.com/environment/publish-by-name', 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/publish-by-name",
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',
'envName' => 'staging',
'versionId' => '76065caa-c519-441a-8fe2-cc43e29664ab',
'autoCreate' => true
]),
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/publish-by-name"
payload := strings.NewReader("{\n \"resourceType\": \"prompt\",\n \"resourceId\": \"95cec438-6080-44fe-8275-28b16bd40178\",\n \"envName\": \"staging\",\n \"versionId\": \"76065caa-c519-441a-8fe2-cc43e29664ab\",\n \"autoCreate\": true\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/publish-by-name")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"resourceType\": \"prompt\",\n \"resourceId\": \"95cec438-6080-44fe-8275-28b16bd40178\",\n \"envName\": \"staging\",\n \"versionId\": \"76065caa-c519-441a-8fe2-cc43e29664ab\",\n \"autoCreate\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tela.com/environment/publish-by-name")
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 \"envName\": \"staging\",\n \"versionId\": \"76065caa-c519-441a-8fe2-cc43e29664ab\",\n \"autoCreate\": true\n}"
response = http.request(request)
puts response.read_body{
"environment": {
"id": "2f1c9a7e-3b4d-4e5f-8a6b-1c2d3e4f5a6b",
"resourceType": "prompt",
"resourceId": "95cec438-6080-44fe-8275-28b16bd40178",
"name": "staging",
"isSystem": false,
"currentVersionId": "76065caa-c519-441a-8fe2-cc43e29664ab",
"workspaceId": "3f55cfd9-4427-4887-a181-d9ad39967802",
"createdBy": "jane@example.com",
"deletedBy": null,
"createdAt": "2025-06-01T12:00:00.000Z",
"updatedAt": "2025-06-03T10:12:45.000Z",
"deletedAt": null
},
"version": {
"id": "76065caa-c519-441a-8fe2-cc43e29664ab",
"promptId": "95cec438-6080-44fe-8275-28b16bd40178",
"title": "Contract analysis v3",
"titleLocked": false,
"content": null,
"markdownContent": null,
"variables": [
{
"name": "document",
"type": "file",
"required": true
}
],
"configuration": {
"model": "gpt-4.1",
"temperature": 0
},
"promoted": false,
"draft": false,
"originVersionId": "1b2c3d4e-5f60-4718-9a2b-3c4d5e6f7a8b",
"workspaceId": "3f55cfd9-4427-4887-a181-d9ad39967802",
"workflowSpec": null,
"graph": null,
"isWorkflow": false,
"createdBy": "jane@example.com",
"updatedBy": "jane@example.com",
"deletedBy": null,
"createdAt": "2025-06-02T15:40:00.000Z",
"updatedAt": "2025-06-03T10:12:45.000Z",
"deletedAt": null,
"promptCustomTags": [],
"message": {
"id": "9c8b7a6f-5e4d-4c3b-a2f1-0e9d8c7b6a5f",
"role": "system",
"content": "You are a contract analyst. Summarize the key clauses of {{document}}.",
"markdownContent": null,
"promptVersionId": "76065caa-c519-441a-8fe2-cc43e29664ab",
"index": 0,
"createdBy": "jane@example.com",
"updatedBy": "jane@example.com",
"createdAt": "2025-06-02T15:40:00.000Z",
"updatedAt": "2025-06-02T15:40:00.000Z",
"deletedAt": null
},
"messages": [
{
"id": "9c8b7a6f-5e4d-4c3b-a2f1-0e9d8c7b6a5f",
"role": "system",
"content": "You are a contract analyst. Summarize the key clauses of {{document}}.",
"markdownContent": null,
"promptVersionId": "76065caa-c519-441a-8fe2-cc43e29664ab",
"index": 0,
"createdBy": "jane@example.com",
"updatedBy": "jane@example.com",
"createdAt": "2025-06-02T15:40:00.000Z",
"updatedAt": "2025-06-02T15:40:00.000Z",
"deletedAt": null
}
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Resource type an environment is attached to. Only canvases (prompt) are supported today.
prompt Canvas (prompt) ID
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"
ID of the prompt version to publish. Must belong to the canvas.
Create the environment if it does not exist yet. Not needed for production, which is always created on demand.
Response
Version published
An environment of a canvas. Timestamps are ISO 8601 strings.
Show child attributes
Show child attributes
{
"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
}
A prompt version as returned by environment operations. variables and configuration follow the
prompt-version schemas of the main API; they are typed loosely here.
Show child attributes
Show child attributes
{
"id": "76065caa-c519-441a-8fe2-cc43e29664ab",
"promptId": "95cec438-6080-44fe-8275-28b16bd40178",
"title": "Contract analysis v3",
"titleLocked": false,
"content": null,
"markdownContent": null,
"variables": [
{
"name": "document",
"type": "file",
"required": true
}
],
"configuration": { "model": "gpt-4.1", "temperature": 0 },
"promoted": true,
"draft": false,
"originVersionId": "1b2c3d4e-5f60-4718-9a2b-3c4d5e6f7a8b",
"workspaceId": "3f55cfd9-4427-4887-a181-d9ad39967802",
"workflowSpec": null,
"graph": null,
"isWorkflow": false,
"createdBy": "jane@example.com",
"updatedBy": "jane@example.com",
"deletedBy": null,
"createdAt": "2025-06-02T15:40:00.000Z",
"updatedAt": "2025-06-02T15:45:10.000Z",
"deletedAt": null,
"versionIndex": 3,
"promptCustomTags": [],
"message": {
"id": "9c8b7a6f-5e4d-4c3b-a2f1-0e9d8c7b6a5f",
"role": "system",
"content": "You are a contract analyst. Summarize the key clauses of {{document}}.",
"markdownContent": null,
"promptVersionId": "76065caa-c519-441a-8fe2-cc43e29664ab",
"index": 0,
"createdBy": "jane@example.com",
"updatedBy": "jane@example.com",
"createdAt": "2025-06-02T15:40:00.000Z",
"updatedAt": "2025-06-02T15:40:00.000Z",
"deletedAt": null
},
"messages": [
{
"id": "9c8b7a6f-5e4d-4c3b-a2f1-0e9d8c7b6a5f",
"role": "system",
"content": "You are a contract analyst. Summarize the key clauses of {{document}}.",
"markdownContent": null,
"promptVersionId": "76065caa-c519-441a-8fe2-cc43e29664ab",
"index": 0,
"createdBy": "jane@example.com",
"updatedBy": "jane@example.com",
"createdAt": "2025-06-02T15:40:00.000Z",
"updatedAt": "2025-06-02T15:40:00.000Z",
"deletedAt": null
}
]
}