Rulesets and rules
Create rulesets and their rules, list them page by page, and delete them once no engine applies them.
A ruleset is a named set of rules owned by an organization. Each rule is an instruction for translation, such as a required form of address, and applies to one target locale or to every locale. Engines apply a ruleset once it is attached. Rules in Studio explains how to phrase a rule precisely.
All routes use https://api.lingo.dev and API authentication. Reading needs org:ruleset:read and every change needs org:ruleset:edit, unless a grant gives access; see permissions.
Create a ruleset #
POST /v2/organizations/:orgId/rulesets
Content-Type: application/json
X-API-Key: YOUR_API_KEY{ "name": "Support writing rules", "description": "Tone and terminology for help articles" }name is a required nonempty string and description an optional string. The response is the created ruleset:
{
"id": "rst_example",
"organizationId": "org_example",
"name": "Support writing rules",
"description": "Tone and terminology for help articles",
"createdAt": "2026-11-23T17:40:38.777Z",
"updatedAt": "2026-11-23T17:40:38.777Z"
}description is null when the ruleset has none.
List and read rulesets #
GET /v2/organizations/:orgId/rulesetsGET /v2/rulesets/:idRuleset response #
The list returns { "data": [ ... ] } with every ruleset in the organization that the caller can read, ordered by name. It is not paginated. Both routes return each ruleset with three more fields:
| Field | Meaning |
|---|---|
ruleCount | Number of rules in the ruleset. |
engineCount | Number of engines the ruleset is attached to. |
canEdit | Whether the caller can change the ruleset and its rules. |
A ruleset the caller cannot read returns RulesetNotFound (404).
Update or delete a ruleset #
PATCH /v2/rulesets/:id
Content-Type: application/json{ "name": "Support style" }Send name, description, or both. Each must be a string. The response has the shape of the created ruleset.
Delete a ruleset #
DELETE /v2/rulesets/:idThe response is HTTP 200 with an empty body. Deleting a ruleset also deletes its rules.
A ruleset attached to any engine cannot be deleted: the request returns RulesetInUse (409) with engineCount. Detach it from those engines first. Deleting an engine detaches its rulesets.
Create a rule #
POST /v2/rulesets/:rulesetId/rules
Content-Type: application/json
X-API-Key: YOUR_API_KEY{
"name": "Informal address",
"text": "Address the reader with du, never Sie.",
"targetLocale": "de"
}| Field | Contract |
|---|---|
name | Required nonempty string that labels the rule. |
text | Required nonempty instruction given to translation. |
targetLocale | Required target locale the rule applies to, or "*" for every locale. |
The response is the rule:
{
"id": "ins_example",
"rulesetId": "rst_example",
"name": "Informal address",
"text": "Address the reader with du, never Sie.",
"targetLocale": "de",
"createdAt": "2026-11-23T17:40:43.115Z",
"updatedAt": "2026-11-23T17:40:43.115Z"
}List rules #
GET /v2/rulesets/:rulesetId/rules?limit=50limit is an integer from 1 to 100 and defaults to 50. Rules are ordered by target locale and then name. The response contains data and meta.nextCursor; repeat the request with cursor set to nextCursor until it is null.
GET /v2/rulesets/:rulesetId/rules/locales returns the target locales the ruleset's rules use, such as { "data": ["*", "de"] }.
Read, update, or delete a rule #
GET /v2/rules/:id
PATCH /v2/rules/:id
DELETE /v2/rules/:idPATCH takes any of name, text, and targetLocale with the contract of creation, and returns the updated rule. DELETE returns HTTP 200 with an empty body. Rule routes need the same access to the rule's ruleset as the ruleset routes. A rule the caller cannot read returns RuleNotFound (404).