# Grammar check API

[Check API](/api-reference/check-api.md) combines all available check types and is a replacement for older [Check spelling API](/api-reference/legacy-api-commands/check-spelling-api.md) and Grammar checking API.

**Command name:** grammar\_check

Here is a list of all possible parameters and values that can be used with the **grammar\_check** command.

| # | Parameter  | Possible values                                                                               | Default value | Description                                                                                                                                                                                                                                                               |
| - | ---------- | --------------------------------------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1 | format     | <ul><li>json</li><li>xml</li></ul>                                                            | json          | The response format for the output data.                                                                                                                                                                                                                                  |
| 2 | callback   | <ul><li>callback function name</li></ul>                                                      | <p><br></p>   | A callback function name that will be used to manipulate with the JSON data received from the server. Such approach enables sharing of data bypassing same-origin policy. It can be used only along with “format=json”.                                                   |
| 3 | text       | <ul><li>plain text</li></ul>                                                                  | <p><br></p>   | A piece of text which will be sent for check. The text has to be in the UTF-8 encoding. Any found tags in the text will be interpreted as a plan text as well.                                                                                                            |
| 4 | slang      | <ul><li><a href="/pages/GUZ6cksYHij4R1JW5Nhz">Supported languages</a> (e.g. en\_US)</li></ul> | en\_US        | <p>A short code of a language which will be used for grammar checking.</p><p>The grammar checking option is available for a specific list of languages marked in <a href="https://docs.webspellchecker.com/display/WSDK/Supported+languages">Supported languages</a>.</p> |
| 5 | customerid | \[your-service-id]                                                                            | <p><br></p>   | <p><br></p>                                                                                                                                                                                                                                                               |

#### Example 1: \[GET] Grammar check <a href="#grammarcheckapi-example1-get-grammarcheck" id="grammarcheckapi-example1-get-grammarcheck"></a>

Request URL (GET):

```javascript
http(s)://endpoint/?cmd=grammar_check&text=web API provides a gramar checking command that will help you builds a custom solution.&slang=en_US
```

**Parameters:**

* Command: *grammar\_check*
* Format: *json*
* Text: *web API provides a gramar checking command that will help you builds a custom solution.*
* Language: *en\_US*

**Request response:**

```javascript
[
    {
        "sentence": "web API provides a gramar checking command that will help you builds a custom solution",
        "matches": [
            {
                "message": "This sentence does not start with an uppercase letter",
                "offset": 0,
                "length": 3,
                "rule": {
                    "id": "UPPERCASE_SENTENCE_START"
                },
                "suggestions": [
                    "Web"
                ]
            }
        ]
    }
]
```

#### Example 2: \[POST] Grammar check request <a href="#grammarcheckapi-example2-post-grammarcheckrequest" id="grammarcheckapi-example2-post-grammarcheckrequest"></a>

Here we use the same request and parameters as described in example above but form it as a POST request.

Request URL (POST):

```javascript
https://endpoint/?
```

Body (Raw):

```javascript
cmd=grammar_check&
text=web API provides a gramar checking command that will help you builds a custom solution.&
slang=en_US
```

**Request response:**

```javascript
[
    {
        "sentence": "web API provides a gramar checking command that will help you builds a custom solution",
        "matches": [
            {
                "message": "This sentence does not start with an uppercase letter",
                "offset": 0,
                "length": 3,
                "rule": {
                    "id": "UPPERCASE_SENTENCE_START"
                },
                "suggestions": [
                    "Web"
                ]
            }
        ]
    }
]
```


---

# 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/legacy-api-commands/grammar-check-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.
