Skip to main content
GET
/
pty
/
{session_name}
JavaScript
import Runloop from '@runloop/api-client';

const client = new Runloop({
  bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});

const ptyConnectView = await client.pty.connect('session_name');

console.log(ptyConnectView.idle_ttl_seconds);
import os
from runloop_api_client import Runloop

client = Runloop(
bearer_token=os.environ.get("RUNLOOP_API_KEY"), # This is the default and can be omitted
)
pty_connect_view = client.pty.connect(
session_name="session_name",
)
print(pty_connect_view.idle_ttl_seconds)
curl --request GET \
--url https://api.runloop.ai/pty/{session_name} \
--header 'Authorization: Bearer <token>'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runloop.ai/pty/{session_name}",
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://api.runloop.ai/pty/{session_name}"

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://api.runloop.ai/pty/{session_name}")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.runloop.ai/pty/{session_name}")

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
{
  "created": true,
  "attached": true,
  "session_name": "<string>",
  "status": "<string>",
  "protocol_version": "<string>",
  "connect_url": "<string>",
  "cols": 123,
  "rows": 123,
  "idle_ttl_seconds": 123
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

session_name
string
required

The client-chosen PTY session name. Must be 1..=256 ASCII letters, digits, '-' and '_'. Reusing the same name reconnects to the same logical PTY session when it is still available.

Query Parameters

cols
integer<int32>

Optional initial terminal width in character cells (1..=1000). Defaults to 80 when omitted. Applied only if both cols and rows are provided; otherwise ignored.

rows
integer<int32>

Optional initial terminal height in character cells (1..=1000). Defaults to 24 when omitted. Applied only if both cols and rows are provided; otherwise ignored.

Response

OK

created
boolean
required
attached
boolean
required
session_name
string
status
string
protocol_version
string
connect_url
string
cols
integer<int32>
rows
integer<int32>
idle_ttl_seconds
integer<int64>