curl --request POST \
--url https://eu.phrase.com/styleguide/api/v1/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rule": "Avoid passive voice in all user-facing content.",
"allContentGroups": false,
"contentGroupIds": [
"<string>"
],
"allLanguages": false,
"languages": [
"<string>"
],
"active": true,
"aiCheckEnabled": true
}
'import requests
url = "https://eu.phrase.com/styleguide/api/v1/rules"
payload = {
"rule": "Avoid passive voice in all user-facing content.",
"allContentGroups": False,
"contentGroupIds": ["<string>"],
"allLanguages": False,
"languages": ["<string>"],
"active": True,
"aiCheckEnabled": True
}
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({
rule: 'Avoid passive voice in all user-facing content.',
allContentGroups: false,
contentGroupIds: ['<string>'],
allLanguages: false,
languages: ['<string>'],
active: true,
aiCheckEnabled: 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 => "POST",
CURLOPT_POSTFIELDS => json_encode([
'rule' => 'Avoid passive voice in all user-facing content.',
'allContentGroups' => false,
'contentGroupIds' => [
'<string>'
],
'allLanguages' => false,
'languages' => [
'<string>'
],
'active' => true,
'aiCheckEnabled' => 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 \"rule\": \"Avoid passive voice in all user-facing content.\",\n \"allContentGroups\": false,\n \"contentGroupIds\": [\n \"<string>\"\n ],\n \"allLanguages\": false,\n \"languages\": [\n \"<string>\"\n ],\n \"active\": true,\n \"aiCheckEnabled\": true\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://eu.phrase.com/styleguide/api/v1/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rule\": \"Avoid passive voice in all user-facing content.\",\n \"allContentGroups\": false,\n \"contentGroupIds\": [\n \"<string>\"\n ],\n \"allLanguages\": false,\n \"languages\": [\n \"<string>\"\n ],\n \"active\": true,\n \"aiCheckEnabled\": 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::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rule\": \"Avoid passive voice in all user-facing content.\",\n \"allContentGroups\": false,\n \"contentGroupIds\": [\n \"<string>\"\n ],\n \"allLanguages\": false,\n \"languages\": [\n \"<string>\"\n ],\n \"active\": true,\n \"aiCheckEnabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "01900000-0000-7000-8000-000000000001",
"rule": "Avoid passive voice in all user-facing content.",
"active": true,
"aiCheckEnabled": true,
"allContentGroups": true,
"allLanguages": true,
"contentGroups": [
{
"id": "cg-marketing-en"
}
],
"languages": [
{
"bcpCode": "en-GB",
"description": "English (United Kingdom)",
"language": "cs",
"region": "gb",
"script": "LATN"
}
],
"createdAt": "2024-01-15T10:30:00Z",
"lastModifiedAt": "2024-06-01T14:22:00Z",
"name": "No passive voice",
"omittedReason": "<string>",
"eligibilityCheckedAt": "2024-06-01T14:22:05Z",
"styleGuide": null,
"createdBy": null,
"lastModifiedBy": null
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}Create a Rule
Creates a Rule for the authenticated organization.
Active-rule and AI-check limits
Each organization has a limit on active rules and on active, AI-check-enabled rules per
(Content Group, Language) pair. Whether the created rule counts against those limits — and
whether an over-limit request fails or is silently adjusted — depends on whether active /
aiCheckEnabled were explicitly set in the request:
active in request | Active-rule limit reached for scope? | Result |
|---|---|---|
true (explicit) | No | Created active |
true (explicit) | Yes | 409 RULE_ACTIVE_LIMIT_REACHED |
false (explicit) | — | Created inactive |
| omitted | No | Auto-decided: created active |
| omitted | Yes | Auto-decided: created inactive (no error) |
aiCheckEnabled in request | Resulting active | AI-check limit reached for scope? | Result |
|---|---|---|---|
true (explicit) | false | — | 400 INVALID_ARGUMENT (AI-check requires an active rule) |
true (explicit) | true | No | Created with AI-check enabled |
true (explicit) | true | Yes | 409 RULE_AI_CHECK_LIMIT_REACHED |
false (explicit) | any | — | Created with AI-check disabled |
| omitted | false | — | AI-check disabled (no auto-enable) |
| omitted | true | No | Auto-decided: AI-check enabled |
| omitted | true | Yes | Auto-decided: AI-check disabled (no error) |
The active-rule limit is checked before the AI-check limit, so an explicit active=true
that is already over the active-rule limit fails without evaluating the AI-check limit at all.
The “All Groups” system content group
Passing the organization’s Control Hub “All Groups” system content group ID as the sole entry
in contentGroupIds is equivalent to setting allContentGroups=true — the rule is created
with allContentGroups=true and an empty contentGroupIds, the same as if the system content
group ID had never been mentioned. Combining the system content group ID with any other
content group ID in the same request is rejected with 400 INVALID_ARGUMENT.
Activation lock
Limit checks are performed under a per-organization activation lock to prevent race
conditions between concurrent create/update requests. If the lock cannot be acquired,
the request fails with 503 RULE_ACTIVATION_LOCK_UNAVAILABLE — retry the request.
curl --request POST \
--url https://eu.phrase.com/styleguide/api/v1/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rule": "Avoid passive voice in all user-facing content.",
"allContentGroups": false,
"contentGroupIds": [
"<string>"
],
"allLanguages": false,
"languages": [
"<string>"
],
"active": true,
"aiCheckEnabled": true
}
'import requests
url = "https://eu.phrase.com/styleguide/api/v1/rules"
payload = {
"rule": "Avoid passive voice in all user-facing content.",
"allContentGroups": False,
"contentGroupIds": ["<string>"],
"allLanguages": False,
"languages": ["<string>"],
"active": True,
"aiCheckEnabled": True
}
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({
rule: 'Avoid passive voice in all user-facing content.',
allContentGroups: false,
contentGroupIds: ['<string>'],
allLanguages: false,
languages: ['<string>'],
active: true,
aiCheckEnabled: 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 => "POST",
CURLOPT_POSTFIELDS => json_encode([
'rule' => 'Avoid passive voice in all user-facing content.',
'allContentGroups' => false,
'contentGroupIds' => [
'<string>'
],
'allLanguages' => false,
'languages' => [
'<string>'
],
'active' => true,
'aiCheckEnabled' => 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 \"rule\": \"Avoid passive voice in all user-facing content.\",\n \"allContentGroups\": false,\n \"contentGroupIds\": [\n \"<string>\"\n ],\n \"allLanguages\": false,\n \"languages\": [\n \"<string>\"\n ],\n \"active\": true,\n \"aiCheckEnabled\": true\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://eu.phrase.com/styleguide/api/v1/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rule\": \"Avoid passive voice in all user-facing content.\",\n \"allContentGroups\": false,\n \"contentGroupIds\": [\n \"<string>\"\n ],\n \"allLanguages\": false,\n \"languages\": [\n \"<string>\"\n ],\n \"active\": true,\n \"aiCheckEnabled\": 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::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rule\": \"Avoid passive voice in all user-facing content.\",\n \"allContentGroups\": false,\n \"contentGroupIds\": [\n \"<string>\"\n ],\n \"allLanguages\": false,\n \"languages\": [\n \"<string>\"\n ],\n \"active\": true,\n \"aiCheckEnabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "01900000-0000-7000-8000-000000000001",
"rule": "Avoid passive voice in all user-facing content.",
"active": true,
"aiCheckEnabled": true,
"allContentGroups": true,
"allLanguages": true,
"contentGroups": [
{
"id": "cg-marketing-en"
}
],
"languages": [
{
"bcpCode": "en-GB",
"description": "English (United Kingdom)",
"language": "cs",
"region": "gb",
"script": "LATN"
}
],
"createdAt": "2024-01-15T10:30:00Z",
"lastModifiedAt": "2024-06-01T14:22:00Z",
"name": "No passive voice",
"omittedReason": "<string>",
"eligibilityCheckedAt": "2024-06-01T14:22:05Z",
"styleGuide": null,
"createdBy": null,
"lastModifiedBy": null
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}Authorizations
JWT from IDM (Authorization: Bearer )
Body
Request to create a new Rule
Rule text
450"Avoid passive voice in all user-facing content."
When true, this rule applies to all content groups and contentGroupIds must be absent or empty. When false (default), contentGroupIds must be provided and non-empty.
false
Content Group IDs this rule applies to. Must be non-empty when allContentGroups is false. Must be absent or empty when allContentGroups is true.
10036When true, this rule applies to all languages and languages must be absent or empty. When false (default), languages must be provided and non-empty.
false
Language codes this rule applies to (e.g., en, en-GB). Equivalent representations such as en_US are accepted and normalised to canonical BCP-47 (en-US). Must be non-empty when allLanguages is false. Must be absent or empty when allLanguages is true.
1001Whether this rule is active. When omitted, the service decides based on remaining room under the active-rule limit for the rule's Content Group(s) and Language(s).
true
Whether this rule is used during AI-powered quality checks. When omitted on an active rule, the service decides based on remaining room under the AI-check limit.
true
Response
Rule created successfully
Rule details
Unique identifier for this Rule
"01900000-0000-7000-8000-000000000001"
The rule text
"Avoid passive voice in all user-facing content."
Whether this rule is active
Whether this rule is used during AI-powered quality checks
Whether this rule applies to all content groups
Whether this rule applies to all languages
Content Groups this rule applies to. Empty list means all content groups. Null means no content groups are assigned.
Show child attributes
Show child attributes
Language details for languages this rule applies to. Empty list means all languages. Null means no languages are assigned.
Show child attributes
Show child attributes
When this rule was created
"2024-01-15T10:30:00Z"
When this rule was last modified
"2024-06-01T14:22:00Z"
A short, system-generated name indicating this rule's purpose. Never user-entered; automatically generated, so it may be absent shortly after the rule is created.
"No passive voice"
Reason this rule is omitted from AI checks, as determined by an automated eligibility check. Absent if the rule is eligible, or if the check hasn't completed yet.
When the automated AI-check eligibility check last completed for this rule. Null means it hasn't run yet: eligibility is still pending, so a client should treat the AI-check state as 'checking' rather than eligible. Once set, a null omittedReason means eligible and a non-null omittedReason means omitted.
"2024-06-01T14:22:05Z"
Style Guide this rule was extracted from. Null when the rule is unlinked — either manually created or subsequently edited.
User who created this rule
User who last modified this rule
Was this page helpful?