# 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="/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](/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)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wproofreader.com/api-reference/style-guide-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
