curl --request PUT \
--url https://api.onecli.sh/v1/org/policy/rules/order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"orderedIds": [
"<string>"
]
}
'import requests
url = "https://api.onecli.sh/v1/org/policy/rules/order"
payload = { "orderedIds": ["<string>"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({orderedIds: ['<string>']})
};
fetch('https://api.onecli.sh/v1/org/policy/rules/order', 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/org/policy/rules/order",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'orderedIds' => [
'<string>'
]
]),
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://api.onecli.sh/v1/org/policy/rules/order"
payload := strings.NewReader("{\n \"orderedIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.onecli.sh/v1/org/policy/rules/order")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"orderedIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onecli.sh/v1/org/policy/rules/order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"orderedIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"id": "<string>",
"scope": "project",
"status": "draft",
"generation": 123,
"priority": 123,
"enabled": true,
"isDefault": true,
"logicalId": "<string>",
"source": "<string>",
"name": "<string>",
"description": "<string>",
"action": "allow",
"rateLimit": 123,
"rateLimitWindow": "minute",
"requireApproval": true,
"conditions": "<unknown>",
"identities": [
{
"type": "agent",
"id": "<string>"
}
],
"targets": [
{
"kind": "app",
"provider": "<string>",
"tools": [
"<string>"
],
"connectionScope": "organization",
"connectionId": "<string>",
"secretId": "<string>",
"secretScope": "organization",
"hostPattern": "<string>",
"pathPattern": "<string>",
"method": "GET"
}
],
"createdAt": "2023-11-07T05:31:56Z"
}
]Reorder the draft (organization)
Sets the draft’s first-match order. orderedIds must name EVERY non-default draft rule exactly once (including the system-managed rows) or the server responds 409 (“Rule set changed — refresh and try again.”).
curl --request PUT \
--url https://api.onecli.sh/v1/org/policy/rules/order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"orderedIds": [
"<string>"
]
}
'import requests
url = "https://api.onecli.sh/v1/org/policy/rules/order"
payload = { "orderedIds": ["<string>"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({orderedIds: ['<string>']})
};
fetch('https://api.onecli.sh/v1/org/policy/rules/order', 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/org/policy/rules/order",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'orderedIds' => [
'<string>'
]
]),
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://api.onecli.sh/v1/org/policy/rules/order"
payload := strings.NewReader("{\n \"orderedIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.onecli.sh/v1/org/policy/rules/order")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"orderedIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onecli.sh/v1/org/policy/rules/order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"orderedIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"id": "<string>",
"scope": "project",
"status": "draft",
"generation": 123,
"priority": 123,
"enabled": true,
"isDefault": true,
"logicalId": "<string>",
"source": "<string>",
"name": "<string>",
"description": "<string>",
"action": "allow",
"rateLimit": 123,
"rateLimitWindow": "minute",
"requireApproval": true,
"conditions": "<unknown>",
"identities": [
{
"type": "agent",
"id": "<string>"
}
],
"targets": [
{
"kind": "app",
"provider": "<string>",
"tools": [
"<string>"
],
"connectionScope": "organization",
"connectionId": "<string>",
"secretId": "<string>",
"secretScope": "organization",
"hostPattern": "<string>",
"pathPattern": "<string>",
"method": "GET"
}
],
"createdAt": "2023-11-07T05:31:56Z"
}
]Authorizations
API key obtained from the dashboard or GET /user/api-key
Body
Response
The reordered draft
project, organization draft, published 0 for the draft working copy; the snapshot number for published rows.
First-match order (lower evaluates first).
True on the scope's terminal Default Rule.
Generation-stable identity; compare rules across draft/published by this, never by id.
custom (user-owned, editable), default (the Default Rule), or system-managed rows: blocklist (compiled from app blocklists) and — at project scope — grant (compiled from agent grants; managed through the Grants endpoints, never edited as rules). Older deployments may also carry legacy app_permission/equipment rows.
allow, block minute, hour, day, null A conditions array, a session-policy object ({repositories} / {folders}), or null.
Show child attributes
Show child attributes
Show child attributes
Show child attributes