Create a draft policy
curl --request POST \
--url https://api.antarah.dev/v1/organization/policies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"rule": "<string>",
"description": "<string>",
"project_ids": [
"proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f"
],
"match_threshold_basis_points": 5000
}
'import requests
url = "https://api.antarah.dev/v1/organization/policies"
payload = {
"name": "<string>",
"rule": "<string>",
"description": "<string>",
"project_ids": ["proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f"],
"match_threshold_basis_points": 5000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
rule: '<string>',
description: '<string>',
project_ids: ['proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f'],
match_threshold_basis_points: 5000
})
};
fetch('https://api.antarah.dev/v1/organization/policies', 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.antarah.dev/v1/organization/policies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'rule' => '<string>',
'description' => '<string>',
'project_ids' => [
'proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f'
],
'match_threshold_basis_points' => 5000
]),
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.antarah.dev/v1/organization/policies"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"rule\": \"<string>\",\n \"description\": \"<string>\",\n \"project_ids\": [\n \"proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f\"\n ],\n \"match_threshold_basis_points\": 5000\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.antarah.dev/v1/organization/policies")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"rule\": \"<string>\",\n \"description\": \"<string>\",\n \"project_ids\": [\n \"proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f\"\n ],\n \"match_threshold_basis_points\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.antarah.dev/v1/organization/policies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"rule\": \"<string>\",\n \"description\": \"<string>\",\n \"project_ids\": [\n \"proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f\"\n ],\n \"match_threshold_basis_points\": 5000\n}"
response = http.request(request)
puts response.read_body{
"id": "pol_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f",
"object": "organization.policy",
"name": "<string>",
"description": "<string>",
"state": "draft",
"revision": 123,
"has_unpublished_changes": true,
"current_version": 123,
"created_at": 1793750400,
"updated_at": 1793750400,
"draft": {
"rule": "<string>",
"direction": "request",
"mode": "monitoring",
"scope": "organization",
"project_ids": [
"proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f"
],
"match_threshold_basis_points": 123
},
"published": {
"rule": "<string>",
"direction": "request",
"mode": "monitoring",
"scope": "organization",
"project_ids": [
"proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f"
],
"match_threshold_basis_points": 123,
"id": "polv_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f",
"object": "organization.policy.version",
"version": 123,
"published_at": 1793750400,
"current": true
}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>",
"code": "<string>",
"request_id": "<string>",
"param": "<string>",
"errors": [
{
"pointer": "<string>",
"detail": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>",
"code": "<string>",
"request_id": "<string>",
"param": "<string>",
"errors": [
{
"pointer": "<string>",
"detail": "<string>"
}
]
}Create a draft policy
POST
/
v1
/
organization
/
policies
Create a draft policy
curl --request POST \
--url https://api.antarah.dev/v1/organization/policies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"rule": "<string>",
"description": "<string>",
"project_ids": [
"proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f"
],
"match_threshold_basis_points": 5000
}
'import requests
url = "https://api.antarah.dev/v1/organization/policies"
payload = {
"name": "<string>",
"rule": "<string>",
"description": "<string>",
"project_ids": ["proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f"],
"match_threshold_basis_points": 5000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
rule: '<string>',
description: '<string>',
project_ids: ['proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f'],
match_threshold_basis_points: 5000
})
};
fetch('https://api.antarah.dev/v1/organization/policies', 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.antarah.dev/v1/organization/policies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'rule' => '<string>',
'description' => '<string>',
'project_ids' => [
'proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f'
],
'match_threshold_basis_points' => 5000
]),
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.antarah.dev/v1/organization/policies"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"rule\": \"<string>\",\n \"description\": \"<string>\",\n \"project_ids\": [\n \"proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f\"\n ],\n \"match_threshold_basis_points\": 5000\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.antarah.dev/v1/organization/policies")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"rule\": \"<string>\",\n \"description\": \"<string>\",\n \"project_ids\": [\n \"proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f\"\n ],\n \"match_threshold_basis_points\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.antarah.dev/v1/organization/policies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"rule\": \"<string>\",\n \"description\": \"<string>\",\n \"project_ids\": [\n \"proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f\"\n ],\n \"match_threshold_basis_points\": 5000\n}"
response = http.request(request)
puts response.read_body{
"id": "pol_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f",
"object": "organization.policy",
"name": "<string>",
"description": "<string>",
"state": "draft",
"revision": 123,
"has_unpublished_changes": true,
"current_version": 123,
"created_at": 1793750400,
"updated_at": 1793750400,
"draft": {
"rule": "<string>",
"direction": "request",
"mode": "monitoring",
"scope": "organization",
"project_ids": [
"proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f"
],
"match_threshold_basis_points": 123
},
"published": {
"rule": "<string>",
"direction": "request",
"mode": "monitoring",
"scope": "organization",
"project_ids": [
"proj_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f"
],
"match_threshold_basis_points": 123,
"id": "polv_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f",
"object": "organization.policy.version",
"version": 123,
"published_at": 1793750400,
"current": true
}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>",
"code": "<string>",
"request_id": "<string>",
"param": "<string>",
"errors": [
{
"pointer": "<string>",
"detail": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>",
"code": "<string>",
"request_id": "<string>",
"param": "<string>",
"errors": [
{
"pointer": "<string>",
"detail": "<string>"
}
]
}Authorizations
adminKeysession
ak_admin_… Admin API key
Body
application/json
1–80 Unicode code points, trimmed
Maximum string length:
801–20000; a yes/no question ending with ?, ? or ؟
Available options:
request, response, both Available options:
organization, projects, unattached Available options:
monitoring, enforcing Maximum array length:
1000Pattern:
^proj_[0-9a-f]{32}$1–9999, or null = platform default 7000
Required range:
1 <= x <= 9999Response
Created
Pattern:
^pol_[0-9a-f]{32}$Example:
"pol_0193a6c2e7b47c3d9f1e2a4b5c6d7e8f"
Available options:
organization.policy Available options:
draft, monitoring, enforcing, paused Unix seconds
Example:
1793750400
Unix seconds
Example:
1793750400
Show child attributes
Show child attributes
Show child attributes
Show child attributes
