Get a PTY session
curl --request GET \
--url https://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_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://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_id}"
req, _ := http.NewRequest("GET", 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.get("https://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"session_id": "<string>",
"pid": 123,
"command": "<string>",
"args": [
"<string>"
],
"rows": 123,
"cols": 123,
"created_at": 123,
"is_alive": true,
"ended_at": 123,
"exit_code": 123,
"oom_killed": true
}{
"error": "<string>",
"code": "<string>"
}PTY Sessions
Get PTY Session
Retrieve metadata for a single PTY session.
GET
/
api
/
v1
/
pty
/
{session_id}
Get a PTY session
curl --request GET \
--url https://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_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://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_id}"
req, _ := http.NewRequest("GET", 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.get("https://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{identifier}.sandbox.tensorlake.ai/api/v1/pty/{session_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"session_id": "<string>",
"pid": 123,
"command": "<string>",
"args": [
"<string>"
],
"rows": 123,
"cols": 123,
"created_at": 123,
"is_alive": true,
"ended_at": 123,
"exit_code": 123,
"oom_killed": true
}{
"error": "<string>",
"code": "<string>"
}Get metadata for one PTY session.
The PTY token is not returned from this endpoint. If the kernel OOM killer terminated the PTY process, the response includes
Endpoint
GET /api/v1/pty/{session_id}
Example Request
curl https://<sandbox-id>.sandbox.tensorlake.ai/api/v1/pty/<session-id> \
-H "Authorization: Bearer $TENSORLAKE_API_KEY"
Response
Tensorlake returns200 OK:
{
"session_id": "LYtJOrxE9Kz3bphPUDzuX",
"pid": 42,
"command": "/bin/bash",
"args": ["-l"],
"rows": 24,
"cols": 80,
"created_at": 1710000000000,
"ended_at": null,
"exit_code": null,
"is_alive": true
}
oom_killed: true. If the session does not exist, Tensorlake returns 404 Not Found.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The PTY session identifier.
Response
PTY session metadata
Included only when the kernel OOM killer terminated the PTY process.
Was this page helpful?