> For the complete documentation index, see [llms.txt](https://docs.wproofreader.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wproofreader.com/api-reference/style-guide-api.md).

# Style guide API

Manage custom style guide rules over the HTTP API.

This command is action-based (not REST).

**Command name:** `style_guide`

See [HTTP API Overview](/api-reference/overview.md) for endpoint, methods, and formats.

{% hint style="info" %}
An **access key** is **required** for this command. See [Access key](/deployment/configuration/application-server/access-key.md).
{% endhint %}

### Rule identity, collection language

A style guide rule is scoped by **language and collection**.

To uniquely target a rule, you need all:

* `lang` (language scope)
* `rule` (rule ID)
* `collection`

`lang` defaults to `common`.\
`collection` defaults to `style guide` for add/delete/edit rule(s) action and empty for `getrules` action. Required for add/delete/edit collection actions and empty for `getcollections` action

It can also be:

* a language code like `en_US`
* a language group like `en`

### Common parameters

Every action uses parameters listed below. For common parameters for all commands, see [HTTP API Overview](/api-reference/overview.md).

| Parameter        | Type   | Required                                                                                                                 | Default       | Notes                                                                                         |
| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------ | ------------- | --------------------------------------------------------------------------------------------- |
| `cmd`            | string | Yes                                                                                                                      | `style_guide` | Command name.                                                                                 |
| `action`         | string | Yes                                                                                                                      |               | One of the actions below.                                                                     |
| `lang`           | string | No                                                                                                                       | `common`      | Language scope for the rule set. Use `en_US` or `en` to target a specific language.           |
| `new_lang`       | string | No                                                                                                                       | `common`      | Same as `lang`. Used with the `editcollection` action to update the language of a collection. |
| `rule`           | string | Yes                                                                                                                      |               | Comma-separated list of rules                                                                 |
| `collection`     | string | <p>No for add/delete/edit <code>rule</code> actions.<br><br>Yes for add/delete/edit <code>collection</code> actions.</p> | `style guide` | Name of the collection in which rules are stored.                                             |
| `new_collection` | string | Yes                                                                                                                      |               | Modified name of the collection in which rules will be stored                                 |

{% hint style="info" %}
If you only know the text pattern but don’t have a rule ID yet, start with `getrules`.
{% endhint %}

{% hint style="warning" %}
`lang` is part of the rule identity. Same `rule` ID in a different `lang` scope is treated as a different target.
{% endhint %}

### Actions

<table data-view="cards"><thead><tr><th>Action</th><th>Description</th><th data-card-target data-type="content-ref">Docs</th></tr></thead><tbody><tr><td><strong>Add rule</strong></td><td>Creates a new rule.</td><td><a href="/api-reference/style-guide-api/actions/add-rule-addrule.md">Add rule (addrule)</a></td></tr><tr><td><strong>Get rules</strong></td><td>Lists rules in the <code>lang</code> scope.</td><td><a href="/api-reference/style-guide-api/actions/get-rules-getrules.md">Get rules (getrules)</a></td></tr><tr><td><strong>Delete rule(s)</strong></td><td>Deletes rule(s) by ID and language.</td><td><a href="/api-reference/style-guide-api/actions/delete-rule-s-deleterule-deleterules.md">Delete rule(s) (deleterule, deleterules)</a></td></tr><tr><td><strong>Edit rule</strong></td><td>Updates an existing rule by ID and language.</td><td><a href="/api-reference/style-guide-api/actions/edit-rule-editrule.md">Edit rule (editrule)</a></td></tr><tr><td>Add collection</td><td>Creates a new collection.</td><td><a href="/api-reference/style-guide-api/actions/add-collection-addcollection.md">Add collection (addcollection)</a></td></tr><tr><td>Delete collection</td><td>Deletes collection by collection name and language.</td><td><a href="/api-reference/style-guide-api/actions/delete-collection-deletecollection.md">Delete collection (deletecollection)</a></td></tr><tr><td>Get collections</td><td>Lists collections in the <code>lang</code> scope.</td><td><a href="/api-reference/style-guide-api/actions/get-collections-getcollections.md">Get collections (getcollections)</a></td></tr><tr><td>Edit collection</td><td>Modifies an existing collection.</td><td><a href="/api-reference/style-guide-api/actions/edit-collection-editcollections.md">Edit collection (editcollections)</a></td></tr></tbody></table>

### Response format

Success responses share the same envelope and rule object schema.

See [Response schema](/api-reference/style-guide-api/response-schema.md).

### Errors and validation

* [Errors](/api-reference/style-guide-api/errors.md)
* [Validation & limits](/api-reference/style-guide-api/validation-and-limits.md)
