Get started
1
Before you begin
Before you start, ensure you have the following:- An active Copyleaks account. If you don’t have one, sign up for free.
- You can find your API key on the API Dashboard.
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 theAuthorization: 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.
scanId for proper tracking and identification.- Filename: The file extension in the
filenameparameter 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
base64property.
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.
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 thenotifications.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
additionalDatafield for a detailed summary of the AI Detector results.
7
Export detailed results
Once the scan is complete, you’ll receive acompleted webhook. To get the full analysis needed to display a report, you need to export two key pieces of data using the export endpoint:-
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
completedwebhook, which you’ll use for the export. See the AI Detection Result data type. - Crawled Version: This is the plain text or HTML representation of the original scanned document. See the Crawled Version data type.
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
How do I enable AI detection on a scan?
How do I enable AI detection on a scan?
Set
"aiGeneratedText": { "detect": true } inside the submission properties. Without it, the scan runs without AI-generated text analysis.Which file types can I scan for AI-generated content?
Which file types can I scan for AI-generated content?
Documents such as PDF, DOCX, and TXT are supported. See the full list of supported AI text detection file types.
Can I test AI detection without using credits?
Can I test AI detection without using credits?
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.How do I know whether AI-generated content was found?
How do I know whether AI-generated content was found?
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.How do I get the detailed AI detection breakdown?
How do I get the detailed AI detection breakdown?
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.

