curl --request GET \
--url https://api.rootkey.ai/api-v1/organizations \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.rootkey.ai/api-v1/organizations"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.rootkey.ai/api-v1/organizations', 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.rootkey.ai/api-v1/organizations",
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.rootkey.ai/api-v1/organizations"
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.rootkey.ai/api-v1/organizations")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rootkey.ai/api-v1/organizations")
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{
"data": [
{
"id": "<string>",
"name": "<string>",
"mode": "DISABLED",
"blocked": true
}
],
"pagination": {
"previousCursor": "<string>",
"nextCursor": "<string>"
},
"metadata": {
"fetchedCount": 123,
"totalCount": 123,
"serverTimestamp": "2023-11-07T05:31:56Z",
"parameters": {
"limit": 123,
"cursor": "<string>",
"order": "asc"
}
}
}{
"error": {
"requestId": "<string>",
"message": "<string>",
"errorCode": "<string>",
"docUrl": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"requestId": "<string>",
"message": "<string>",
"errorCode": "<string>",
"docUrl": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"requestId": "<string>",
"message": "<string>",
"errorCode": "<string>",
"docUrl": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}List the organizations a token can act in
Lists the organizations the user belongs to that the token reaches, each with its agent mode and whether the user is blocked from agents there. Use it to choose the value of X-RootKey-Organization. An organization where agents are off, or where the user is blocked, is still listed, so you can tell the user why a request there is refused. An organization whose IP access rules block your network is left out. It needs no X-RootKey-Organization header. Only a personal access token can call it: a request with an API key gets the 404 that any path the API does not have gets.
curl --request GET \
--url https://api.rootkey.ai/api-v1/organizations \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.rootkey.ai/api-v1/organizations"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.rootkey.ai/api-v1/organizations', 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.rootkey.ai/api-v1/organizations",
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.rootkey.ai/api-v1/organizations"
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.rootkey.ai/api-v1/organizations")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rootkey.ai/api-v1/organizations")
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{
"data": [
{
"id": "<string>",
"name": "<string>",
"mode": "DISABLED",
"blocked": true
}
],
"pagination": {
"previousCursor": "<string>",
"nextCursor": "<string>"
},
"metadata": {
"fetchedCount": 123,
"totalCount": 123,
"serverTimestamp": "2023-11-07T05:31:56Z",
"parameters": {
"limit": 123,
"cursor": "<string>",
"order": "asc"
}
}
}{
"error": {
"requestId": "<string>",
"message": "<string>",
"errorCode": "<string>",
"docUrl": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"requestId": "<string>",
"message": "<string>",
"errorCode": "<string>",
"docUrl": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"requestId": "<string>",
"message": "<string>",
"errorCode": "<string>",
"docUrl": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}Authorizations
Personal access token of a ROOTKey user, sent as Authorization: Bearer rk_pat_.... A token acts as the user who created it, in the organization named by the X-RootKey-Organization header, and never with more access than that user has in the ROOTKey app: the organization's agent policy, the user's own role and teams, and the token's scopes (rootkey.read, rootkey.write, rootkey.delete) all apply. A missing, malformed, unknown, revoked or expired token gets the same 401. Send either an x-api-key or a bearer token, never both: a request with both gets conflicting_credentials. See Authentication.
Headers
Whether a personal access token works on live data (false, the default) or on test data (true). Only this header decides, never a query string or a body field. An API key is itself a test or a live key and works on that data.
true, false Query Parameters
The pagination.nextCursor of the previous page. It is opaque; a cursor that is not valid gets invalid_cursor, never a restart from the first page.
1 <= x <= 100By creation time.
asc, desc Was this page helpful?

