# Submit Text

> Generate grammar, spelling, and sentence corrections for a given text.

<RequestExample>

```bash title="cURL" icon="terminal"
curl --request POST \
  --url https://api.copyleaks.com/v1/writing-feedback/my-scan-123/check \
  --header 'Authorization: Bearer YOUR_LOGIN_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "text": "Copyleaks is a comprehensive plagiarism detection platform..."
  }'
```

```python title="Python" icon="python"
from copyleaks.copyleaks import Copyleaks
from copyleaks.models.submit.writing_assistant_document import WritingAssistantDocument

auth_token = Copyleaks.login("your@email.address", "YOUR_API_KEY")

submission = WritingAssistantDocument("Copyleaks is a comprehensive plagiarism detection platform...")

response = Copyleaks.WritingAssistantClient.submit_text(auth_token, "my-scan-123", submission)
print(response)
```

```javascript title="JavaScript" icon="square-js"
const { Copyleaks, CopyleaksWritingAssistantSubmissionModel } = require('plagiarism-checker');

const copyleaks = new Copyleaks();
const auth = await copyleaks.loginAsync('YOUR_EMAIL', 'YOUR_API_KEY');

const submission = new CopyleaksWritingAssistantSubmissionModel(
  'Copyleaks is a comprehensive plagiarism detection platform...'
);
submission.sandbox = true;

await copyleaks.writingAssistantClient.submitTextAsync(auth, 'my-scan-123', submission);
```

```java title="Java" icon="java"
import classes.Copyleaks;
import models.submissions.writingassistant.CopyleaksWritingAssistantSubmissionModel;

String authToken = Copyleaks.login("your@email", "API_KEY");

CopyleaksWritingAssistantSubmissionModel sub = new CopyleaksWritingAssistantSubmissionModel(
  "Copyleaks is a comprehensive plagiarism detection platform..."
);
sub.setSandbox(true);

Copyleaks.writingAssistantClient.submitText(authToken, "my-scan-123", sub);
```

</RequestExample>

<ResponseExample>

```json 200 OK
{
  "score": {
    "corrections": {
      "grammarCorrectionsCount": 2,
      "grammarCorrectionsScore": 87,
      "mechanicsCorrectionsCount": 9,
      "mechanicsCorrectionsScore": 38,
      "overallScore": 79
    },
    "readability": {
      "score": 59,
      "readabilityLevel": 5,
      "readabilityLevelText": "10th to 12th Grader",
      "readabilityLevelDescription": "Fairly difficult to read"
    }
  },
  "scannedDocument": {
    "scanId": "{scanId}",
    "totalWords": 61,
    "actualCredits": 1,
    "expectedCredits": 1,
    "creationTime": "2025-08-06T08:00:08.0429909Z"
  }
}
```

</ResponseExample>

Use Copyleaks Grammar Checker to generate grammar, spelling and sentence corrections for a given text.

This endpoint will receive submitted text to be checked. The response will show the suggested corrections to the input text.

<Warning>
**Authentication Required.** You need to login with a user and API key in order to access this method. Add this HTTP header to your request:

**Authorization: Bearer &lt;Your-Login-Token&gt;**
</Warning>

## Request

### Path Parameters

<ParamField path="scanId" type="string" required>
  A unique scan id provided by you. Learn more about [the criteria for creating a Scan ID](/concepts/management/choosing-scan-id).

  `>= 3 characters` `<= 36 characters`
</ParamField>

### Headers

```http
Content-Type: application/json
Authorization: Bearer YOUR_LOGIN_TOKEN
```

### Request Body

<ParamField body="text" type="string" required>
  Text to produce Grammar Checker report for.

      `>= 1 characters` `<= 25000 characters`
</ParamField>
<ParamField body="sandbox" type="boolean" default="false">
  Use sandbox mode to test your integration with the Copyleaks API without consuming any credits.
</ParamField>
<ParamField body="score" type="object">
  <Expandable title="score properties">
    <ParamField body="grammarScoreWeight" type="number<float>" default="1.0">
      Grammar correction category weight in the overall score. `>= 0.0 <= 1.0`
    </ParamField>
    <ParamField body="mechanicsScoreWeight" type="number<float>" default="1.0">
      Mechanics correction category weight in the overall score. `>= 0.0 <= 1.0`
    </ParamField>
    <ParamField body="sentenceStructureScoreWeight" type="number<float>" default="1.0">
      Sentence structure correction category weight in the overall score. `>= 0.0 <= 1.0`
    </ParamField>
    <ParamField body="wordChoiceScoreWeight" type="number<float>" default="1.0">
      Word choice correction category weight in the overall score. `>= 0.0 <= 1.0`
    </ParamField>
  </Expandable>
</ParamField>
<ParamField body="language" type="string">
  The language code of your content. If not supplied, our system will automatically detect the language of the content.

  Example: `"en"`
</ParamField>

## Responses

<Tabs>
  <Tab title="200">
    <Check>**200 OK** - The command was executed.</Check>

    ```json
    {
      "score": {
        "corrections": {
          "grammarCorrectionsCount": 2,
          "grammarCorrectionsScore": 87,
          "overallScore": 79
        }
      },
      "scannedDocument": {
        "scanId": "{scanId}",
        "totalWords": 61,
        "creationTime": "2025-08-06T08:00:08.0429909Z"
      }
    }
    ```
  </Tab>
  <Tab title="400">
    <Warning>**400 Bad Request** - Bad request.</Warning>
  </Tab>
  <Tab title="401">
    <Warning>**401 Unauthorized** - Authorization has been denied for this request.</Warning>
  </Tab>
  <Tab title="402">
    <Warning>**402 Payment Required** - User does not have enough credits.</Warning>
  </Tab>
  <Tab title="429">
    <Warning>**429 Too Many Requests** - Too many requests have been sent. The request has been rejected.</Warning>
  </Tab>
</Tabs>
