curl --request GET \
--url https://api.onecli.sh/v1/agents \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.onecli.sh/v1/agents"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.onecli.sh/v1/agents', 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.onecli.sh/v1/agents",
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.onecli.sh/v1/agents"
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.onecli.sh/v1/agents")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onecli.sh/v1/agents")
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[
{
"id": "<string>",
"name": "<string>",
"identifier": "<string>",
"accessToken": "<string>",
"kind": "byo",
"imageUrl": "<string>",
"channels": [
{
"provider": "slack",
"identityName": "<string>",
"externalId": "<string>",
"status": "<string>",
"settingsUrl": "<string>"
}
],
"lastSeenAt": "2023-11-07T05:31:56Z",
"workingInBackground": true,
"createdAt": "2023-11-07T05:31:56Z"
}
]{
"error": "<string>"
}{
"error": "<string>"
}List agents in the current workspace
Returns all agents in the current workspace, newest first, each with its gateway access token. Add include=grants-summary for each agent’s credentials.
curl --request GET \
--url https://api.onecli.sh/v1/agents \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.onecli.sh/v1/agents"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.onecli.sh/v1/agents', 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.onecli.sh/v1/agents",
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.onecli.sh/v1/agents"
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.onecli.sh/v1/agents")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onecli.sh/v1/agents")
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[
{
"id": "<string>",
"name": "<string>",
"identifier": "<string>",
"accessToken": "<string>",
"kind": "byo",
"imageUrl": "<string>",
"channels": [
{
"provider": "slack",
"identityName": "<string>",
"externalId": "<string>",
"status": "<string>",
"settingsUrl": "<string>"
}
],
"lastSeenAt": "2023-11-07T05:31:56Z",
"workingInBackground": true,
"createdAt": "2023-11-07T05:31:56Z"
}
]{
"error": "<string>"
}{
"error": "<string>"
}include=grants-summary to get each agent’s attached connections and secrets in the same request. See Agent access for what grants mean.
Returns all agents in the current workspace, newest first, each with its gateway access token.
Pass include=grants-summary to also get each agent’s granted credentials (which app connections and secrets are attached) in one request. Any other include value is rejected with 422.
Authorizations
A workspace API key (oc_…) or organization API key (oc_org_…). Workspace-scoped endpoints called with an organization key also need X-Workspace-Id.
Query Parameters
grants-summary adds a grantsSummary object to each agent.
grants-summary Response
List of agents — plain, or with grantsSummary when include=grants-summary was sent.
- Option 1
- Option 2
One row of GET /agents.
Stable, URL-safe handle (lowercase letters, digits, hyphens).
The agent's gateway access token (aoc_…). Returned by the list; not by POST /agents.
byo runs on your own machine through the gateway; hosted runs in a OneCLI sandbox on a runner.
byo, hosted Public avatar URL, or null for the default mark.
Show child attributes
Show child attributes
Newest gateway request from this agent inside the recent window; null when none.
Hosted agents only. True while live background work (a schedule, a watch, a peer task) keeps the sandbox awake.