Start a code session
curl --request POST \
--url http://localhost:3001/api/v1/terminal/code \
--header 'Content-Type: application/json' \
--cookie nut-session= \
--data '
{
"taskId": "<string>",
"model": "claude",
"contextType": "change-task",
"autonomous": false,
"interactive": true,
"customInstructions": "<string>",
"newWorktree": false,
"worktreeBranch": "<string>",
"worktreeSuffix": "<string>"
}
'import requests
url = "http://localhost:3001/api/v1/terminal/code"
payload = {
"taskId": "<string>",
"model": "claude",
"contextType": "change-task",
"autonomous": False,
"interactive": True,
"customInstructions": "<string>",
"newWorktree": False,
"worktreeBranch": "<string>",
"worktreeSuffix": "<string>"
}
headers = {
"cookie": "nut-session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'nut-session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
taskId: '<string>',
model: 'claude',
contextType: 'change-task',
autonomous: false,
interactive: true,
customInstructions: '<string>',
newWorktree: false,
worktreeBranch: '<string>',
worktreeSuffix: '<string>'
})
};
fetch('http://localhost:3001/api/v1/terminal/code', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3001",
CURLOPT_URL => "http://localhost:3001/api/v1/terminal/code",
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([
'taskId' => '<string>',
'model' => 'claude',
'contextType' => 'change-task',
'autonomous' => false,
'interactive' => true,
'customInstructions' => '<string>',
'newWorktree' => false,
'worktreeBranch' => '<string>',
'worktreeSuffix' => '<string>'
]),
CURLOPT_COOKIE => "nut-session=",
CURLOPT_HTTPHEADER => [
"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 := "http://localhost:3001/api/v1/terminal/code"
payload := strings.NewReader("{\n \"taskId\": \"<string>\",\n \"model\": \"claude\",\n \"contextType\": \"change-task\",\n \"autonomous\": false,\n \"interactive\": true,\n \"customInstructions\": \"<string>\",\n \"newWorktree\": false,\n \"worktreeBranch\": \"<string>\",\n \"worktreeSuffix\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "nut-session=")
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("http://localhost:3001/api/v1/terminal/code")
.header("cookie", "nut-session=")
.header("Content-Type", "application/json")
.body("{\n \"taskId\": \"<string>\",\n \"model\": \"claude\",\n \"contextType\": \"change-task\",\n \"autonomous\": false,\n \"interactive\": true,\n \"customInstructions\": \"<string>\",\n \"newWorktree\": false,\n \"worktreeBranch\": \"<string>\",\n \"worktreeSuffix\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3001/api/v1/terminal/code")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["cookie"] = 'nut-session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"taskId\": \"<string>\",\n \"model\": \"claude\",\n \"contextType\": \"change-task\",\n \"autonomous\": false,\n \"interactive\": true,\n \"customInstructions\": \"<string>\",\n \"newWorktree\": false,\n \"worktreeBranch\": \"<string>\",\n \"worktreeSuffix\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"sessionId": "<string>",
"taskId": "<string>",
"command": "<string>",
"scriptPath": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}{
"success": true,
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"success": true,
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"success": true,
"error": {
"code": "<string>",
"message": "<string>"
}
}Terminal
Start a code session
Create a terminal session for a task, build the pipeline command for the selected AI agent, and send it to the terminal. Returns the session ID so callers can connect via the WebSocket endpoint to monitor progress.
POST
/
api
/
v1
/
terminal
/
code
Start a code session
curl --request POST \
--url http://localhost:3001/api/v1/terminal/code \
--header 'Content-Type: application/json' \
--cookie nut-session= \
--data '
{
"taskId": "<string>",
"model": "claude",
"contextType": "change-task",
"autonomous": false,
"interactive": true,
"customInstructions": "<string>",
"newWorktree": false,
"worktreeBranch": "<string>",
"worktreeSuffix": "<string>"
}
'import requests
url = "http://localhost:3001/api/v1/terminal/code"
payload = {
"taskId": "<string>",
"model": "claude",
"contextType": "change-task",
"autonomous": False,
"interactive": True,
"customInstructions": "<string>",
"newWorktree": False,
"worktreeBranch": "<string>",
"worktreeSuffix": "<string>"
}
headers = {
"cookie": "nut-session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'nut-session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
taskId: '<string>',
model: 'claude',
contextType: 'change-task',
autonomous: false,
interactive: true,
customInstructions: '<string>',
newWorktree: false,
worktreeBranch: '<string>',
worktreeSuffix: '<string>'
})
};
fetch('http://localhost:3001/api/v1/terminal/code', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3001",
CURLOPT_URL => "http://localhost:3001/api/v1/terminal/code",
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([
'taskId' => '<string>',
'model' => 'claude',
'contextType' => 'change-task',
'autonomous' => false,
'interactive' => true,
'customInstructions' => '<string>',
'newWorktree' => false,
'worktreeBranch' => '<string>',
'worktreeSuffix' => '<string>'
]),
CURLOPT_COOKIE => "nut-session=",
CURLOPT_HTTPHEADER => [
"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 := "http://localhost:3001/api/v1/terminal/code"
payload := strings.NewReader("{\n \"taskId\": \"<string>\",\n \"model\": \"claude\",\n \"contextType\": \"change-task\",\n \"autonomous\": false,\n \"interactive\": true,\n \"customInstructions\": \"<string>\",\n \"newWorktree\": false,\n \"worktreeBranch\": \"<string>\",\n \"worktreeSuffix\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "nut-session=")
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("http://localhost:3001/api/v1/terminal/code")
.header("cookie", "nut-session=")
.header("Content-Type", "application/json")
.body("{\n \"taskId\": \"<string>\",\n \"model\": \"claude\",\n \"contextType\": \"change-task\",\n \"autonomous\": false,\n \"interactive\": true,\n \"customInstructions\": \"<string>\",\n \"newWorktree\": false,\n \"worktreeBranch\": \"<string>\",\n \"worktreeSuffix\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3001/api/v1/terminal/code")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["cookie"] = 'nut-session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"taskId\": \"<string>\",\n \"model\": \"claude\",\n \"contextType\": \"change-task\",\n \"autonomous\": false,\n \"interactive\": true,\n \"customInstructions\": \"<string>\",\n \"newWorktree\": false,\n \"worktreeBranch\": \"<string>\",\n \"worktreeSuffix\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"sessionId": "<string>",
"taskId": "<string>",
"command": "<string>",
"scriptPath": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}{
"success": true,
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"success": true,
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"success": true,
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
sessionCookiebearerAuthapiKey
Session cookie authentication
Body
application/json
Task ID to implement
AI agent to use
Available options:
claude, gemini, codex, droid, kiro Context type for the session
Available options:
change-task, prepare-task, skill, general Enable autonomous / skip-permissions mode
When true (default) the agent stays open after completing the task. When false the agent exits on completion and the terminal session closes.
Custom instructions for the agent
Create a new git worktree for this session
Override worktree branch name
Append a suffix to the generated worktree branch name
⌘I