Proofademic APIProofademic API

Grammar Checker

Correct grammar, spelling, and punctuation and receive the corrected text plus a complete word-level diff.

POST /api/grammar/correct/

Correct grammar, spelling, and punctuation. The correction is minimal-change: voice, meaning, language, and paragraph structure are preserved, and text that is already clean comes back unchanged. Returns the corrected text plus a complete word-level diff.

Authentication: X-API-Key header with grammar_checker scope

Request Parameters

ParameterTypeRequiredDescription
contentstringYesText to correct. Sent exactly as submitted — diff offsets in the response refer to this text
target_variantstringNoEnglish variant for corrections: auto (default, preserves the input's variant), en-US, en-GB, en-CA, en-AU, en-IN. Only applies to English text

Limits

LimitValue
Minimum length5 words
Maximum length10,000 words
Maximum characters75,000

Words are counted script-aware: whitespace-separated words for most languages, one word per character for CJK scripts.

Pricing

1 credit per word. The charge uses the API's own script-aware word count, returned as input_words in the response. If the correction fails, the credits are refunded automatically.

Idempotency

Corrections are billed per word, so retrying a request that already succeeded would charge again. To make retries safe, send an Idempotency-Key header (any string up to 255 characters, e.g. a UUID):

  • Repeating the same key with the same text within 5 minutes returns the original response — nothing is re-processed and nothing is charged.
  • Repeating the same key with different text is rejected with 409 idempotency_key_reuse.
curl -X POST https://developer-portal.proofademic.ai/api/grammar/correct/ \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Idempotency-Key: 9a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d" \
  -d '{ "content": "..." }'

Example

Request

curl -X POST https://developer-portal.proofademic.ai/api/grammar/correct/ \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "content": "This are a sample sentence with some grammar mistake inside of it."
  }'

Response (200 OK)

{
  "status": "success",
  "corrected_text": "This is a sample sentence with some grammar mistakes inside of it.",
  "diff": [
    { "type": "replace", "original": "are", "corrected": "is", "start": 5, "end": 8 },
    { "type": "replace", "original": "mistake", "corrected": "mistakes", "start": 45, "end": 52 }
  ],
  "issues": [
    { "category": "grammar", "severity": "suggestion", "message": "Grammar corrections applied." }
  ],
  "edits_count": 2,
  "changed": true,
  "input_words": 12,
  "input_chars": 66,
  "word_count": 12,
  "execution_time": 1.8,
  "credits_remaining": 1988,
  "user": {
    "id": 12345
  }
}

Response Fields

FieldTypeDescription
statusstringAlways "success" for a completed correction
corrected_textstringThe corrected text
diff[]arrayComplete word-level diff — one operation per change, never truncated
issues[]arrayHigh-level issue notes (category, severity, message)
edits_countintegerNumber of corrections applied — always equals the diff length
changedbooleanfalse means the text was already clean (diff is empty and corrected_text equals the input)
input_wordsintegerThe API's script-aware word count — the amount charged
input_charsintegerCharacter count of the submitted text
word_countintegerCredits charged for this request
execution_timefloatProcessing time in seconds
credits_remainingintegerCredit balance after this request
user.idintegerYour user ID

Diff Operations

Each entry in diff[] describes one change:

FieldTypeDescription
typestringreplace, insert, or delete
originalstringThe text being replaced or deleted (empty for insertions)
correctedstringThe replacement text (empty for deletions)
start / endintegerCharacter offsets into your text exactly as you submitted it

Because the diff is complete and the offsets refer to your original text, you can render a track-changes view directly: walk the original text, strike through each original, and insert each corrected in its place.

Errors

StatusCodeMeaning
400min_words_not_metUnder the 5-word minimum — details carries limit and actual
400max_words_exceededOver the 10,000-word limit — details carries limit and actual
400invalid_payloadMissing or malformed content, or over 75,000 characters
400invalid_idempotency_keyIdempotency-Key header longer than 255 characters
403insufficient_creditsNot enough credits — details carries credits and required
409idempotency_key_reuseThe Idempotency-Key was already used with different text
503service_unavailableCorrection temporarily unavailable — retry after the Retry-After header when present
503service_errorCorrection failed — credits were refunded

See Error Handling for the general error format.

On this page