Skip to content
Authenticity

Exclude Template Text

The Exclude Template feature allows you to refine the analysis of documents by excluding specific sections based on a predefined template. This is particularly useful for scenarios like checking student exams where the questions are the same for everyone, and you only want to scan the student’s answers.

This guide will walk you through the process of creating a template and then using it to exclude content from your scans.

To better understand how template exclusion works, consider the following scenario where a teacher wants to scan student exams but exclude the questions.

The Template Student Submission What Copyleaks Scans
(Indexed beforehand) (The file you scan) (The actual analysis)
Question 1: Explain the process of photosynthesis. Question 1: Explain the process of photosynthesis.

Answer: Photosynthesis is the process used by plants...
Question 1: Explain the process of photosynthesis.

Answer: Photosynthesis is the process used by plants...

By excluding the template text, the plagiarism scan focuses solely on the student’s original answer, preventing false positives from the question text itself.

Templates for exclusion can be referenced in two ways:

  • From a normal submitted scan: Reference any existing scanId from your submissions (saved short-term which is determined by the expiration property).
  • From your Private Cloud Hub: Index the template document into your Private Cloud Hub (for recurring or long-term use).

This approach is widely used by many institutions to ensure that commonly repeated content, such as exam questions, rubrics, or boilerplate instructions, does not affect 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. First, you need to submit the document that contains the text you want to exclude (the template). You will “index” this document into a repository (either in your Private Cloud Hub or Shared Data Hub).

    In this example, we will submit a file with the ID my-template-index to a repository named my_private_cloud_exam_template.

    PUT https://api.copyleaks.com/v3/scans/submit/file/my-template-index
    Content-Type: application/json
    Authorization: Bearer <YOUR_AUTH_TOKEN>
    {
    "base64": "VGhpcyBpcyBhIHRlc3QgZG9jdW1lbnQu",
    "filename": "exam_template.txt",
    "properties": {
    "action": 2,
    "indexing": {
    "repositories": [
    {
    "id": "6e870e0bb2264",
    "includeMySubmissions": true,
    "includeOthersSubmissions": true
    }
    ],
    "copyleaksDb": false
    },
    "webhooks": {
    "status": "https://your-server.com/webhook/{STATUS}"
    }
    }
    }
  5. Now that you have a template indexed, you can submit a new document for scanning and tell Copyleaks to exclude the content of the template.

    Use the properties.exclude.documentTemplateIds field to specify the template ID.

    PUT https://api.copyleaks.com/v3/scans/submit/file/student-exam-submission
    Content-Type: application/json
    Authorization: Bearer <YOUR_AUTH_TOKEN>
    {
    "base64": "VGhpcyBpcyBhIHRlc3QgZG9jdW1lbnQu",
    "filename": "student_submission.txt",
    "properties": {
    "action": 0,
    "webhooks": {
    "status": "https://your-server.com/webhook/{STATUS}"
    },
    "exclude": {
    "documentTemplateIds": ["my-template-index"]
    },
    "indexing": {
    "repositories": [
    {
    "id": "your-repo-id",
    "includeMySubmissions": true,
    "includeOthersSubmissions": true
    }
    ],
    "copyleaksDb": false
    },
    "aiGeneratedText": {
    "detect": true
    },
    "sandbox": true
    }
    }
  6. You have just:

    • ✅ Created a template document and indexed it
    • ✅ Submitted a scan with template exclusion
    • ✅ Excluded template text from your plagiarism analysis