curl --request PUT \
--url https://api-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"isEnabled": true
}
'import requests
url = "https://api-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle"
payload = { "isEnabled": True }
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({isEnabled: true})
};
fetch('https://api-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle', 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-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle",
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([
'isEnabled' => true
]),
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-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle"
payload := strings.NewReader("{\n \"isEnabled\": true\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-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"isEnabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle")
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 \"isEnabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"scope": "PROJECT",
"organizationId": "550e8400-e29b-41d4-a716-446655440001",
"name": "Production Security Policy",
"priority": 10,
"config": {
"rules": [],
"exclusions": []
},
"isEnabled": true,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z",
"projectIds": [
"550e8400-e29b-41d4-a716-446655440002"
],
"teamIds": [
"550e8400-e29b-41d4-a716-446655440003"
],
"description": "Security policy for production environment",
"createdBy": "<string>",
"updatedBy": "<string>"
}{
"timestamp": "2025-02-18T12:31:18.491Z",
"service": "AiService",
"method": "startConversation",
"message": "Invalid parameters provided",
"code": 400
}{
"timestamp": "2025-02-18T12:31:18.491Z",
"service": "AiService",
"method": "startConversation",
"message": "Invalid parameters provided",
"code": 400
}Enable or disable a security policy
Toggle the enabled state of a security policy. For organization-level policies, only one can be active at a time.
curl --request PUT \
--url https://api-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"isEnabled": true
}
'import requests
url = "https://api-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle"
payload = { "isEnabled": True }
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({isEnabled: true})
};
fetch('https://api-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle', 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-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle",
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([
'isEnabled' => true
]),
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-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle"
payload := strings.NewReader("{\n \"isEnabled\": true\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-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"isEnabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}/toggle")
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 \"isEnabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"scope": "PROJECT",
"organizationId": "550e8400-e29b-41d4-a716-446655440001",
"name": "Production Security Policy",
"priority": 10,
"config": {
"rules": [],
"exclusions": []
},
"isEnabled": true,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z",
"projectIds": [
"550e8400-e29b-41d4-a716-446655440002"
],
"teamIds": [
"550e8400-e29b-41d4-a716-446655440003"
],
"description": "Security policy for production environment",
"createdBy": "<string>",
"updatedBy": "<string>"
}{
"timestamp": "2025-02-18T12:31:18.491Z",
"service": "AiService",
"method": "startConversation",
"message": "Invalid parameters provided",
"code": 400
}{
"timestamp": "2025-02-18T12:31:18.491Z",
"service": "AiService",
"method": "startConversation",
"message": "Invalid parameters provided",
"code": 400
}Authorizations
JWT access token.
Body
New enabled state for the policy
Response
Policy state toggled
Policy ID
"550e8400-e29b-41d4-a716-446655440000"
Policy scope
ORGANIZATION, TEAM, PROJECT "PROJECT"
Organization ID the policy belongs to
"550e8400-e29b-41d4-a716-446655440001"
Policy name
"Production Security Policy"
Priority (lower = higher priority)
10
Policy configuration
{ "rules": [], "exclusions": [] }
Whether the policy is enabled
true
Creation timestamp
"2024-01-15T10:30:00Z"
Last update timestamp
"2024-01-15T10:30:00Z"
Project IDs targeted by this policy (for PROJECT scope)
["550e8400-e29b-41d4-a716-446655440002"]
Team IDs targeted by this policy (for TEAM scope)
["550e8400-e29b-41d4-a716-446655440003"]
Policy description
"Security policy for production environment"
User ID who created the policy
User ID who last updated the policy