curl --request PATCH \
--url https://eu.phrase.com/styleguide/api/v1/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ruleIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"active": true,
"critical": true
}
'import requests
url = "https://eu.phrase.com/styleguide/api/v1/rules"
payload = {
"ruleIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"active": True,
"critical": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ruleIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
active: true,
critical: true
})
};
fetch('https://eu.phrase.com/styleguide/api/v1/rules', 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://eu.phrase.com/styleguide/api/v1/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'ruleIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'active' => true,
'critical' => 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://eu.phrase.com/styleguide/api/v1/rules"
payload := strings.NewReader("{\n \"ruleIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"active\": true,\n \"critical\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://eu.phrase.com/styleguide/api/v1/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ruleIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"active\": true,\n \"critical\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://eu.phrase.com/styleguide/api/v1/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ruleIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"active\": true,\n \"critical\": true\n}"
response = http.request(request)
puts response.read_body{
"updatedCount": 123,
"failures": [
{
"ruleId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"errorCode": "RULE_NOT_FOUND",
"errorMessage": "<string>",
"contentGroupId": "<string>",
"language": "de",
"limit": 5
}
]
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}Enable, disable, mark critical or unmark critical Rules in bulk
Enables or disables the listed Rules (active), or marks or unmarks them as critical
(critical), in a single request. Exactly one of active and critical must be set; a
request with both or neither is rejected with 400 VALIDATION_ERROR. Both fields have the
same semantics as on updateRule. Partial success is possible; the response reports the
updated count and per-rule failures.
Enabling (active=true)
Rules are enabled in the order given in ruleIds. A Rule whose (Content Group, Language)
scope has no room left under the organization’s active-rule limit is skipped — reported as
a RULE_ACTIVE_LIMIT_REACHED failure — while later Rules with a different scope are still
attempted. This never changes aiCheckEnabled, matching updateRule’s behavior for an
explicit active=true with no aiCheckEnabled in the request.
Disabling (active=false)
Every listed Rule is disabled, and aiCheckEnabled is forced to false on each — AI check
requires an active Rule, the same cascade updateRule already applies for a single Rule.
Consistency guarantee
When active=true, the active-rule limit check is atomic across the whole batch: every
Rule in the request is evaluated against a single consistent view of each scope’s limit,
the same guarantee createRule/updateRule provide for a single Rule. If that guarantee
cannot be honored right now, the request fails with 503 RULE_ACTIVATION_LOCK_UNAVAILABLE
— retry the request. Not applicable when active=false.
Marking critical (critical=true)
Rules are marked in the order given in ruleIds, in one transaction under the activation
lock; each mark counts toward the next Rule’s check. A Rule is skipped when it is inactive
(RULE_INACTIVE) or when marking it would exceed the critical-rule limit for one of its
Content Group/Language combinations (RULE_CRITICAL_LIMIT_REACHED, with that combination’s
contentGroupId and language, either absent meaning all, and the limit). Rules already
critical count as updated and keep their marking time.
Unmarking critical (critical=false)
Every listed critical Rule is unmarked, active or inactive. No lock is taken. Rules already non-critical count as updated.
curl --request PATCH \
--url https://eu.phrase.com/styleguide/api/v1/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ruleIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"active": true,
"critical": true
}
'import requests
url = "https://eu.phrase.com/styleguide/api/v1/rules"
payload = {
"ruleIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"active": True,
"critical": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ruleIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
active: true,
critical: true
})
};
fetch('https://eu.phrase.com/styleguide/api/v1/rules', 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://eu.phrase.com/styleguide/api/v1/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'ruleIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'active' => true,
'critical' => 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://eu.phrase.com/styleguide/api/v1/rules"
payload := strings.NewReader("{\n \"ruleIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"active\": true,\n \"critical\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://eu.phrase.com/styleguide/api/v1/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ruleIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"active\": true,\n \"critical\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://eu.phrase.com/styleguide/api/v1/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ruleIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"active\": true,\n \"critical\": true\n}"
response = http.request(request)
puts response.read_body{
"updatedCount": 123,
"failures": [
{
"ruleId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"errorCode": "RULE_NOT_FOUND",
"errorMessage": "<string>",
"contentGroupId": "<string>",
"language": "de",
"limit": 5
}
]
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}Body
Request to bulk-update Rules. Exactly one of active or critical must be set.
Was this page helpful?