Skip to content
Authenticity

Detect AI-Generated Content in Documents

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.

  1. Before you start, ensure you have the following:

  2. Choose your preferred method for making API calls.

    You can interact with the API using any standard HTTP client.

    For a quicker setup, we provide a Postman collection. See our Postman guide for instructions.

  3. 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.

    POST https://id.copyleaks.com/v3/account/login/api
    Headers
    Content-Type: application/json
    Body
    {
    "email": "[email protected]",
    "key": "00000000-0000-0000-0000-000000000000"
    }

    Response

    {
    "access_token": "<ACCESS_TOKEN>",
    ".issued": "2025-07-31T10:19:40.0690015Z",
    ".expires": "2025-08-02T10:19:40.0690016Z"
    }
  4. For this guide, we’ll demonstrate document submission. Each submission requires a unique scanId for proper tracking and identification.

    PUT https://api.copyleaks.com/v3/scans/submit/file/my-ai-detection-scan
    Headers
    Authorization: Bearer <YOUR_AUTH_TOKEN>
    Content-Type: application/json
    Body
    {
    "base64": "<BASE64_ENCODED_PDF_CONTENT>",
    "filename": "my-file.pdf",
    "properties": {
    "webhooks": {
    "status": "https://your-server.com/webhook/{STATUS}"
    },
    "sandbox": true,
    "aiGeneratedText": {
    "detect": true
    }
    }
    }
  5. The scan times differ depending on document length. Once it’s complete, Copyleaks will send a completed webhook to the status URL you provided.

  6. 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 detection results.
  7. 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.

    POST https://api.copyleaks.com/v3/downloads/my-ai-detection-scan/export/<export_id>
    Headers
    Authorization: Bearer <your_token>
    Content-Type: application/json
    Body
    {
    "completionWebhook": "https://your.server/export/completed",
    "maxRetries": 3,
    "developerPayload": "custom_data_identifier",
    "crawledVersion": {
    "endpoint": "https://your.server/webhook/export/crawled",
    "verb": "POST",
    "headers": [
    [
    "header-key",
    "header-value"
    ]
    ]
    },
    "results": [
    {
    "id": "ai-result-1",
    "endpoint": "https://your.server/webhook/export/ai-result/ai-result-1",
    "verb": "POST",
    "headers": [
    [
    "header-key",
    "header-value"
    ]
    ]
    }
    ]
    }
  8. 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.