API Documentation

Integrate voice-preserving grammar correction into your application.

POST/v1/check

Check Grammar

Submit text for grammar correction. Returns corrected text with voice drift score, diff, and issues found.

Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
X-API-Keyhg_your_api_keyYes

Request Body

{
  "text": "Their going to the store becuz they needs more supplys.",
  "aggressiveness": 1,
  "tenant_id": "your-tenant-id"
}

Example Request

curl -X POST https://human-grammar-api.fly.dev/v1/check \
  -H "Content-Type: application/json" \
  -H "X-API-Key: hg_your_api_key" \
  -d '{
    "text": "Their going to the store becuz they needs more supplys.",
    "aggressiveness": 1
  }'

Response

{
  "original_text": "Their going to the store becuz they needs more supplys.",
  "corrected_text": "They're going to the store because they need more supplies.",
  "voice_drift_score": 0.08,
  "issues": [
    {
      "category": "grammar",
      "severity": "error",
      "message": "Use 'They're' instead of 'Their'",
      "offset": 0,
      "length": 5
    },
    {
      "category": "spelling",
      "severity": "error",
      "message": "Correct spelling: 'because'",
      "offset": 27,
      "length": 5
    }
  ],
  "diff": [
    {
      "type": "replace",
      "original": "Their",
      "corrected": "They're",
      "start": 0,
      "end": 5
    }
  ],
  "processing_ms": 342,
  "request_id": "req_abc123",
  "provider_trace": {
    "stages_executed": [
      "rule_based",
      "model_gec",
      "voice_lock",
      "drift_scoring",
      "selection"
    ]
  }
}

Status Codes

CodeDescription
200Success — returns corrected text and metadata
400Invalid request body
401Missing or invalid API key
413Text exceeds maximum length (10,000 characters)
429Rate limit exceeded
500Internal server error

Try It Live

Authentication

All API requests (except health and readiness checks) require an API key sent via the X-API-Key header.

You can generate API keys from your dashboard. Keys start with hg_.

Rate Limits

Rate limits depend on your plan tier. The API returns rate limit information in response headers:

  • X-RateLimit-Limit — Maximum requests per window
  • X-RateLimit-Remaining — Remaining requests
  • X-RateLimit-Reset — Window reset time (Unix timestamp)