> 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.18.1/api-reference/check-api.md).

# Check API

The **check** command combines all available check types (spelling, grammar and style) of text in a single command.

**Command name:** check

### API endpoint

See [Overview](/v6.18.1/api-reference/overview.md#api-endpoint).

### Parameters

These parameters work with any `cmd`.

| Name           | Type    | Required   | Description                                                                                                                                                                               |
| -------------- | ------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `serviceid`    | string  | Cloud only | Cloud API key. Required for Cloud requests. Not used on-premises.                                                                                                                         |
| `format`       | string  | No         | Response format. Values: `json` (default), `xml`.                                                                                                                                         |
| `callback`     | string  | No         | JSONP wrapper function name. Use only with `format=json`.                                                                                                                                 |
| `short_answer` | boolean | No         | <p>JSON only. When <code>true</code>, shortens JSON keys to reduce payload size.<br>See <a href="/v6.18.1/api-reference/overview.md#boolean-parameter-values">boolean parameters</a>.</p> |

See [Overview](/v6.18.1/api-reference/overview.md#common-parameters) for details.

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

<table><thead><tr><th width="187">Parameter</th><th>Possible values</th><th width="187">Default value</th><th>Description</th></tr></thead><tbody><tr><td>cmd</td><td><ul><li>check</li></ul></td><td></td><td>Command name for checking text for all types of writing errors.</td></tr><tr><td>lang</td><td><ul><li><a href="/v6.18.1/features/supported-languages.md">Supported languages</a> (e.g. en_US)</li></ul></td><td>auto</td><td>A short code of a language which will be used for check.</td></tr><tr><td>tokens</td><td><ul><li>Array of strings, e.g. ["This is a sentence number 1.", "This is a sentence number 2."]</li></ul></td><td><br></td><td><p>A piece of text separated in tokens that will be sent for check. The text should be presented as an array of strings. Right now each string is a token which equals one sentence.</p><p>You can use either <strong>tokens</strong> or <strong>text</strong> at a time in a request.</p></td></tr><tr><td>text</td><td><ul><li>plain text</li></ul></td><td><br></td><td><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 plain text as well.</p><p>Avoid using # and &#x26; symbols in the text.</p></td></tr><tr><td>user_dictionary</td><td><ul><li>user dictionary name (e.g. testdict)</li></ul></td><td><br></td><td>A user dictionary name which will be used during spell checking.</td></tr><tr><td>user_wordlist</td><td><ul><li>additional wordlist</li></ul></td><td><br></td><td>The list of additional comma-separated words which will be used for spell checking.</td></tr><tr><td>custom_dictionary</td><td><ul><li>custom dictionary IDs (e.g. 100694)</li></ul></td><td><p><br>For Cloud: list of all dictionaries</p><p><br>For self-hosted: empty list</p></td><td><p>Global custom dictionary ID(s) which can be used during spell checking.</p><p>Each new Dictionary on the creation obtains its unique Dictionary ID. Depending on the type of the version of product you are using, refer to <a href="/v6.18.1/features/custom-dictionary/organization-dictionary-cloud-admin-panel.md"><strong>Cloud</strong></a> or <a href="/v6.18.1/features/custom-dictionary/organization-dictionary-self-hosted-management.md"><strong>Server</strong></a> guides respectively.</p></td></tr><tr><td>ignore_all_caps</td><td><ul><li>0 – Do not ignore all words written in capital letters (e.g. UPPERCASE).</li><li>1 – Ignore all words written in capital letters.</li></ul></td><td>0</td><td>Ignore capitalized words.</td></tr><tr><td>ignore_words_with_numbers</td><td><ul><li>0 – Do not ignore words that contain numbers (e.g. Number1).</li><li>1 – Ignore words that contain numbers.</li></ul></td><td>0</td><td>Ignore words containing numbers.</td></tr><tr><td>ignore_mixed_case</td><td><ul><li>0 – Do not ignore words with mixed case letters (e.g. MixedCase).</li><li>1 – Ignore words with mixed case letters.</li></ul></td><td>0</td><td>Ignore words written with mixed case letters.</td></tr><tr><td>ignore_domain_names</td><td><ul><li>0 – Do not ignore web addresses that start with either “www”, “http:” or “https:” and end with a domain name.</li><li>1 – Ignore web addresses and domain names.</li></ul></td><td>0</td><td>Ignore domain names, web addresses.</td></tr><tr><td>min_word_length</td><td><ul><li>minimal number of letters in a word to be checked</li></ul></td><td>3</td><td>The minimal number of letters in the word which will be checked for spelling. E.g. if 3 is specified, the words with 2 letters and less will be ignored.</td></tr><tr><td>disable_spelling</td><td><ul><li>true</li><li>false</li></ul></td><td>false</td><td>Disable the check text for spelling errors.<br>See <a href="/v6.18.1/api-reference/overview.md#boolean-parameter-values">boolean parameters</a>.</td></tr><tr><td>disable_grammar</td><td><ul><li>true</li><li>false</li></ul></td><td>false<br></td><td>Disable the check text for grammar and style problems.<br>See <a href="/v6.18.1/api-reference/overview.md#boolean-parameter-values">boolean parameters</a>.</td></tr><tr><td>disable_style_guide</td><td><ul><li>true</li><li>false</li></ul></td><td>false</td><td>Disabling style guide functionality.<br>See <a href="/v6.18.1/api-reference/overview.md#boolean-parameter-values">boolean parameters</a>.</td></tr><tr><td>auto_lang_priorities</td><td>{"en":"en_US", "es":"es_ES"}</td><td><br><br></td><td>Priority of language dialect for auto-detected language code. For example, auto-detect returns "en", then American English will be used as a language for check.</td></tr><tr><td>disabled_rules</td><td><ul><li>JSON array</li></ul></td><td>[]<br></td><td>Disabling specific grammar rules IDs.</td></tr><tr><td>disabled_categories</td><td><ul><li>JSON array</li></ul></td><td>[]</td><td>Disabling specific grammar rules categories.</td></tr><tr><td>check_kit</td><td><ul><li>ai</li><li>ai_lt</li><li>lt_hs</li><li>ai_lt_hs0</li><li>ai_lt_hs1</li></ul></td><td>Depends on service default configuration</td><td><p>Enable special engine combinations:</p><ul><li><code>ai</code> AI engine</li><li><code>lt</code> LanguageTool</li><li><code>hs</code> Hunspell</li><li><code>0</code> and <code>1</code> — applicable to Hunspell only; <code>0</code> means without suggestions, <code>1</code> means with suggestions</li></ul><p><strong>Example:</strong> <code>ai_lt_hs1</code> means use AI, LanguageTool, and Hunspell with suggestions for the request.</p></td></tr><tr><td>enforce_ai</td><td><ul><li>true</li><li>false</li></ul></td><td>false</td><td>To replace the classic algorithmic engines with an AI-powered engine. It only works along with languages which supported AI.</td></tr><tr><td>enable_style_guide_collections</td><td><ul><li>JSON array</li></ul></td><td><code>[]</code></td><td>Enable specific client collections for check action.<br><br>Accepts both collection and category value.<br><br>All the clients collections are enabled if parameter is not provided.<br><br>Example: <code>enable_style_guide_collections=["MY_COLLECTION_IN_THE_CATEGORY_FORMAT","My Collection in the Collection format"]</code></td></tr><tr><td>correct_text</td><td><ul><li>true</li><li>false</li></ul></td><td>false</td><td>Add the <code>correctedText</code> field to every sentence in the response. The field contains the sentence with the first suggestion of every match applied.<br>See <a href="/v6.18.1/api-reference/overview.md#boolean-parameter-values">boolean parameters</a>.</td></tr></tbody></table>

#### Response structure <a href="#checksommand-responsestructure" id="checksommand-responsestructure"></a>

The response is an object with these top-level fields:

| Field     | Type             | Description                                                                                                         |
| --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------- |
| `result`  | array of objects | One object for each checked sentence. The objects keep the order of the sentences in the request.                   |
| `warning` | string           | A message about a problem that did not stop the check. It is present only when the service has something to report. |

Each object in `result` describes one sentence:

| Field           | Type             | Description                                                                                                                                                                 |
| --------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `matches`       | array of objects | The problems found in the sentence.                                                                                                                                         |
| `lang`          | string           | The language resolved for the sentence, for example `en_US`. It is present only when the request uses `lang=auto`. It is absent when the service cannot resolve a language. |
| `correctedText` | string           | The sentence with the first suggestion of every match applied. It is present only when the request uses `correct_text=true`.                                                |

Each object in `matches` has these attribute-value pairs:

| Attribute     | Type             | Value                          | Description                                                    |
| ------------- | ---------------- | ------------------------------ | -------------------------------------------------------------- |
| `type`        | string           | `spelling`, `grammar`, `style` | Type of the match found.                                       |
| `offset`      | unsigned number  |                                | Start position of the match in the sentence.                   |
| `length`      | unsigned number  |                                | Length of the match.                                           |
| `message`     | string           |                                | Description of the problem.                                    |
| `rule`        | string           |                                | Identifier of the rule that produced the match.                |
| `description` | string           |                                | Description of the rule. It can be empty.                      |
| `category`    | string           |                                | Category of the rule, for example `CASING`. It can be empty.   |
| `ud`          | boolean          | `true`, `false`                | `true` if the misspelled word is present in a user dictionary. |
| `url`         | boolean          | `true`, `false`                | `true` if the match is a part of a URL or a URI.               |
| `probability` | float number     | between 0.0 and 1.0            | Probability of the match.                                      |
| `suggestions` | array of strings |                                | Suggested corrections for the match.                           |

{% hint style="info" %}
A match does not always contain every attribute. The set of attributes depends on the match type and on the engine that produced the match.
{% endhint %}

Type: Spelling

```json
{
    "result": [
        {
            "matches": [
                {
                    "type": "spelling",
                    "offset": X,
                    "length": Y,
					          "ud": true,
					          "probability": 1.0,
                    "suggestions": ["..."]
                }
            ]
        }
    ]
}
```

Type: Grammar

```json
{
    "result": [
        {
            "matches": [
                {
                    "type": "grammar",
                    "offset": X,
                    "length": Y,
                    "rule": "...",
                    "message": "...",
                    "probability": 0.Z
                    "suggestions": ["..."]
                }
            ]
        }
    ]
}
```

#### Example 1.1 \[GET]: Check request for American English text with all available check types (output in JSON) <a href="#checksommand-example1.1-get-checkrequestforamericanenglishtextwithallavailablechecktypes-outputinjso" id="checksommand-example1.1-get-checkrequestforamericanenglishtextwithallavailablechecktypes-outputinjso"></a>

Request URL (GET):

```
https://svc.webspellchecker.net/api?cmd=check&text=this sampl text demonstrates the work of the Web API service.&lang=en_US&format=json&serviceid=[your-service-id]
```

```
http(s)://server_entry_point/?cmd=check&text=this sampl text demonstrates the work of the Web API service.&lang=en_US&format=json
```

**Parameters:**

* Command: *check*
* Text: *this* sample *text demonstrates the work of the Web API service.*
* Language: *en\_US*
* Format: *json*

**Request response:**

```json
{
  "result": [
    {
      "matches": [
        {
          "type": "grammar",
          "offset": 0,
          "length": 4,
          "message": "",
          "rule": "14766687526281413077",
          "description": "",
          "category": "",
          "probability": 0.9970703125,
          "suggestions": [
            "This"
          ]
        },
        {
          "type": "spelling",
          "offset": 5,
          "length": 5,
          "message": "Spelling mistake",
          "rule": "14551130629728879226",
          "probability": 0.9970703125,
          "suggestions": [
            "sample"
          ]
        }
      ]
    }
  ]
}
```

#### Example 1.2 \[GET]: Check request for American English text with all available check types (output in XML) <a href="#checksommand-example1.2-get-checkrequestforamericanenglishtextwithallavailablechecktypes-outputinxml" id="checksommand-example1.2-get-checkrequestforamericanenglishtextwithallavailablechecktypes-outputinxml"></a>

Request URL (GET):

```
https://svc.webspellchecker.net/api?cmd=check&text=this sampl text demonstrates the work of the Web API service.&lang=en_US&format=xml&serviceid=[your-service-id]
```

```
http(s)://server_entry_point/?cmd=check&text=this sampl text demonstrates the work of the Web API service.&lang=en_US&format=xml
```

**Parameters:**

* Command: *check*
* Text: *this sampl text demonstrates the work of the Web API service.*
* Language: *en\_US*
* Format: *xml*

**Request response:**

```xml
<result>
	<result>
		<matches>
			<matches>
				<type>grammar</type>
				<offset>0</offset>
				<length>4</length>
				<message/>
				<rule>14766687526281413077</rule>
				<description/>
				<category/>
				<probability>0.99707</probability>
				<suggestions>
					<suggestions>This</suggestions>
				</suggestions>
			</matches>
			<type>spelling</type>
			<offset>5</offset>
			<length>5</length>
			<message>Spelling mistake</message>
			<rule>14551130629728879226</rule>
			<probability>0.99707</probability>
			<suggestions>
				<suggestions>sample</suggestions>
			</suggestions>
		</matches>
	</result>
</result>
```

#### Example 1.3 \[GET]: Check request for American English text as two tokens with all available check types (output in JSON) <a href="#checksommand-example1.3-get-checkrequestforamericanenglishtextastwotokenswithallavailablechecktypes" id="checksommand-example1.3-get-checkrequestforamericanenglishtextastwotokenswithallavailablechecktypes"></a>

Request URL (GET):

```
https://svc.webspellchecker.net/api?cmd=check&tokens=["this sampl text.", " It demonstrate the work of the Web API service."]&lang=en_US&serviceid=[your-service-id]
```

```
http(s)://server_entry_point/?cmd=check&tokens=["this sampl text.", " It demonstrate the work of the Web API service."]&lang=en_US
```

**Parameters:**

* Command: *check*
* Tokens: *\["this sampl text.", " It demonstrate the work of the Web API service."]*
* Language: *en\_US*
* Format: *json*

**Request response:**

```json
{
  "result": [
    {
      "matches": [
        {
          "type": "grammar",
          "offset": 0,
          "length": 4,
          "message": "This sentence does not start with an uppercase letter.",
          "rule": "UPPERCASE_SENTENCE_START",
          "description": "Checks that a sentence starts with an uppercase letter",
          "category": "CASING",
          "probability": 1.0,
          "suggestions": [
            "This"
          ]
        },
        {
          "type": "spelling",
          "offset": 5,
          "length": 5,
          "message": "Spelling mistake",
          "rule": "14551130629728879226",
          "probability": 0.943359375,
          "suggestions": [
            "sample"
          ]
        }
      ]
    },
    {
      "matches": [
        {
          "type": "grammar",
          "offset": 4,
          "length": 11,
          "message": "",
          "rule": "11156818907134265203",
          "description": "",
          "category": "",
          "probability": 0.90234375,
          "suggestions": [
            "demonstrated"
          ]
        }
      ]
    }
  ]
}
```

#### Example 1.4 \[GET]: Check request for American English text as two tokens with all available check types and shortened response (output in JSON) <a href="#checksommand-example1.4-get-checkrequestforamericanenglishtextastwotokenswithallavailablechecktypesa" id="checksommand-example1.4-get-checkrequestforamericanenglishtextastwotokenswithallavailablechecktypesa"></a>

Request URL (GET):

```
https://svc.webspellchecker.net/api?cmd=check&tokens=["this sampl text.", " It demonstrate the work of the Web API service."]&lang=en_US&short_answer=true&serviceid=[your-service-id]
```

```
http(s)://server_entry_point/?cmd=check&tokens=["this sampl text.", " It demonstrate the work of the Web API service."]&lang=en_US&short_answer=true
```

**Parameters:**

* Command: *check*
* Tokens: *\["this sampl text.", " It demonstrate the work of the Web API service."]*
* Language: *en\_US*
* Format: *json*
* Short Answer: *true*

**Request response:**

```json
{
  "r": [
    {
      "m": [
        {
          "t": "grammar",
          "o": 0,
          "l": 4,
          "m": "This sentence does not start with an uppercase letter.",
          "r": "UPPERCASE_SENTENCE_START",
          "d": "Checks that a sentence starts with an uppercase letter",
          "c": "CASING",
          "p": 1.0,
          "s": [
            "This"
          ]
        },
        {
          "t": "spelling",
          "o": 5,
          "l": 5,
          "m": "Spelling mistake",
          "r": "14551130629728879226",
          "p": 0.9576822519302368,
          "s": [
            "sample"
          ]
        }
      ]
    },
    {
      "m": [
        {
          "t": "grammar",
          "o": 4,
          "l": 11,
          "m": "",
          "r": "11156818907134265203",
          "d": "",
          "c": "",
          "p": 0.9033203125,
          "s": [
            "demonstrated"
          ]
        }
      ]
    }
  ]
}
```

#### Example 1.5 \[POST]: Check request for American English text with all available check types (output in JSON) <a href="#checksommand-example1.4-post-checkrequestforamericanenglishtextwithallavailablechecktypes-outputinjs" id="checksommand-example1.4-post-checkrequestforamericanenglishtextwithallavailablechecktypes-outputinjs"></a>

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

Request URL (POST):

```
https://svc.webspellchecker.net/api?
```

```
http(s)://server_entry_point/?
```

Body (Raw):

```
cmd=check&text=this sampl text demonstrates the work of the Web API service.&lang=en_US&format=json&serviceid=[your-service-id]
```

**Request response:**

```json
{
  "result": [
    {
      "matches": [
        {
          "type": "grammar",
          "offset": 0,
          "length": 4,
          "message": "",
          "rule": "14766687526281413077",
          "description": "",
          "category": "",
          "probability": 0.9970703125,
          "suggestions": [
            "This"
          ]
        },
        {
          "type": "spelling",
          "offset": 5,
          "length": 5,
          "message": "Spelling mistake",
          "rule": "14551130629728879226",
          "probability": 0.9970703125,
          "suggestions": [
            "sample"
          ]
        }
      ]
    }
  ]
}
```

#### Example 1.6 \[POST]: Check request for text with the auto-detected language (output in JSON) <a href="#checksommand-example1.5-post-checkrequestfortextwiththeauto-detectedlanguage-outputinjson" id="checksommand-example1.5-post-checkrequestfortextwiththeauto-detectedlanguage-outputinjson"></a>

In this POST type request, we use “auto” as a value for language and define the priorities for the language dialects. If “**en**” is detected, then British English will be used during check request.

Request body (POST):

{% tabs %}
{% tab title="JSON" %}

```json
{
  "cmd": "check",
  "text": "this sampl text demonstrates the work of the Web API service.",
  "lang": "auto",
  "format": "json",
  "serviceid": "[your-service-id]",
  "auto_lang_priorities": {
    "en": "en_GB"
  }
}
```

{% endtab %}

{% tab title="Raw" %}

```json
cmd=check&text=this sampl text demonstrates the work of the Web API service.&lang=auto&format=json&serviceid=[your-service-id]&auto_lang_priorities={"en":"en_AI"}
{

}
```

{% endtab %}
{% endtabs %}

#### Example 1.7 \[GET]: Check request with the detected language and the corrected text

This request uses `lang=auto`, so the response reports the resolved language in `lang`. It also uses `correct_text=true`, so the response contains `correctedText` for the sentence.

Request URL (GET):

```
https://svc.webspellchecker.net/api?cmd=check&text=This is speling mistake.&lang=auto&correct_text=true&user_dictionary=my_dictionary&serviceid=[your-service-id]
```

```
http(s)://server_entry_point/?cmd=check&text=This is speling mistake.&lang=auto&correct_text=true&user_dictionary=my_dictionary
```

**Parameters:**

* Command: *check*
* Text: *This is speling mistake.*
* Language: *auto*
* Correct text: *true*
* User dictionary: *my\_dictionary*

**Request response:**

```json
{
    "result": [
        {
            "correctedText": "This is spelling mistake.",
            "matches": [
                {
                    "type": "spelling",
                    "offset": 8,
                    "length": 7,
                    "message": "Spelling mistake",
                    "category": "OTHER",
                    "rule": "15157496823591896899",
                    "probability": 0.9752603769302368,
                    "suggestions": [
                        "spelling"
                    ]
                }
            ],
            "lang": "en_US"
        }
    ],
    "warning": "Failed to get dictionary content. Doesn't exist or invalid name."
}
```

In this example the service cannot read `my_dictionary`. It reports the problem in `warning`, completes the check, and returns the result.
