Close an exec's stdin
Sends EOF to the exec’s stdin, as the exec attach WebSocket’s stdin_eof message does: the process sees it once the input already accepted has been written. Disconnecting never sends EOF; a process reading stdin keeps waiting until you call this. Closing it twice, or on an exec that ended, changes nothing.
An exec still starting is started first. While your organization’s sandboxes are disabled, that’s refused with sandboxes_disabled.
curl --request POST \
--url https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}/execs/{exec_id}/stdin/close \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}/execs/{exec_id}/stdin/close"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}/execs/{exec_id}/stdin/close', 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}/execs/{exec_id}/stdin/close",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}/execs/{exec_id}/stdin/close"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.telnyx.com/v2/ai/sandboxes/{sandbox_id}/execs/{exec_id}/stdin/close")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}/execs/{exec_id}/stdin/close")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "exec-0192f1c9-3e2a-7b1d-8c4f-5a6b7c8d9e0f",
"sandbox_id": "sb-0192f1c2-7a4b-7c3e-9d1e-2f3a4b5c6d7e",
"command": [
"python",
"evaluate.py",
"--split",
"test"
],
"env": {
"LOG_LEVEL": "info"
},
"workdir": "/app",
"timeout": 3600,
"status": "running",
"exit_code": null,
"reason": null,
"created_at": "2026-11-13T10:05:00Z",
"finished_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.
1 - 255Path Parameters
Was this page helpful?
curl --request POST \
--url https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}/execs/{exec_id}/stdin/close \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}/execs/{exec_id}/stdin/close"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}/execs/{exec_id}/stdin/close', 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}/execs/{exec_id}/stdin/close",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}/execs/{exec_id}/stdin/close"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.telnyx.com/v2/ai/sandboxes/{sandbox_id}/execs/{exec_id}/stdin/close")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/sandboxes/{sandbox_id}/execs/{exec_id}/stdin/close")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "exec-0192f1c9-3e2a-7b1d-8c4f-5a6b7c8d9e0f",
"sandbox_id": "sb-0192f1c2-7a4b-7c3e-9d1e-2f3a4b5c6d7e",
"command": [
"python",
"evaluate.py",
"--split",
"test"
],
"env": {
"LOG_LEVEL": "info"
},
"workdir": "/app",
"timeout": 3600,
"status": "running",
"exit_code": null,
"reason": null,
"created_at": "2026-11-13T10:05:00Z",
"finished_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."
}
]
}