Submit Text
Use Copyleaks Writing Assistant 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.
Request
Section titled “Request”Path Parameters
Section titled “Path Parameters”A unique scan id provided by you. We recommend you use the same id in your database to represent the scan in the Copyleaks database. This will help you to debug incidents. Using the same ID for the same file will help you to avoid network problems that may lead to multiple scans for the same file. learn more about the criteria for creating a Scan ID.
>= 3 characters
<= 36 characters
Match pattern: [a-z0-9] !@$^&-+%=_(){}<>';:/.",~
|
Headers
Section titled “Headers”Content-Type: application/jsonAuthorization: Bearer YOUR_LOGIN_TOKEN
Request Body
Section titled “Request Body”The request body is a JSON object containing the text to scan.
Text to produce Writing Assistant report for.
>= 1 characters
<= 25000 characters
Use sandbox mode to test your integration with the Copyleaks API without consuming any credits.
Submit content for Writing Assistant and get returned mock results, simulating Copyleaks’s API functionality to ensure you have successfully integrated the API.
This feature is intended to be used for development purposes only.
score object
Grammar correction category weight in the overall score.
>= 0.0 <=1.0
Mechanics correction category weight in the overall score.
>= 0.0 <=1.0
Sentence structure correction category weight in the overall score.
>= 0.0 <=1.0
Word choice correction category weight in the overall score.
>= 0.0 <=1.0
The language code of your content. The selected language should be on the Supported Languages list above. If the ‘language’ field is not supplied , our system will automatically detect the language of the content.
Example: "en"
Responses
Section titled “Responses”The command was executed.
Response Schema
The response contains the following fields:
score object
corrections object
readability object
statistics object
corrections object
text object
scannedDocument object
Example Response
A typical response from this endpoint:
{ "score": { "corrections": { "grammarCorrectionsCount": 2, "grammarCorrectionsScore": 87, "grammarScoreWeight": 1, "mechanicsCorrectionsCount": 9, "mechanicsCorrectionsScore": 38, "mechanicsScoreWeight": 1, "sentenceStructureCorrectionsCount": 0, "sentenceStructureCorrectionsScore": 100, "sentenceStructureScoreWeight": 1, "wordChoiceCorrectionsCount": 1, "wordChoiceCorrectionsScore": 93, "wordChoiceScoreWeight": 1,// ... truncated
Examples
Section titled “Examples”POST https://api.copyleaks.com/v1/writing-feedback/my-scan-123/checkContent-Type: application/jsonAuthorization: Bearer YOUR_LOGIN_TOKEN
{ "text": "Copyleaks is a comprehensive plagiarism detection platform that performs extensive searches across 60 trillion websites, 15,000+ academic journals, 20+ code data repositories, and 1M+ internal documents. Using AI-powered text analysis, easily scan documents, raw text, code, and URLs and instantly receive detailed reporting on the findings."}
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 that performs extensive searches across 60 trillion websites, 15,000+ academic journals, 20+ code data repositories, and 1M+ internal documents. Using AI-powered text analysis, easily scan documents, raw text, code, and URLs and instantly receive detailed reporting on the findings." }'
import requests
# Sample text to analyze for writing feedbacksample_text = """Copyleaks is a comprehensive plagiarism detection platform that performs extensive searches across 60 trillion websites, 15,000+ academic journals, 20+ code data repositories, and 1M+ internal documents. Using AI-powered text analysis, easily scan documents, raw text, code, and URLs and instantly receive detailed reporting on the findings."""
url = "https://api.copyleaks.com/v1/writing-feedback/my-scan-123/check"payload = { "text": sample_text}headers = { "Authorization": "Bearer YOUR_LOGIN_TOKEN", "Content-Type": "application/json", "Accept": "application/json"}
response = requests.post(url, json=payload, headers=headers)result = response.json()
print("Writing Feedback Results:")if 'score' in result: print(f"Overall Score: {result['score'].get('overallScore', 'N/A')}") print(f"Grammar Score: {result['score'].get('grammarCorrectionsScore', 'N/A')}") print(f"Mechanics Score: {result['score'].get('mechanicsCorrectionsScore', 'N/A')}")
print("Full response:", result)
const { Copyleaks, CopyleaksWritingAssistantSubmissionModel } = require('plagiarism-checker');
async function getWritingFeedback() { try { // Initialize Copyleaks const copyleaks = new Copyleaks();
// Login to get the authentication token object. // Replace with your email and API key.
const scanId = "my-scan-123";
// The text to be checked const textToCheck = "This is a sample text to check for grammar and writing quality.";
// Create a submission model const submission = new CopyleaksWritingAssistantSubmissionModel(textToCheck); submission.sandbox = true;
// Submit the text for analysis const response = await copyleaks.writingAssistantClient.submitTextAsync(loginResult, scanId, submission); console.log("Writing feedback results:", response);
} catch (error) { console.error("An error occurred:", error); }}
getWritingFeedback();
import classes.Copyleaks;import models.submissions.writingassistant.CopyleaksWritingAssistantSubmissionModel;import models.submissions.writingassistant.ScoreWeights;import models.response.writingassitant.WritingAssistantResponse;
public class WritingFeedbackExample { private static final String API_KEY = "00000000-0000-0000-0000-000000000000";
public static void main(String[] args) { try { // Login to Copyleaks String authToken = Copyleaks.login(EMAIL_ADDRESS, API_KEY); System.out.println("Logged successfully!\nToken: " + authToken);
// Sample text to analyze for writing feedback String sampleText = "Copyleaks is a comprehensive plagiarism detection platform that performs " + "extensive searches across 60 trillion websites, 15,000+ academic journals, 20+ code data " + "repositories, and 1M+ internal documents. Using AI-powered text analysis, easily scan " + "documents, raw text, code, and URLs and instantly receive detailed reporting on the findings.";
// Configure score weights for writing feedback ScoreWeights scoreWeights = new ScoreWeights(); scoreWeights.setGrammarScoreWeight(0.25); scoreWeights.setMechanicsScoreWeight(0.25); scoreWeights.setSentenceStructureScoreWeight(0.25); scoreWeights.setWordChoiceScoreWeight(0.25);
// Create writing assistant submission String scanId = "my-scan-123"; CopyleaksWritingAssistantSubmissionModel writingSubmission = new CopyleaksWritingAssistantSubmissionModel(sampleText); writingSubmission.setScore(scoreWeights); writingSubmission.setSandbox(true);
// Submit for writing feedback analysis WritingAssistantResponse result = Copyleaks.writingAssistantClient.submitText( authToken, scanId, writingSubmission );
System.out.println("Writing feedback submitted successfully!"); System.out.println("Overall Score: " + result.getScore().getOverallScore()); System.out.println("Grammar Score: " + result.getScore().getCorrections().getGrammarCorrectionsScore()); System.out.println("Mechanics Score: " + result.getScore().getCorrections().getMechanicsCorrectionsScore()); System.out.println("Full result: " + result);
} catch (Exception e) { System.out.println("Failed: " + e.getMessage()); e.printStackTrace(); } }}