The Copyleaks Authenticity API is a powerful way to analyze your content for AI-generated text. It allows you to scan documents like PDF, DOCX, TXT, and other formats to detect whether content was written by humans or generated by AI. This guide will walk you through the process of submitting a document, enabling AI content detection, and exporting the results.

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 scanning

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. 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 ai text detection 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 AI detection, ensure "aiGeneratedText": {"detect": true} is set in your properties.
5

Wait for the completion webhook

The scan times differ depending on document length. Once it’s complete, Copyleaks will send a completed webhook to the status URL you provided.
For complete details on the webhook response structure, see the Scan Completed Webhook Reference.
6

Interpreting AI detection results

When the scan is complete, check the notifications.alerts array in the webhook payload.
  • If the array is empty or does not contain an alert with the code suspected-ai-text, you can assume no AI-generated content was detected.
  • If such an alert is present, you can inspect its additionalData field for a detailed summary of the AI Detector results.
7

Export detailed results

Once the scan is complete, you’ll receive a completed webhook. To get the full analysis needed to display a report, you need to export two key pieces of data using the export endpoint:
  1. AI Detection Results: It provides a detailed breakdown of which parts of the text were identified as potentially AI-generated. You’ll receive a result ID for the AI detection in the completed webhook, which you’ll use for the export. See the AI Detection Result data type.
  2. Crawled Version: This is the plain text or HTML representation of the original scanned document. See the Crawled Version data type.
Your export request must specify a completionWebhook to be notified when the exported data is ready for download.
8

Summary

You have successfully submitted a scan for AI-generated content detection and exported the results. You can now handle the results in your application, display them to users with confidence scores and highlighted AI-generated sections, or take further actions based on the findings.

Frequently asked questions

Set "aiGeneratedText": { "detect": true } inside the submission properties. Without it, the scan runs without AI-generated text analysis.
Documents such as PDF, DOCX, and TXT are supported. See the full list of supported AI text detection file types.
Yes. Set "sandbox": true in the submission properties. Sandbox mode is free and returns mock results, so you can wire up the flow before going live.
When the scan completes, check the notifications.alerts array in the webhook payload. An alert with the code suspected-ai-text indicates AI-generated content was detected; its additionalData field holds the detailed summary.
After the completed webhook, call the export endpoint with the AI detection result ID to retrieve the AI Detection Result and the Crawled Version of the document.

Next steps

Webhooks Overview

Learn how to securely receive and process notifications from Copyleaks.

Viewing AI Detection Results

Understand the AI detection result format and how to display confidence scores to your users.