Skip to main content
POST
/
api
/
v1
/
rules
/
search
List Rules
curl --request POST \
  --url https://eu.phrase.com/styleguide/api/v1/rules/search \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "pageNumber": 0,
  "pageSize": 20,
  "sortBy": "createdAt",
  "sortDirection": "DESC",
  "contentGroupIds": [
    "cg-marketing-en"
  ],
  "languages": [
    "en-GB"
  ],
  "active": true,
  "aiCheckEnabled": true,
  "styleGuideIds": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ],
  "lastModifiedBy": [
    "5efc4feca115ac0bb5321917"
  ],
  "ruleText": "Oxford comma"
}
'
import requests

url = "https://eu.phrase.com/styleguide/api/v1/rules/search"

payload = {
"pageNumber": 0,
"pageSize": 20,
"sortBy": "createdAt",
"sortDirection": "DESC",
"contentGroupIds": ["cg-marketing-en"],
"languages": ["en-GB"],
"active": True,
"aiCheckEnabled": True,
"styleGuideIds": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"],
"lastModifiedBy": ["5efc4feca115ac0bb5321917"],
"ruleText": "Oxford comma"
}
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({
pageNumber: 0,
pageSize: 20,
sortBy: 'createdAt',
sortDirection: 'DESC',
contentGroupIds: ['cg-marketing-en'],
languages: ['en-GB'],
active: true,
aiCheckEnabled: true,
styleGuideIds: ['3fa85f64-5717-4562-b3fc-2c963f66afa6'],
lastModifiedBy: ['5efc4feca115ac0bb5321917'],
ruleText: 'Oxford comma'
})
};

fetch('https://eu.phrase.com/styleguide/api/v1/rules/search', 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/search",
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([
'pageNumber' => 0,
'pageSize' => 20,
'sortBy' => 'createdAt',
'sortDirection' => 'DESC',
'contentGroupIds' => [
'cg-marketing-en'
],
'languages' => [
'en-GB'
],
'active' => true,
'aiCheckEnabled' => true,
'styleGuideIds' => [
'3fa85f64-5717-4562-b3fc-2c963f66afa6'
],
'lastModifiedBy' => [
'5efc4feca115ac0bb5321917'
],
'ruleText' => 'Oxford comma'
]),
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/search"

payload := strings.NewReader("{\n \"pageNumber\": 0,\n \"pageSize\": 20,\n \"sortBy\": \"createdAt\",\n \"sortDirection\": \"DESC\",\n \"contentGroupIds\": [\n \"cg-marketing-en\"\n ],\n \"languages\": [\n \"en-GB\"\n ],\n \"active\": true,\n \"aiCheckEnabled\": true,\n \"styleGuideIds\": [\n \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\n ],\n \"lastModifiedBy\": [\n \"5efc4feca115ac0bb5321917\"\n ],\n \"ruleText\": \"Oxford comma\"\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/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"pageNumber\": 0,\n \"pageSize\": 20,\n \"sortBy\": \"createdAt\",\n \"sortDirection\": \"DESC\",\n \"contentGroupIds\": [\n \"cg-marketing-en\"\n ],\n \"languages\": [\n \"en-GB\"\n ],\n \"active\": true,\n \"aiCheckEnabled\": true,\n \"styleGuideIds\": [\n \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\n ],\n \"lastModifiedBy\": [\n \"5efc4feca115ac0bb5321917\"\n ],\n \"ruleText\": \"Oxford comma\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://eu.phrase.com/styleguide/api/v1/rules/search")

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 \"pageNumber\": 0,\n \"pageSize\": 20,\n \"sortBy\": \"createdAt\",\n \"sortDirection\": \"DESC\",\n \"contentGroupIds\": [\n \"cg-marketing-en\"\n ],\n \"languages\": [\n \"en-GB\"\n ],\n \"active\": true,\n \"aiCheckEnabled\": true,\n \"styleGuideIds\": [\n \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\n ],\n \"lastModifiedBy\": [\n \"5efc4feca115ac0bb5321917\"\n ],\n \"ruleText\": \"Oxford comma\"\n}"

response = http.request(request)
puts response.read_body
{
  "content": [
    {
      "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",
      "styleGuide": null,
      "createdBy": null,
      "lastModifiedBy": null
    }
  ],
  "totalElements": 123,
  "totalPages": 123,
  "pageNumber": 123,
  "pageSize": 123,
  "numberOfElements": 123
}
{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}
{
"code": "<string>",
"message": "<string>",
"detail": "<string>"
}

Authorizations

Authorization
string
header
required

JWT from IDM (Authorization: Bearer )

Body

application/json

Request parameters for listing Rules

pageNumber
integer<int32>

Page number (0-indexed)

Required range: x >= 0
Example:

0

pageSize
integer<int32>

Page size (1–100)

Required range: 1 <= x <= 100
Example:

20

sortBy
enum<string>

Sort field

Available options:
createdAt,
rule
Example:

"createdAt"

sortDirection
enum<string>

Sort direction

Available options:
ASC,
DESC
Example:

"DESC"

contentGroupIds
string[]

Filter by content group IDs (multi-valued). An empty list matches all content groups.

Maximum array length: 50
Minimum string length: 1
Example:
["cg-marketing-en"]
languages
string[]

Filter by language codes (multi-valued, exact match). An empty list matches all languages.

Maximum array length: 50
Minimum string length: 1
Example:
["en-GB"]
active
boolean

Filter by active status.

Example:

true

aiCheckEnabled
boolean

Filter by AI-check-enabled status.

Example:

true

styleGuideIds
string<uuid>[]

Filter by Style Guide IDs (multi-valued). Rules not linked to any Style Guide are excluded when this filter is set. If omitted or empty, this filter is not applied.

Maximum array length: 50
Example:
["3fa85f64-5717-4562-b3fc-2c963f66afa6"]
lastModifiedBy
string[]

Filter by last-modified-by user account IDs (multi-valued). If omitted or empty, this filter is not applied.

Maximum array length: 50
Minimum string length: 1
Example:
["5efc4feca115ac0bb5321917"]
ruleText
string

Filter by rule text (case-insensitive contains match).

Maximum string length: 450
Example:

"Oxford comma"

Response

Rules retrieved successfully

Paginated list of Rules

content
object[]
required
totalElements
integer<int64>
required

Total number of rules matching the query

totalPages
integer<int32>
required

Total number of pages

pageNumber
integer<int32>
required

Current page number (0-indexed)

pageSize
integer<int32>
required

Page size

numberOfElements
integer<int32>
required

Number of rules in the current page