Sapling Logo
Grammar API quickstart

HTML Grammar Checker

Add spelling and grammar suggestions to a HTML application with Sapling's edits API.

  • HTTPS POST
  • SDK + HTTP
  • API key required
POST HTML logo HTML /api/v1/edits

HTML grammar checker quickstart

Send text to the edits endpoint. Sapling returns suggested replacements with character offsets so your application can review or apply each correction.

Sapling provides an SDK for this stack. The direct HTTP example below remains useful for server-side integrations; see the SDK overview for the higher-level client.
HTML /api/v1/edits
<script src="https://sapling.ai/static/js/sapling-sdk-v1.1.1.min.js"></script>
<div contenteditable="true" id="check-space"></div>

<script type="text/javascript">
Sapling.init({
  endpointHostname: "https://api.sapling.ai",
  editPathname: "/api/edits",
  completePathname: "/api/complete",
  autocomplete: true,
  statusBadge: true,
});

const contentEditable = document.getElementById('check-space');
Sapling.observe(contentEditable);
</script>
Example response application/json
{
  "edits": [
    {
      "start": 0,
      "end": 4,
      "replacement": "Let's",
      "sentence": "Lets get started!",
      "error_type": "R:OTHER"
    }
  ]
}

Each edit identifies the source range and replacement text. Preserve the original offsets when applying more than one edit.

About HTML

HTML, the HyperText Markup Language is used to design web pages to be rendered in browsers. Typically it is combined with CSS for styling and presentation and JavaScript for dynamic functionality.