List pending approvals across the organization
curl --request GET \
--url https://gw.onecli.sh/org/approvals/pending \
--header 'Authorization: Bearer <token>'import requests
url = "https://gw.onecli.sh/org/approvals/pending"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://gw.onecli.sh/org/approvals/pending', 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://gw.onecli.sh/org/approvals/pending",
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://gw.onecli.sh/org/approvals/pending"
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://gw.onecli.sh/org/approvals/pending")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://gw.onecli.sh/org/approvals/pending")
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{
"requests": [
{
"id": "<string>",
"workspaceId": "<string>",
"projectId": "<string>",
"method": "<string>",
"url": "<string>",
"host": "<string>",
"path": "<string>",
"headers": {},
"bodyPreview": "<string>",
"summary": {
"action": "<string>",
"details": [
{
"label": "<string>",
"value": "<string>",
"url": "<string>"
}
],
"kind": "email",
"subject": {
"verb": "<string>",
"lead": "<string>",
"record": "<string>",
"row": 123
}
},
"rawBody": {
"text": "<string>",
"truncated": true,
"binary": true,
"redacted": true
},
"app": "<string>",
"batch": {
"id": "<string>",
"label": "<string>",
"total": 250
},
"agent": {
"id": "<string>",
"name": "<string>",
"externalId": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}
],
"timeoutSeconds": 123
}{
"error": "organization_scope_required"
}Approvals
List pending approvals across an organization
Long-polls for manual-approval requests awaiting a decision across every workspace in the organization. An Enterprise feature that waits up to timeoutSeconds.
GET
/
org
/
approvals
/
pending
List pending approvals across the organization
curl --request GET \
--url https://gw.onecli.sh/org/approvals/pending \
--header 'Authorization: Bearer <token>'import requests
url = "https://gw.onecli.sh/org/approvals/pending"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://gw.onecli.sh/org/approvals/pending', 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://gw.onecli.sh/org/approvals/pending",
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://gw.onecli.sh/org/approvals/pending"
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://gw.onecli.sh/org/approvals/pending")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://gw.onecli.sh/org/approvals/pending")
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{
"requests": [
{
"id": "<string>",
"workspaceId": "<string>",
"projectId": "<string>",
"method": "<string>",
"url": "<string>",
"host": "<string>",
"path": "<string>",
"headers": {},
"bodyPreview": "<string>",
"summary": {
"action": "<string>",
"details": [
{
"label": "<string>",
"value": "<string>",
"url": "<string>"
}
],
"kind": "email",
"subject": {
"verb": "<string>",
"lead": "<string>",
"record": "<string>",
"row": 123
}
},
"rawBody": {
"text": "<string>",
"truncated": true,
"binary": true,
"redacted": true
},
"app": "<string>",
"batch": {
"id": "<string>",
"label": "<string>",
"total": 250
},
"agent": {
"id": "<string>",
"name": "<string>",
"externalId": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}
],
"timeoutSeconds": 123
}{
"error": "organization_scope_required"
}Returns pending approval requests from all workspaces. If none are waiting, the call holds open until one arrives or the poll times out. Use it to build a central approver. See Rules for how approvals are triggered.
Long-polls for manual-approval requests awaiting a decision across every workspace in the organization. Returns immediately when any are pending, otherwise holds the connection open (up to
timeoutSeconds) until one arrives or the poll times out.
Each request carries its own workspaceId; submit the decision to POST /approvals/{id}/decision with that workspace’s X-Workspace-Id. Authenticate with an organization API key (oc_org_…) — a workspace key answers 403.
Availability: Cloud · Enterprise (self-hosted). On an unlicensed self-hosted deployment the gateway answers
403 with { "error": "enterprise_license_required" }.Served by the gateway, not the API server. The base URL is your gateway’s HTTP origin (
https://gw.onecli.sh on Cloud; http://localhost:10255 self-hosted, or <app-url>/gw behind a reverse proxy). Read it from GET /gateway-url.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
Comma-separated approval IDs to skip (already being handled) so the poll can hold open for genuinely new requests.