Replace the app-availability policy
curl --request PUT \
--url https://api.onecli.sh/v1/org/app-availability \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rules": [
{
"userIds": [
"<string>"
],
"groupIds": [
"<string>"
],
"providers": [
"<string>"
],
"id": "<string>",
"name": "<string>"
}
]
}
'import requests
url = "https://api.onecli.sh/v1/org/app-availability"
payload = { "rules": [
{
"userIds": ["<string>"],
"groupIds": ["<string>"],
"providers": ["<string>"],
"id": "<string>",
"name": "<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({
rules: [
{
userIds: ['<string>'],
groupIds: ['<string>'],
providers: ['<string>'],
id: '<string>',
name: '<string>'
}
]
})
};
fetch('https://api.onecli.sh/v1/org/app-availability', 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/app-availability",
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([
'rules' => [
[
'userIds' => [
'<string>'
],
'groupIds' => [
'<string>'
],
'providers' => [
'<string>'
],
'id' => '<string>',
'name' => '<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/app-availability"
payload := strings.NewReader("{\n \"rules\": [\n {\n \"userIds\": [\n \"<string>\"\n ],\n \"groupIds\": [\n \"<string>\"\n ],\n \"providers\": [\n \"<string>\"\n ],\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n }\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/app-availability")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rules\": [\n {\n \"userIds\": [\n \"<string>\"\n ],\n \"groupIds\": [\n \"<string>\"\n ],\n \"providers\": [\n \"<string>\"\n ],\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onecli.sh/v1/org/app-availability")
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 \"rules\": [\n {\n \"userIds\": [\n \"<string>\"\n ],\n \"groupIds\": [\n \"<string>\"\n ],\n \"providers\": [\n \"<string>\"\n ],\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"mode": "open",
"rules": [
{
"id": "<string>",
"name": "<string>",
"userIds": [
"<string>"
],
"groupIds": [
"<string>"
],
"providers": [
"<string>"
]
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}App availability
Replace the app-availability policy
Sets the policy to open or restricted. Restricted rules name people, groups, and the providers they may connect. Cloud restriction needs the Scale plan.
PUT
/
org
/
app-availability
Replace the app-availability policy
curl --request PUT \
--url https://api.onecli.sh/v1/org/app-availability \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rules": [
{
"userIds": [
"<string>"
],
"groupIds": [
"<string>"
],
"providers": [
"<string>"
],
"id": "<string>",
"name": "<string>"
}
]
}
'import requests
url = "https://api.onecli.sh/v1/org/app-availability"
payload = { "rules": [
{
"userIds": ["<string>"],
"groupIds": ["<string>"],
"providers": ["<string>"],
"id": "<string>",
"name": "<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({
rules: [
{
userIds: ['<string>'],
groupIds: ['<string>'],
providers: ['<string>'],
id: '<string>',
name: '<string>'
}
]
})
};
fetch('https://api.onecli.sh/v1/org/app-availability', 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/app-availability",
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([
'rules' => [
[
'userIds' => [
'<string>'
],
'groupIds' => [
'<string>'
],
'providers' => [
'<string>'
],
'id' => '<string>',
'name' => '<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/app-availability"
payload := strings.NewReader("{\n \"rules\": [\n {\n \"userIds\": [\n \"<string>\"\n ],\n \"groupIds\": [\n \"<string>\"\n ],\n \"providers\": [\n \"<string>\"\n ],\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n }\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/app-availability")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rules\": [\n {\n \"userIds\": [\n \"<string>\"\n ],\n \"groupIds\": [\n \"<string>\"\n ],\n \"providers\": [\n \"<string>\"\n ],\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.onecli.sh/v1/org/app-availability")
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 \"rules\": [\n {\n \"userIds\": [\n \"<string>\"\n ],\n \"groupIds\": [\n \"<string>\"\n ],\n \"providers\": [\n \"<string>\"\n ],\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"mode": "open",
"rules": [
{
"id": "<string>",
"name": "<string>",
"userIds": [
"<string>"
],
"groupIds": [
"<string>"
],
"providers": [
"<string>"
]
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}Sets the whole policy at once. In
restricted mode, each rule names people and groups and the providers they may connect. Existing connections are not removed.
open lets every workspace connect every app. restricted allows only what the rules grant — each rule names people and groups and the providers they may connect. Resetting to open with no rules is never gated. On Cloud, restriction needs the Scale plan and group-targeted rules the Enterprise plan.
Availability: Cloud · Enterprise (self-hosted). Not available on the Community edition: a self-hosted deployment needs
ENTERPRISE_ENABLED=true, otherwise the endpoint answers 403 with error.type: "enterprise_license_required".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.
Body
application/json