List pending approvals
curl --request GET \
--url https://gw.onecli.sh/approvals/pending \
--header 'Authorization: Bearer <token>'import requests
url = "https://gw.onecli.sh/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/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/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/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/approvals/pending")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://gw.onecli.sh/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": "<string>"
}Approvals
List pending manual approvals in a workspace
Long-polls for manual-approval requests waiting on a decision in the current workspace. Returns at once if any are pending, else waits up to timeoutSeconds.
GET
/
approvals
/
pending
List pending approvals
curl --request GET \
--url https://gw.onecli.sh/approvals/pending \
--header 'Authorization: Bearer <token>'import requests
url = "https://gw.onecli.sh/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/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/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/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/approvals/pending")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://gw.onecli.sh/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": "<string>"
}Holds the connection open for up to
timeoutSeconds so your approver can react quickly without busy polling. See Rules for which requests need approval.
Long-polls for manual-approval requests awaiting a decision in the current workspace. Returns immediately when any are pending, otherwise holds the connection open (up to timeoutSeconds) until one arrives or the poll times out.
Authenticate with a workspace API key, or an organization key plus an X-Workspace-Id header. Submit each decision to POST /approvals/{id}/decision.
Availability: Cloud · Community (self-hosted) · Enterprise (self-hosted)
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.