Excluding and Preventing Indexing of Content
You have granular control over what content is scanned and what data is stored when you submit a document to Copyleaks. This guide covers two distinct types of exclusion:
- Excluding Parts of a Document from Scan Analysis: This allows you to refine the plagiarism scan by ignoring specific elements like quotes or code blocks.
- Preventing a Document from Being Indexed: This allows you to control whether the entire document is added to the Copyleaks Internal Database for future comparisons.
Exclude Options
Section titled “Exclude Options”The exclude object can contain the following boolean properties:
quotes: If set totrue, all text within quotation marks will be ignored.citations: If set totrue, citations and references will be ignored.references: If set totrue, the bibliography or reference list will be ignored.tableOfContents: If set totrue, the table of contents will be ignored.titles: If set totrue, titles and headings will be ignored.code: If set totrue, code blocks will be ignored.documentTemplateIds: An array of unique identifiers for predefined templates stored in your Private Cloud Hub or the Shared Data Hub. These templates’ content is then excluded from the document and won’t count towards plagiarism or AI analysis.
Using the Exclude
Section titled “Using the Exclude”The exclude property is a powerful feature with two primary uses:
-
Active Scans: When submitting a document for scanning, you can include the
excludeobject in the request payload to specify which parts of the document should be ignored during analysis, e.g., you can exclude quotes, citations, or code blocks to focus on the most relevant content. -
Exclude Template: The
excludetemplate allows you to refine the analysis of documents by excluding specific sections based on a predefined template. The template document could be located in either your Private Cloud Hub or the Shared Data Hub, e.g., excluding exam questions from a student’s filled out exam.
🚀 Get Started
Section titled “🚀 Get Started”-
Before you begin
Section titled “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.
-
Installation
Section titled “Installation”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.
Terminal window sudo apt-get install curlDownload it from curl.se
Terminal window brew install curlTerminal window pip install copyleaksTerminal window npm install plagiarism-checker -
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/apiHeadersContent-Type: application/jsonBody{"key": "00000000-0000-0000-0000-000000000000"}Terminal window export COPYLEAKS_API_KEY="your-api-key-here"curl --request POST \--url https://id.copyleaks.com/v3/account/login/api \--header 'Accept: application/json' \--header 'Content-Type: application/json' \--data "{\"email\": \"${COPYLEAKS_EMAIL}\",\"key\": \"${COPYLEAKS_API_KEY}\"}"from copyleaks.copyleaks import CopyleaksAPI_KEY = "your-api-key-here"# Login to Copyleaksauth_token = Copyleaks.login(EMAIL_ADDRESS, API_KEY)print("Logged successfully!\nToken:", auth_token)const { Copyleaks } = require("plagiarism-checker");const API_KEY = "your-api-key-here";const copyleaks = new Copyleaks();// Login functionfunction loginToCopyleaks() {return copyleaks.loginAsync(EMAIL_ADDRESS, API_KEY).then((loginResult) => {console.log("Login successful!");console.log("Access Token:", loginResult.access_token);return loginResult;},(err) => {console.error('Login failed:', err);throw err;});}loginToCopyleaks();import com.copyleaks.sdk.api.Copyleaks;String API_KEY = "00000000-0000-0000-0000-000000000000";// Login to Copyleakstry {String authToken = Copyleaks.login(EMAIL_ADDRESS, API_KEY);System.out.println("Logged successfully!\nToken: " + authToken);} catch (CommandException e) {System.out.println("Failed to login: " + e.getMessage());System.exit(1);}Response
{"access_token": "<ACCESS_TOKEN>",".issued": "2025-07-31T10:19:40.0690015Z",".expires": "2025-08-02T10:19:40.0690016Z"} -
Indexed Scan
Section titled “Indexed Scan”Use the following example to index a document as a template in your Private Cloud Hub.
PUT https://api.copyleaks.com/v3/scans/submit/file/my-template-indexContent-Type: application/jsonAuthorization: Bearer YOUR_LOGIN_TOKEN{"base64": "VGhpcyBpcyBhIHRlc3QgZG9jdW1lbnQu","filename": "student_solved_exam","properties": {"indexing": {"action": 2,"repositories": ["my_private_cloud_exam_template"]},"sandbox": true}}Terminal window curl --request PUT \--url https://api.copyleaks.com/v3/scans/submit/file/my-template-index \--header 'Authorization: Bearer YOUR_LOGIN_TOKEN' \--header 'Content-Type: application/json' \--data '{"base64": "VGhpcyBpcyBhIHRlc3QgZG9jdW1lbnQu","filename": "student_solved_exam","properties": {"indexing": {"action": 2,"repositories": ["my_private_cloud_exam_template"]},"sandbox": true}}'import requestsimport base64# Document contentdocument_content = "This is a test document."base64_content = base64.b64encode(document_content.encode()).decode('utf-8')url = "https://api.copyleaks.com/v3/scans/submit/file/my-template-index"payload = {"base64": base64_content,"filename": "student_solved_exam","properties": {"indexing": {"action": 2,"repositories": ["my_private_cloud_exam_template"]},"sandbox": True}}headers = {"Authorization": "Bearer YOUR_LOGIN_TOKEN","Content-Type": "application/json"}response = requests.put(url, json=payload, headers=headers)print(response.json())const { Copyleaks } = require('plagiarism-checker');const API_KEY = "your-api-key-here";async function indexTemplate() {const copyleaks = new Copyleaks();const authToken = await copyleaks.loginAsync(EMAIL_ADDRESS, API_KEY);const documentContent = "This is a test document.";const base64Content = Buffer.from(documentContent).toString('base64');const scanId = "my-template-index";const fileSubmission = {base64: base64Content,filename: "student_solved_exam",properties: {indexing: {action: 2,repositories: ["my_private_cloud_exam_template"]},sandbox: true}};try {const result = await copyleaks.submitFileAsync(authToken, scanId, fileSubmission);console.log('Template indexed successfully!', result);} catch (error) {console.error('Failed to index template:', error);}}indexTemplate();import classes.Copyleaks;import models.submissions.CopyleaksFileSubmissionModel;import models.submissions.properties.*;import java.util.Base64;import java.nio.charset.StandardCharsets;public class IndexTemplateExample {private static final String API_KEY = "00000000-0000-0000-0000-000000000000";public static void main(String[] args) {try {String authToken = Copyleaks.login(EMAIL_ADDRESS, API_KEY);String documentContent = "This is a test document.";String base64Content = Base64.getEncoder().encodeToString(documentContent.getBytes(StandardCharsets.UTF_8));SubmissionProperties properties = new SubmissionProperties();properties.setSandbox(true);properties.setIndexing(new SubmissionIndexing(2, new String[]{"my_private_cloud_exam_template"}));CopyleaksFileSubmissionModel fileSubmission = new CopyleaksFileSubmissionModel(base64Content,"student_solved_exam",properties);Copyleaks.submitFile(authToken, "my-template-index", fileSubmission);System.out.println("Template indexed successfully!");} catch (Exception e) {System.out.println("Failed: " + e.getMessage());e.printStackTrace();}}} -
Submit for Scanning
Section titled “Submit for Scanning”Include the
excludeobject in the request payload to specify which parts of the document should be ignored during analysis.PUT https://api.copyleaks.com/v3/scans/submit/file/my-scan-with-templateContent-Type: application/jsonAuthorization: Bearer YOUR_LOGIN_TOKEN{"base64": "VGhpcyBpcyBhIHRlc3QgZG9jdW1lbnQu","filename": "document-to-scan.txt","properties": {"exclude": {"documentTemplateIds": ["my-template-index"],"quotes": true,"citations": true,"references": true,"tableOfContents": true,"titles": true,"htmlTemplate": true,"code": {"comments": true}},"sandbox": true}}Terminal window curl --request PUT \--url https://api.copyleaks.com/v3/scans/submit/file/my-scan-with-template \--header 'Authorization: Bearer YOUR_LOGIN_TOKEN' \--header 'Content-Type: application/json' \--data '{"base64": "VGhpcyBpcyBhIHRlc3QgZG9jdW1lbnQu","filename": "document-to-scan.txt","properties": {"exclude": {"documentTemplateIds": ["my-template-index"],"quotes": true,"citations": true,"references": true,"tableOfContents": true,"titles": true,"htmlTemplate": true,"code": {"comments": true}},"sandbox": true}}'import requestsimport base64# Document contentdocument_content = "This is a test document."base64_content = base64.b64encode(document_content.encode()).decode('utf-8')url = "https://api.copyleaks.com/v3/scans/submit/file/my-scan-with-template"payload = {"base64": base64_content,"filename": "document-to-scan.txt","properties": {"exclude": {"documentTemplateIds": ["my-template-index"],"quotes": true,"citations": true,"references": true,"tableOfContents": true,"titles": true,"htmlTemplate": true,"code": {"comments": true}},"sandbox": True}}headers = {"Authorization": "Bearer YOUR_LOGIN_TOKEN","Content-Type": "application/json"}response = requests.put(url, json=payload, headers=headers)print(response.json())const { Copyleaks } = require('plagiarism-checker');const API_KEY = "your-api-key-here";async function submitScanWithTemplate() {const copyleaks = new Copyleaks();const authToken = await copyleaks.loginAsync(EMAIL_ADDRESS, API_KEY);const documentContent = "This is a test document.";const base64Content = Buffer.from(documentContent).toString('base64');const scanId = "my-scan-with-template";const fileSubmission = {base64: base64Content,filename: "document-to-scan.txt",properties: {exclude: {documentTemplateIds: ["my-template-index"],quotes: true,citations: true,references: true,tableOfContents: true,titles: true,htmlTemplate: true,code: {comments: true}},sandbox: true}};try {const result = await copyleaks.submitFileAsync(authToken, scanId, fileSubmission);console.log('Scan submitted successfully!', result);} catch (error) {console.error('Failed to submit scan:', error);}}submitScanWithTemplate();import classes.Copyleaks;import models.submissions.CopyleaksFileSubmissionModel;import models.submissions.properties.*;import java.util.Base64;import java.nio.charset.StandardCharsets;public class SubmitScanWithTemplate {private static final String API_KEY = "00000000-0000-0000-0000-000000000000";public static void main(String[] args) {try {String authToken = Copyleaks.login(EMAIL_ADDRESS, API_KEY);String documentContent = "This is a test document.";String base64Content = Base64.getEncoder().encodeToString(documentContent.getBytes(StandardCharsets.UTF_8));SubmissionProperties properties = new SubmissionProperties();properties.setSandbox(true);properties.setExclude(new SubmissionExclude(new String[]{"my-template-index"}));CopyleaksFileSubmissionModel fileSubmission = new CopyleaksFileSubmissionModel(base64Content,"document-to-scan.txt",properties);Copyleaks.submitFile(authToken, "my-scan-with-template", fileSubmission);System.out.println("Scan submitted successfully!");} catch (Exception e) {System.out.println("Failed: " + e.getMessage());e.printStackTrace();}}}
Response Example
Section titled “Response Example”When the scan is processed, the scannedDocument object in the response will reflect the number of words that were excluded.
The scan was successfully created and is now processing. The excluded word count is reflected in the response.
Example Response
A typical response from this endpoint:
{ "scannedDocument": { "scanId": "my-scan-exclude-example", "totalWords": 8, "totalExcluded": 4, "credits": 0, "expectedCredits": 1, "creationTime": "2025-08-10T10:00:00.000000Z", "metadata": { "filename": "document-with-exclusions.txt" }, "enabled": { "plagiarismDetection": true, "aiDetection": false, "explainableAi": false,// ... truncated