> 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/v6.12.0/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](/v6.12.0/api-reference/overview.md) for endpoint, methods, and formats.

{% hint style="info" %}
An **access key** is **required** for this command. See [Access key](/v6.12.0/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](/v6.12.0/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="/pages/fqBJTWf8oZ0XVgLaws1f">/pages/fqBJTWf8oZ0XVgLaws1f</a></td></tr><tr><td><strong>Get rules</strong></td><td>Lists rules in the <code>lang</code> scope.</td><td><a href="/pages/EO01Q73cTV6fdcyanJiq">/pages/EO01Q73cTV6fdcyanJiq</a></td></tr><tr><td><strong>Delete rule(s)</strong></td><td>Deletes rule(s) by ID and language.</td><td><a href="/pages/qnadt698valY0hr9x3Up">/pages/qnadt698valY0hr9x3Up</a></td></tr><tr><td><strong>Edit rule</strong></td><td>Updates an existing rule by ID and language.</td><td><a href="/pages/aBLrJpDr5Vd5KiovzIC3">/pages/aBLrJpDr5Vd5KiovzIC3</a></td></tr><tr><td>Add collection</td><td>Creates a new collection.</td><td><a href="/pages/MP1bPkRAdECc0dhBmpXg">/pages/MP1bPkRAdECc0dhBmpXg</a></td></tr><tr><td>Delete collection</td><td>Deletes collection by collection name and language.</td><td><a href="/pages/CqVZZTYo4Y6VFA1qW0Ra">/pages/CqVZZTYo4Y6VFA1qW0Ra</a></td></tr><tr><td>Get collections</td><td>Lists collections in the <code>lang</code> scope.</td><td><a href="/pages/Uhrp7uJlYu5Ha02dvxfO">/pages/Uhrp7uJlYu5Ha02dvxfO</a></td></tr><tr><td>Edit collection</td><td>Modifies an existing collection.</td><td><a href="/pages/aNtrmpxuW8DZoCpBbisU">/pages/aNtrmpxuW8DZoCpBbisU</a></td></tr></tbody></table>

### Response format

Success responses share the same envelope and rule object schema.

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

### Errors and validation

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