Skip to content

API Request

Requests to GrammarBot Neural are made by sending a JSON payload to the API endpoint. Our API is currently hosted on RapidAPI, so you will need to signup for an API key to run the example below.

import requests
import json

import requests

url = ""
key = "<API KEY HERE>"

payload = {
    "text": "This be some wel-written text.",
    "lang": "en"

headers = {
    "content-type": "application/json",
    "X-RapidAPI-Key": key,
    "X-RapidAPI-Host": ""

response = requests.request("POST", url, json=payload, headers=headers)
rjson = response.json()

if rjson["status"] == 200:
    correction = rjson['correction']
    print("ERROR: " + str(rjson))

Request Parameters

The following request parameters may be used in the JSON payload. Please note which are optional.

text: String
This is the input text that you would like to check for grammar, spelling, and punctuation errors. The maximum input length (for the beta rollout) is 1000 characters per request. This will increase in the weeks ahead. The input text should be primarily plain text of complete sentences. Tabular data, HTML, and text with lots of headings or formatting irregularities (e.g., newline in the middle of the sentence) may not produce satisfactory output.

lang: String - OPTIONAL (default = 'en')

  • en - English
  • contact us if you need another language added

apply: String - OPTIONAL (values = 'xml')
If the parameter apply has a value of 'xml' then the output will include a response variable named correction_xml that includes markup (XML/HTML) specifying the edits made to the input text. For some applications, this is a powerful shortcut as the output can be styled directly with CSS or easily post-processed using regular expressions.

Enabling Auto Correction

By default, there is a corrected version of the input text available in the response stored in the correction field. The optional apply request parameter described above can be given a value of 'xml' which will result in the creation of the correction_xml response field. This can drastically simplify some tasks.

Limits and Restrictions

During initial rollout of the API, the following limits hold:

  • Maximum of 5000 characters per request. Contact us if you need more (or just split your requests).
  • Rate limit of 1-3 requests per second based on plan. Contact us if you need more than this.
  • 15,000 requests per day limit
  • Input text should be plain text: no HTML, tables, etc.