The Copyleaks Grammar Checker API is a powerful tool to help improve the quality of written content by providing detailed feedback on grammar, spelling, sentence structure, and word choice. This guide will walk you through the process of submitting documents for writing assessment and retrieving the detailed feedback.

Get started

1

Before you begin

Before you start, ensure you have the following:
2

Installation

Choose your preferred method for making API calls.
HTTP needs no installation - call the API with any standard HTTP client, or import our Postman collection for a quicker start.
3

Login

To perform a scan, we first need to generate an access token. For that, we will use the login endpoint. The API key can be found on the Copyleaks API Dashboard.Upon successful authentication, you will receive a token that must be attached to subsequent API calls via the Authorization: Bearer <TOKEN> header. This token remains valid for 48 hours.
Response
Save this token. It is valid for 48 hours and can be reused for subsequent API calls.
4

Submit for writing assessment

File Upload

Submit documents including PDF, DOCX, TXT, and other formats for scanning.

URL Scanning

Submit webpages and online documents directly by providing their URL.

Text from Images

Extract and scan text from images, including screenshots and photos.
For this guide, we’ll demonstrate document submission for writing assessment. Each submission requires a unique scanId for proper tracking and identification.
  • Filename: The file extension in the filename parameter must match your document type (e.g., .pdf, .docx, .txt). See the full list of supported file types.
  • Content Encoding: The file content must be Base64 encoded and sent in the base64 property.
What is Base64 Encoding?Base64 converts binary files into text strings so they can be sent via JSON. All programming languages have built-in Base64 encoding functions, see the code examples below for your language.
For testing, set "sandbox": true. Sandbox mode is free and returns mock results.
To enable writing assessment, ensure "writingFeedback": {"enable": true} is set in your properties.
5

Wait for the completion webhook

Once the scan is complete, Copyleaks will send a completed webhook to the status URL you provided.When Grammar Checker is enabled, the webhook response will include a writingFeedback section with detailed information about the writing quality.
For complete details on the webhook response structure, see the Scan Completed Webhook Reference.
6

Interpreting writing assessment results

The completed webhook contains a writingFeedback object with the Correction Types:
  1. textStatistics: Basic metrics about the text, including sentence count, average word and sentence length, and estimated reading time.
  2. score: Detailed breakdown of writing quality across four categories:
    • Grammar
    • Mechanics (spelling, punctuation)
    • Sentence Structure
    • Word Choice
    Each category includes both a count of corrections and a score (0-100).
  3. readability: An assessment of how easy the text is to read, including:
    • Overall readability score (0-100)
    • Readability level (grade level)
    • Text description of the readability
7

Export detailed results

To get the specific writing corrections, you need to export the detailed results using the export endpoint:
8

Summary

You have successfully submitted a document for writing assessment and exported the detailed correction recommendations. You can now integrate these corrections into your application, display them to users, or use them to improve the document’s quality.

Next steps

API Reference

View the complete API reference for the Grammar Checker endpoints.

Grammar Checker Response

Learn about the detailed structure of Grammar Checker data, including corrections and scores.

Ways to Integrate the Report

Explore different ways to integrate writing feedback into your applications.

Learn About Webhooks

Understand how to use webhooks to receive notifications about scan completions and results.