How it works
To better understand how template exclusion works, consider the following scenario where a teacher wants to scan student exams but exclude the questions.
By excluding the template text, the plagiarism scan focuses solely on the student’s original answer, preventing false positives from the question text itself.
Template sourcing
Templates for exclusion can be referenced in two ways:- From a normal submitted scan: Reference any existing
scanIdfrom your submissions (saved short-term which is determined by theexpirationproperty). - From your Private Cloud Hub: Index the template document into your Private Cloud Hub (for recurring or long-term use).
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
Create a template (index a document)
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 IDmy-template-index to a repository named my_private_cloud_exam_template.Make sure to keep track of the
scanId (in this case my-template-index) as you will need it for the next step.5
Scan with template exclusion
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 theproperties.exclude.documentTemplateIds field to specify the template ID.6
Summary
You have just:- Created a template document and indexed it
- Submitted a scan with template exclusion
- Excluded template text from your plagiarism analysis
Next steps
Check for Plagiarism
Detect plagiarism in text documents using the Copyleaks API. Search billions of sources to find unoriginal content.
Detect AI-Generated Content
Detect AI-generated text via sync or async API calls. This guide covers sync detection, see the Authenticity API Guide for async.
Assess Grammar and Writing Quality
Get writing and grammar suggestions via API. Authenticate, submit text, and access full details in the docs.
Moderate Text
Scan and moderate text content for unsafe or policy-relevant material across 10+ categories.

