# Get rules (getrules)

List style guide rules.

### Request

See [HTTP API Overview](/v6.10.0.0/api-reference/overview.md).

#### Parameters

| Parameter | Type   | Required | Default       | Notes                                                                                                                                           |
| --------- | ------ | -------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `cmd`     | string | Yes      | `style_guide` | Command name.                                                                                                                                   |
| `action`  | string | Yes      | `getrules`    | Action name.                                                                                                                                    |
| `lang`    | string | No       |               | <p>Language scope to list rules for (example: <code>en\_US</code> or <code>en</code>).<br>By default returns all rules from every language.</p> |
| `rule`    | string | No       |               | One rule ID, or a comma-separated list of rule IDs. Filter is applied within the selected `lang`.                                               |

### Behavior

* Without `lang`: lists rules in `common`.
* Without `rule`: returns all rules for the selected `lang`, grouped by style guide.
* With `rule`: returns only the matching rule(s) for the selected `lang`.

### Response

Multiple rule objects are returned.

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

### Errors

See [Errors](/v6.10.0.0/api-reference/style-guide-api/errors.md#getrules-errors).

### Examples

<details>

<summary>Example: get all rules</summary>

```json
{
  "cmd": "style_guide",
  "action": "getrules"
}
```

</details>

<details>

<summary>Example: get specific rules</summary>

```json
{
  "cmd": "style_guide",
  "action": "getrules",
  "lang": "en_US",
  "rule": "STYLE_111,STYLE_222"
}
```

</details>


---

# 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/v6.10.0.0/api-reference/style-guide-api/actions/get-rules-getrules.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.
