Get a run
Returns one run with its detail: the control command waiting for its daemon
(pending_control), whether it may be force-terminated (force_terminate), and, with
with_history: true, its history (started, resume requested and by whom, resumed, ended).
Requires a realm member (or higher) with the runs.view permission on the realm that owns the run given by run_id.
POST
/
v1
/
runs
/
get_by_id
Get a run
curl --request POST \
--url https://{host}/v1/runs/get_by_id \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"run_id": "0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f",
"with_history": true
}
'import requests
url = "https://{host}/v1/runs/get_by_id"
payload = {
"run_id": "0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f",
"with_history": True
}
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({run_id: '0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f', with_history: true})
};
fetch('https://{host}/v1/runs/get_by_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://{host}/v1/runs/get_by_id",
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([
'run_id' => '0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f',
'with_history' => true
]),
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://{host}/v1/runs/get_by_id"
payload := strings.NewReader("{\n \"run_id\": \"0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f\",\n \"with_history\": true\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://{host}/v1/runs/get_by_id")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"run_id\": \"0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f\",\n \"with_history\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/v1/runs/get_by_id")
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 \"run_id\": \"0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f\",\n \"with_history\": true\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"data": {
"run_id": "0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f",
"workspace_id": "9b2e6f10-4c3a-4e7d-8f21-6a5b4c3d2e1f",
"team_id": "3f6c2a8e-6b1d-4c1e-9a57-0d2f4b8e91c4",
"daemon_id": "7d1c2b3a-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
"realm_id": "5b0c3a7e-2f4d-4b8e-9a51-7c1d2e3f4a5b",
"parent_run_id": null,
"parent_phase": null,
"root_run_id": null,
"call_path": null,
"call_depth": 0,
"iteration_key": null,
"run_name": "brave-otter",
"state": "awaiting_input",
"inputs": {
"pr_url": "https://github.com/acme/api/pull/42"
},
"error": null,
"execution_type": "local",
"current_pid": null,
"current_phase": "approve",
"external_id": null,
"context_labels": null,
"reviewers": {
"approve": [
"sshah"
]
},
"notify_channels": null,
"lease_expires_at": 1759920600000,
"started_at": 1759834200000,
"completed_at": null,
"pending_control": null,
"force_terminate": {
"already_terminated": false,
"terminated_at": null,
"terminated_by_user_id": null,
"terminated_reason": null,
"eligible": false,
"trigger": null,
"blocker": "daemon is heartbeating and no cancel has been queued long enough"
},
"state_lost_at": null,
"team_version_id": "61e2d3c4-b5a6-4789-8c0d-1e2f3a4b5c6d",
"history": [
{
"type": "run.started",
"at": 1759834200000,
"from_phase": null,
"phase": null,
"error": null,
"actor": null
}
]
}
}{
"ok": false,
"error": {
"code": "unauthorized",
"message": "Authentication required"
}
}{
"ok": false,
"error": {
"code": "forbidden",
"message": "You do not have access to do this"
}
}{
"ok": false,
"error": {
"code": "not_found",
"message": "Not found"
}
}{
"ok": false,
"error": "run_id: Required",
"code": "invalid_params"
}{
"ok": false,
"error": "Internal server error",
"code": "internal_error"
}Authorizations
User PAT (cliq_tok_…, including session-scoped) or realm token (cliq_dt_…).
Body
application/json
⌘I
Get a run
curl --request POST \
--url https://{host}/v1/runs/get_by_id \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"run_id": "0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f",
"with_history": true
}
'import requests
url = "https://{host}/v1/runs/get_by_id"
payload = {
"run_id": "0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f",
"with_history": True
}
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({run_id: '0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f', with_history: true})
};
fetch('https://{host}/v1/runs/get_by_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://{host}/v1/runs/get_by_id",
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([
'run_id' => '0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f',
'with_history' => true
]),
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://{host}/v1/runs/get_by_id"
payload := strings.NewReader("{\n \"run_id\": \"0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f\",\n \"with_history\": true\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://{host}/v1/runs/get_by_id")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"run_id\": \"0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f\",\n \"with_history\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/v1/runs/get_by_id")
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 \"run_id\": \"0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f\",\n \"with_history\": true\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"data": {
"run_id": "0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f",
"workspace_id": "9b2e6f10-4c3a-4e7d-8f21-6a5b4c3d2e1f",
"team_id": "3f6c2a8e-6b1d-4c1e-9a57-0d2f4b8e91c4",
"daemon_id": "7d1c2b3a-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
"realm_id": "5b0c3a7e-2f4d-4b8e-9a51-7c1d2e3f4a5b",
"parent_run_id": null,
"parent_phase": null,
"root_run_id": null,
"call_path": null,
"call_depth": 0,
"iteration_key": null,
"run_name": "brave-otter",
"state": "awaiting_input",
"inputs": {
"pr_url": "https://github.com/acme/api/pull/42"
},
"error": null,
"execution_type": "local",
"current_pid": null,
"current_phase": "approve",
"external_id": null,
"context_labels": null,
"reviewers": {
"approve": [
"sshah"
]
},
"notify_channels": null,
"lease_expires_at": 1759920600000,
"started_at": 1759834200000,
"completed_at": null,
"pending_control": null,
"force_terminate": {
"already_terminated": false,
"terminated_at": null,
"terminated_by_user_id": null,
"terminated_reason": null,
"eligible": false,
"trigger": null,
"blocker": "daemon is heartbeating and no cancel has been queued long enough"
},
"state_lost_at": null,
"team_version_id": "61e2d3c4-b5a6-4789-8c0d-1e2f3a4b5c6d",
"history": [
{
"type": "run.started",
"at": 1759834200000,
"from_phase": null,
"phase": null,
"error": null,
"actor": null
}
]
}
}{
"ok": false,
"error": {
"code": "unauthorized",
"message": "Authentication required"
}
}{
"ok": false,
"error": {
"code": "forbidden",
"message": "You do not have access to do this"
}
}{
"ok": false,
"error": {
"code": "not_found",
"message": "Not found"
}
}{
"ok": false,
"error": "run_id: Required",
"code": "invalid_params"
}{
"ok": false,
"error": "Internal server error",
"code": "internal_error"
}