curl --request POST \
--url https://api.getcargo.io/v1/context/runtime/execute \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "<string>",
"args": [
"<string>"
],
"commitMessage": "<string>"
}
'import requests
url = "https://api.getcargo.io/v1/context/runtime/execute"
payload = {
"command": "<string>",
"args": ["<string>"],
"commitMessage": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({command: '<string>', args: ['<string>'], commitMessage: '<string>'})
};
fetch('https://api.getcargo.io/v1/context/runtime/execute', 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.getcargo.io/v1/context/runtime/execute",
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([
'command' => '<string>',
'args' => [
'<string>'
],
'commitMessage' => '<string>'
]),
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.getcargo.io/v1/context/runtime/execute"
payload := strings.NewReader("{\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"commitMessage\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.getcargo.io/v1/context/runtime/execute")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"commitMessage\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getcargo.io/v1/context/runtime/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"commitMessage\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"exitCode": 123,
"stdout": "<string>",
"stderr": "<string>",
"commit": {
"sha": "<string>",
"message": "<string>"
}
}{
"errorMessage": "<string>",
"reason": "<string>"
}{
"errorMessage": "<string>",
"reason": "<string>"
}{
"errorMessage": "<string>",
"reason": "<string>"
}{
"errorMessage": "<string>",
"reason": "<string>"
}{
"errorMessage": "<string>",
"reason": "<string>"
}{
"errorMessage": "<string>",
"reason": "<string>"
}{
"errorMessage": "<string>",
"reason": "<string>"
}Execute in runtime sandbox
Run a shell command in the workspace runtime sandbox. Tracked working-tree changes the command produced (additions, edits, deletions, renames) are auto-committed and pushed to the workspace’s default branch as a single commit. Pass commitMessage to customize the commit subject; gitignored paths are skipped. The response’s commit field is present iff a commit landed. (POST /context/runtime/execute).
curl --request POST \
--url https://api.getcargo.io/v1/context/runtime/execute \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "<string>",
"args": [
"<string>"
],
"commitMessage": "<string>"
}
'import requests
url = "https://api.getcargo.io/v1/context/runtime/execute"
payload = {
"command": "<string>",
"args": ["<string>"],
"commitMessage": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({command: '<string>', args: ['<string>'], commitMessage: '<string>'})
};
fetch('https://api.getcargo.io/v1/context/runtime/execute', 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.getcargo.io/v1/context/runtime/execute",
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([
'command' => '<string>',
'args' => [
'<string>'
],
'commitMessage' => '<string>'
]),
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.getcargo.io/v1/context/runtime/execute"
payload := strings.NewReader("{\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"commitMessage\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.getcargo.io/v1/context/runtime/execute")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"commitMessage\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getcargo.io/v1/context/runtime/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"commitMessage\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"exitCode": 123,
"stdout": "<string>",
"stderr": "<string>",
"commit": {
"sha": "<string>",
"message": "<string>"
}
}{
"errorMessage": "<string>",
"reason": "<string>"
}{
"errorMessage": "<string>",
"reason": "<string>"
}{
"errorMessage": "<string>",
"reason": "<string>"
}{
"errorMessage": "<string>",
"reason": "<string>"
}{
"errorMessage": "<string>",
"reason": "<string>"
}{
"errorMessage": "<string>",
"reason": "<string>"
}{
"errorMessage": "<string>",
"reason": "<string>"
}Authorizations
API token from cargo-ai login. Send as Authorization: Bearer <token>.
Headers
Client-generated key that makes this write safe to retry. Reusing the same key with the same request returns the original response instead of creating a second record. Reusing it with a different request returns 422. A concurrent retry while the first request is still running returns 409. Keys expire after 24 hours. Not accepted on multipart file uploads. Optional: a request without one is processed as it always was.
255"8e03978e-40d5-43e8-bc93-6894a57f9324"
Body
Run a shell command in the workspace runtime sandbox. Tracked working-tree changes are auto-committed and pushed to the workspace's default branch; gitignored paths are skipped.
Shell command to run inside the runtime sandbox.
1Optional arguments passed to the command.
Optional override for the auto-commit message. When the command leaves uncommitted changes (additions, edits, deletions, renames) in the working tree, those changes are always pushed to the workspace repo's default branch as a single commit; this field only customizes the commit subject. Defaults to context(runtime): execute <command>.
1Response
Execute in runtime sandbox
Present iff the command left the working tree dirty AND the resulting auto-push landed on the default branch. Absent when the command produced no tracked changes or when the push didn't land — the server logs capture the reason in the latter case.
Show child attributes
Show child attributes
Was this page helpful?

