Skip to content

API Response

After making a request to the API with the text 'This be just a teest.', the API returns the following JSON output:

Note

The correction_xml value below only appears if the JSON request set the optional apply parameter to a value of 'xml'.

{
  "correction_xml": "This <mod><orig>be</orig><repl>is</repl></mod> just a <mod><orig>teest</orig><repl>test</repl></mod>.",
  "correction": "This is just a test.",
  "status": 200,
  "edits": [
    {
      "start": 5,
      "end": 7,
      "replace": "is",
      "edit_type": "MODIFY",
      "err_cat": "GRMR",
      "err_type": "",
      "err_desc": ""
    },
    {
      "start": 15,
      "end": 20,
      "replace": "test",
      "edit_type": "MODIFY",
      "err_cat": "SPELL",
      "err_type": "",
      "err_desc": ""
    }
  ],
  "latency": 0.238
}

Response Parameters

Warning

New response parameters will be added as we add new features, so consider that when parsing the JSON response. Also, notice the 2 parameters marked as DEPRECATED below (i.e., err_type and err_desc). These are empty placeholders and will be removed soon.

status: Integer
The status should be checked prior to using the response. Anything other than a status of 200 indicates an error or warning.

correction: String
This is the input with any corrections (i.e., edits) already applied. If there are no errors detected, this will simply contain the text that was input.

correction_xml: String OPTIONAL
This response parameter only appears if the request included the apply parameter with a value of 'xml'.
For many applications, this output is a time saver. It can be directly styled with CSS or easily manipulated with 'replace' string functions or regular expressions.

edits: Array
Array of Edit objects for the input text. Each Edit object indicates a possible error (and correction).

Edit data structure:

{
  "start": Integer,                // Offset of edit start in the input text
  "end": Integer,                  // Offset of edit end in the input text
  "replace": String,               // Suggested replacement
  X"err_type": String,             // DEPRECATED: removing 4/2023
  X"err_desc": String,             // DEPRECATED: removing 4/2023
  "edit_type": String,             // Values: INSERT | MODIFY | DELETE
  "err_cat": String,               // Values: GRMR | SPELL | PUNC | MIX
}

More information on Error Categories (err_cat)

latency: Float
Internal time taken to check the spelling and grammar. 90% of requests finish within 1 second. Factors affecting this include input length and server load.