> ## Documentation Index
> Fetch the complete documentation index at: https://docs.whetdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Clean

> Fix spelling and grammar errors in your text.

## Overview

Automatically fix spelling and grammar errors in your text. This action analyzes your content and returns a corrected version with all spelling and grammar mistakes fixed.

## Use This Action To

* Fix spelling mistakes in product descriptions
* Correct grammar errors in marketing copy
* Clean up user-generated content
* Improve text quality before publishing

## Parameters

<ParamField body="action" type="array" required>
  Must be an array that includes `"clean"`
</ParamField>

<ParamField body="text" type="string" required>
  Text to fix (max 5,000 characters)
</ParamField>

<ParamField body="ruleset" type="string">
  Ruleset name (optional)
</ParamField>

## Response

```json theme={null}
{
  "success": true,
  "action": ["clean"],
  "ruleset": "product_review",
  "cleaned_text": "This is a sentence with spelling and grammar errors that need to be fixed."
}
```

## Example

```bash cURL theme={null}
curl -X POST https://whetdata.com/api/clean \
  -H "x-api-key: whet_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "action": ["clean"],
    "text": "This is a sentance with speling and grammer erors that need to be fixed.",
    "ruleset": "product_review"
  }'
```

## Tips

<Tip>
  The clean endpoint is perfect for preprocessing user-generated content before displaying it on your site.
</Tip>

<Warning>
  The maximum text length is 5,000 characters. For longer texts, split them into chunks.
</Warning>


## OpenAPI

````yaml POST /api/clean
openapi: 3.0.0
info:
  title: Whetdata API
  version: 1.0.0
servers:
  - url: https://whetdata.com
security: []
paths:
  /api/clean:
    post:
      summary: Clean
      description: Fix spelling and grammar errors in your text.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - action
                - text
              properties:
                action:
                  type: array
                  items:
                    type: string
                    enum:
                      - clean
                text:
                  type: string
                  maxLength: 5000
                ruleset:
                  type: string
            example:
              action:
                - clean
              text: >-
                This is a sentance with speling and grammer erors that need to
                be fixed.
              ruleset: product_review
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
              example:
                success: true
                action:
                  - clean
                ruleset: product_review
                cleaned_text: >-
                  This is a sentence with spelling and grammar errors that need
                  to be fixed.

````