Replace a sandbox's tags
Replaces the sandbox’s whole tag set; {} clears it. Tags are the only thing you can change after create; any other field is rejected. Works on terminated sandboxes too.
PATCH
/
ai
/
sandboxes
/
{sandbox_id}
Replace a sandbox's tags
curl --request PATCH \
--url https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tags": {
"project": "llm-ft",
"stage": "eval"
}
}
'import requests
url = "https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}"
payload = { "tags": {
"project": "llm-ft",
"stage": "eval"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({tags: {project: 'llm-ft', stage: 'eval'}})
};
fetch('https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}', 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.telnyx.com/v2/ai/sandboxes/{sandbox_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'tags' => [
'project' => 'llm-ft',
'stage' => 'eval'
]
]),
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.telnyx.com/v2/ai/sandboxes/{sandbox_id}"
payload := strings.NewReader("{\n \"tags\": {\n \"project\": \"llm-ft\",\n \"stage\": \"eval\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tags\": {\n \"project\": \"llm-ft\",\n \"stage\": \"eval\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tags\": {\n \"project\": \"llm-ft\",\n \"stage\": \"eval\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "sb-0192f1c2-7a4b-7c3e-9d1e-2f3a4b5c6d7e",
"name": "train-run-42",
"tags": {
"project": "llm-ft",
"stage": "eval"
},
"state": "running",
"ready": true,
"image": {
"ref": "ghcr.io/acme/trainer:1.4"
},
"command": [
"python",
"train.py"
],
"workdir": "/app",
"env": {
"EPOCHS": "3"
},
"gpu": {
"type": "B300",
"count": 8
},
"cpu": 192,
"memory_mib": 2097152,
"disk_gib": 8192,
"timeout": 36000,
"idle_timeout": null,
"queue_timeout": 1800,
"network_mode": "public",
"cidr_allowlist": null,
"readiness_probe": null,
"log_bucket": "acme-sandbox-logs",
"logs_incomplete": false,
"logs_incomplete_reason": null,
"resolved": {
"image": "ghcr.io/acme/trainer@sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"command": [
"python",
"train.py"
],
"workdir": "/app"
},
"termination_reason": null,
"termination_message": null,
"exit_code": null,
"created_at": "2026-11-13T10:00:00Z",
"started_at": "2026-11-13T10:01:12Z",
"terminated_at": null
}
}{
"errors": [
{
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"meta": {
"url": null
},
"source": {
"parameter": null,
"pointer": null
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not find any usable credentials in the request."
}
]
}{
"errors": [
{
"title": "sandboxes_not_whitelisted",
"detail": "The organization isn't whitelisted."
}
]
}{
"errors": [
{
"code": "10005",
"title": "Resource not found",
"detail": "Sandbox not found."
}
]
}{
"errors": [
{
"title": "request_in_progress",
"detail": "A request with this Idempotency-Key is still being processed."
}
]
}{
"errors": [
{
"title": "idempotency_key_reused",
"detail": "This Idempotency-Key was used with a different request."
}
]
}{
"errors": [
{
"code": "10037",
"title": "Service unavailable",
"detail": "A dependency can't answer right now; retry later."
}
]
}Authorizations
Headers
Optional client-chosen key (e.g. a UUID, at most 255 characters) that makes the call safe to retry. Within 24 h, the same key with the same request returns the stored response instead of acting twice; the same key with a different request fails with idempotency_key_reused; a request with a key that's still being processed fails with request_in_progress.
Required string length:
1 - 255Body
application/json
New tags for a sandbox. Nothing else can change after create.
Was this page helpful?
Replace a sandbox's tags
curl --request PATCH \
--url https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tags": {
"project": "llm-ft",
"stage": "eval"
}
}
'import requests
url = "https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}"
payload = { "tags": {
"project": "llm-ft",
"stage": "eval"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({tags: {project: 'llm-ft', stage: 'eval'}})
};
fetch('https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}', 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.telnyx.com/v2/ai/sandboxes/{sandbox_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'tags' => [
'project' => 'llm-ft',
'stage' => 'eval'
]
]),
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.telnyx.com/v2/ai/sandboxes/{sandbox_id}"
payload := strings.NewReader("{\n \"tags\": {\n \"project\": \"llm-ft\",\n \"stage\": \"eval\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tags\": {\n \"project\": \"llm-ft\",\n \"stage\": \"eval\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tags\": {\n \"project\": \"llm-ft\",\n \"stage\": \"eval\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "sb-0192f1c2-7a4b-7c3e-9d1e-2f3a4b5c6d7e",
"name": "train-run-42",
"tags": {
"project": "llm-ft",
"stage": "eval"
},
"state": "running",
"ready": true,
"image": {
"ref": "ghcr.io/acme/trainer:1.4"
},
"command": [
"python",
"train.py"
],
"workdir": "/app",
"env": {
"EPOCHS": "3"
},
"gpu": {
"type": "B300",
"count": 8
},
"cpu": 192,
"memory_mib": 2097152,
"disk_gib": 8192,
"timeout": 36000,
"idle_timeout": null,
"queue_timeout": 1800,
"network_mode": "public",
"cidr_allowlist": null,
"readiness_probe": null,
"log_bucket": "acme-sandbox-logs",
"logs_incomplete": false,
"logs_incomplete_reason": null,
"resolved": {
"image": "ghcr.io/acme/trainer@sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"command": [
"python",
"train.py"
],
"workdir": "/app"
},
"termination_reason": null,
"termination_message": null,
"exit_code": null,
"created_at": "2026-11-13T10:00:00Z",
"started_at": "2026-11-13T10:01:12Z",
"terminated_at": null
}
}{
"errors": [
{
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"meta": {
"url": null
},
"source": {
"parameter": null,
"pointer": null
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not find any usable credentials in the request."
}
]
}{
"errors": [
{
"title": "sandboxes_not_whitelisted",
"detail": "The organization isn't whitelisted."
}
]
}{
"errors": [
{
"code": "10005",
"title": "Resource not found",
"detail": "Sandbox not found."
}
]
}{
"errors": [
{
"title": "request_in_progress",
"detail": "A request with this Idempotency-Key is still being processed."
}
]
}{
"errors": [
{
"title": "idempotency_key_reused",
"detail": "This Idempotency-Key was used with a different request."
}
]
}{
"errors": [
{
"code": "10037",
"title": "Service unavailable",
"detail": "A dependency can't answer right now; retry later."
}
]
}