← Back to Playground

API Documentation

Integrate the OpenGrammar API directly into your applications. It's fast, free, and fully self-hosted.

General Information

Authentication

No authentication is required. The API is open and secured via CORS and rate limiting.

Rate Limits

  • Grammar Check: 20 requests per second per IP.
  • AI Enhancement: 5 requests per 10 seconds per IP.

POST/api/check

Performs a lightning-fast rule-based analysis of text for grammar, spelling, and style errors.

cURL Example
curl -X POST https://your-domain.com/api/check \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Their is a apple and he dont like it.",
    "options": {
      "spelling": true,
      "grammar": true,
      "style": true,
      "readability": true
    }
  }'
Response Schema (JSON)
{
  "messages": [
    {
      "source": "retext-spell",
      "ruleId": "dont",
      "message": "Did you mean `don't`?",
      "offset": 24,
      "length": 4,
      "actual": "dont",
      "expected": ["don't"]
    }
  ],
  "stats": {
    "totalIssues": 1,
    "fleschKincaidGrade": 2.1
  }
}

POST/api/enhance

Uses a high-quality server-side Large Language Model (Groq Llama-3) to completely rewrite and enhance the provided text for clarity, professionalism, and grammar.

cURL Example
curl -X POST https://your-domain.com/api/enhance \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Their is a apple and he dont like it. This is a very very bad sentence."
  }'
Response Schema (JSON)
{
  "result": "There is an apple, but he does not like it. This is a very poorly constructed sentence."
}

GET/api/health

Simple healthcheck endpoint to verify the API is running.

cURL Example
curl https://your-domain.com/api/health