# Copyleaks SDK
The official [Copyleaks](https://copyleaks.com/) Python library, supporting Python versions: Python 3.6+
## 🚀 Getting Started
Before you start, ensure you have the following:
* An active Copyleaks account. If you don’t have one, [Sign up for free](https://copyleaks.com/signup).
* You can find your API key on the [API Dashboard](https://api.copyleaks.com/dashboard).
Once you have your account and API key:
**Install the SDK**:
Use the Python Package Manager - PiPy. When integrating this way, you will automatically be able to update the SDK to its latest version:
```bash
pip install copyleaks
```
## 📚 Documentation
To learn more about how to use Copyleaks API please check out our [Documentation](https://docs.copyleaks.com/resources/sdks/python/).
## 💡 Usage Examples
Here are some common usage examples for the Copyleaks SDK. You can also see a comprehensive code example in the `example.py` file on our GitHub repository: [example.py](https://github.com/Copyleaks/Python-Plagiarism-Checker/blob/master/example.py).
### Get Authentication Token
This example demonstrates how to log in to the Copyleaks API and obtain an authentication token.
```python
import base64
from copyleaks.copyleaks import Copyleaks
from copyleaks.exceptions.command_error import CommandError
# --- Your Credentials ---
EMAIL_ADDRESS = 'YOUR_EMAIL_ADDRESS' # Replace with your Copyleaks registered email
KEY = 'YOUR_API_KEY' # Replace with your Copyleaks API Key
# --------------------
# Log in to the Copyleaks API
auth_token = Copyleaks.login(EMAIL_ADDRESS, KEY)
print("✅ Logged in successfully!")
```
For a detailed understanding of the authentication process, refer to the Copyleaks Login Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/account/login).
##
### Submit Text for Plagiarism Scan
This example shows how to prepare and submit raw text content for a plagiarism scan.
```python
import base64
from copyleaks.copyleaks import Copyleaks
from copyleaks.models.submit.document import FileDocument
from copyleaks.models.submit.properties.scan_properties import ScanProperties
# Prepare your content for scanning
# You can scan a URL, a local file, or raw text.
# This example scans a simple string of text.
print("Submitting text for scanning...")
text_to_scan = "Hello world, this is a test."
base64_content = base64.b64encode(text_to_scan.encode()).decode()
# Configure the scan
scan_id = "my-first-scan"
scan_properties = ScanProperties("https://your-server.com/webhook/{STATUS}") # IMPORTANT: Replace with your actual webhook URL to receive scan results
scan_properties.set_sandbox(True) # Turn on sandbox mode for testing without consuming credits
file_submission = FileDocument(base64_content, "test.txt")
file_submission.set_properties(scan_properties)
# Submit the scan to Copyleaks
Copyleaks.submit_file(auth_token, scan_id, file_submission)
print(f"🚀 Scan submitted successfully! Scan ID: {scan_id}")
print("You will be notified via your webhook when the scan is complete.")
```
For a full guide please refer to our step by step [Guide](https://docs.copyleaks.com/guides/authenticity/detect-plagiarism-text)
For a detailed understanding of the plagiarism detection process, refer to the Copyleaks Submit Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/scans/submit-file)
##
### AI-Generated Text Detection
Use the AI detection client to determine if content was generated by artificial intelligence.
```python
import base64
from copyleaks.copyleaks import Copyleaks
from copyleaks.models.submit.document import NaturalLanguageDocument
scan_id = "your-scan-id"
sample_text = "Lions are social animals, living in groups called prides, typically consisting of several females, their offspring, and a few males. Female lions are the primary hunters, working together to catch prey. Lions are known for their strength, teamwork, and complex social structures."
natural_language_submission = NaturalLanguageDocument(sample_text)
natural_language_submission.set_sandbox(True) # Use sandbox for testing
response = Copyleaks.AiDetectionClient.submit_natural_language(auth_token, scan_id, natural_language_submission)
print("\nAI Detection (Natural Language):")
print(response)
```
For a full guide please refer to our step by step [Guide](https://docs.copyleaks.com/guides/ai-detector/ai-text-detection/)
For a detailed understanding of the Ai detection process, refer to the Copyleaks detect natural language Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/writer-detector/check/)
##
### Writing Assistant
Get intelligent suggestions for improving grammar, spelling, style, and overall writing quality.
```python
import base64
from copyleaks.copyleaks import Copyleaks
from copyleaks.exceptions.command_error import CommandError
from copyleaks.models.submit.document import WritingAssistantDocument
from copyleaks.models.submit.properties.score_weights import ScoreWeights
scan_id = "your-scan-id"
# Define the text to be assessed
sample_text = "This text have some grammer mistake and it is not good written."
# Configure score weights for different aspects of writing quality
score_weight = ScoreWeights()
score_weight.set_grammar_score_weight(0.2)
score_weight.set_mechanics_score_weight(0.3)
score_weight.set_sentence_structure_score_weight(0.5)
score_weight.set_word_choice_score_weight(0.4)
submission = WritingAssistantDocument(sample_text)
submission.set_score(score_weight)
submission.set_sandbox(True) # Use sandbox for testing
response = Copyleaks.WritingAssistantClient.submit_text(auth_token, scan_id, submission)
print("\nWriting Assistant Feedback:")
print(response)
```
For a full guide please refer to our step by step [Guide](https://docs.copyleaks.com/guides/writing/check-grammar/)
For a detailed understanding of the Writing assistant process, refer to the Copyleaks writing feedback Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/writing-assistant/check/)
##
### Text Moderation
Scan and moderate text content for unsafe, inappropriate, or policy-violating material across various categories.
```python
import base64
from copyleaks.copyleaks import Copyleaks
# Specific import for Text Moderation
from copyleaks.models.submit.request_model import CopyleaksTextModerationRequestModel
scan_id = "your-scan-id"
# Initialize the text moderation request model
model = CopyleaksTextModerationRequestModel(
text="This is some text to scan.",
sandbox=True, # Use sandbox for testing
language="en",
labels=[
{"id": "adult-v1"},
{"id": "toxic-v1"},
{"id": "violent-v1"},
{"id": "profanity-v1"},
{"id": "self-harm-v1"},
{"id": "harassment-v1"},
{"id": "hate-speech-v1"},
{"id": "drugs-v1"},
{"id": "firearms-v1"},
{"id": "cybersecurity-v1"},
]
)
textModerationResponse = Copyleaks.TextModerationClient.submit_text(auth_token, scan_id, model)
print("\nText Moderation:")
print(textModerationResponse.model_dump_json())
```
For a full guide please refer to our step by step [Guide](https://docs.copyleaks.com/guides/moderation/moderate-text/)
For a detailed understanding of the Text moderation process, refer to the Copyleaks text moderation Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/text-moderation/check/)
##
## Further Resources
* **Copyleaks API Dashboard:** Manage your API keys, monitor usage, and view analytics from your personalized dashboard. [Access Dashboard](https://api.copyleaks.com/dashboard)
* **Copyleaks SDK Documentation:** Explore comprehensive guides, API references, and code examples for seamless integration. [Read Documentation](https://docs.copyleaks.com/resources/sdks/overview/)
## Support
* If you need assistance, please contact Copyleaks Support via our support portal: Contact Copyleaks [Support](https://help.copyleaks.com/s/contactsupport).
* To arrange a product demonstration, book a demo here: [Booking Link](https://copyleaks.com/book-a-demo).
Raw data
{
"_id": null,
"home_page": "https://api.copyleaks.com",
"name": "copyleaks",
"maintainer": null,
"docs_url": "https://pythonhosted.org/copyleaks/",
"requires_python": null,
"maintainer_email": null,
"keywords": "copyleaks, api, plagiarism, content, checker, online, academic, publishers, websites",
"author": "Copyleaks ltd",
"author_email": "sales@copyleaks.com",
"download_url": "https://files.pythonhosted.org/packages/27/2f/568dda29b04544098ff0a6ca91854238879b94dced2a6578484728fe48e1/copyleaks-5.0.0.tar.gz",
"platform": null,
"description": "# Copyleaks SDK\r\nThe official [Copyleaks](https://copyleaks.com/) Python library, supporting Python versions: Python 3.6+\r\n\r\n## \u00f0\u0178\u0161\u20ac Getting Started\r\nBefore you start, ensure you have the following:\r\n\r\n* An active Copyleaks account. If you don\u00e2\u20ac\u2122t have one, [Sign up for free](https://copyleaks.com/signup).\r\n* You can find your API key on the [API Dashboard](https://api.copyleaks.com/dashboard).\r\n\r\nOnce you have your account and API key:\r\n\r\n**Install the SDK**: \r\n\r\nUse the Python Package Manager - PiPy. When integrating this way, you will automatically be able to update the SDK to its latest version: \r\n```bash\r\npip install copyleaks\r\n```\r\n\r\n## \u00f0\u0178\u201c\u0161 Documentation\r\nTo learn more about how to use Copyleaks API please check out our [Documentation](https://docs.copyleaks.com/resources/sdks/python/). \r\n\r\n## \u00f0\u0178\u2019\u00a1 Usage Examples\r\nHere are some common usage examples for the Copyleaks SDK. You can also see a comprehensive code example in the `example.py` file on our GitHub repository: [example.py](https://github.com/Copyleaks/Python-Plagiarism-Checker/blob/master/example.py).\r\n\r\n### Get Authentication Token\r\nThis example demonstrates how to log in to the Copyleaks API and obtain an authentication token.\r\n\r\n```python\r\nimport base64\r\nfrom copyleaks.copyleaks import Copyleaks\r\nfrom copyleaks.exceptions.command_error import CommandError\r\n\r\n# --- Your Credentials ---\r\nEMAIL_ADDRESS = 'YOUR_EMAIL_ADDRESS' # Replace with your Copyleaks registered email\r\nKEY = 'YOUR_API_KEY' # Replace with your Copyleaks API Key\r\n# --------------------\r\n\r\n# Log in to the Copyleaks API\r\nauth_token = Copyleaks.login(EMAIL_ADDRESS, KEY)\r\nprint(\"\u00e2\u0153\u2026 Logged in successfully!\")\r\n```\r\nFor a detailed understanding of the authentication process, refer to the Copyleaks Login Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/account/login).\r\n##\r\n### Submit Text for Plagiarism Scan\r\nThis example shows how to prepare and submit raw text content for a plagiarism scan.\r\n\r\n```python\r\nimport base64\r\nfrom copyleaks.copyleaks import Copyleaks\r\nfrom copyleaks.models.submit.document import FileDocument\r\nfrom copyleaks.models.submit.properties.scan_properties import ScanProperties\r\n\r\n# Prepare your content for scanning\r\n# You can scan a URL, a local file, or raw text.\r\n# This example scans a simple string of text.\r\nprint(\"Submitting text for scanning...\")\r\ntext_to_scan = \"Hello world, this is a test.\"\r\nbase64_content = base64.b64encode(text_to_scan.encode()).decode()\r\n\r\n# Configure the scan\r\nscan_id = \"my-first-scan\" \r\nscan_properties = ScanProperties(\"https://your-server.com/webhook/{STATUS}\") # IMPORTANT: Replace with your actual webhook URL to receive scan results\r\nscan_properties.set_sandbox(True) # Turn on sandbox mode for testing without consuming credits\r\nfile_submission = FileDocument(base64_content, \"test.txt\")\r\nfile_submission.set_properties(scan_properties)\r\n\r\n# Submit the scan to Copyleaks\r\nCopyleaks.submit_file(auth_token, scan_id, file_submission)\r\nprint(f\"\u00f0\u0178\u0161\u20ac Scan submitted successfully! Scan ID: {scan_id}\")\r\nprint(\"You will be notified via your webhook when the scan is complete.\")\r\n```\r\nFor a full guide please refer to our step by step [Guide](https://docs.copyleaks.com/guides/authenticity/detect-plagiarism-text)\r\n\r\nFor a detailed understanding of the plagiarism detection process, refer to the Copyleaks Submit Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/scans/submit-file)\r\n##\r\n### AI-Generated Text Detection\r\nUse the AI detection client to determine if content was generated by artificial intelligence.\r\n\r\n```python\r\nimport base64\r\nfrom copyleaks.copyleaks import Copyleaks\r\nfrom copyleaks.models.submit.document import NaturalLanguageDocument \r\n\r\nscan_id = \"your-scan-id\"\r\n\r\nsample_text = \"Lions are social animals, living in groups called prides, typically consisting of several females, their offspring, and a few males. Female lions are the primary hunters, working together to catch prey. Lions are known for their strength, teamwork, and complex social structures.\"\r\nnatural_language_submission = NaturalLanguageDocument(sample_text)\r\nnatural_language_submission.set_sandbox(True) # Use sandbox for testing\r\nresponse = Copyleaks.AiDetectionClient.submit_natural_language(auth_token, scan_id, natural_language_submission)\r\nprint(\"\\nAI Detection (Natural Language):\")\r\nprint(response)\r\n```\r\nFor a full guide please refer to our step by step [Guide](https://docs.copyleaks.com/guides/ai-detector/ai-text-detection/)\r\n\r\nFor a detailed understanding of the Ai detection process, refer to the Copyleaks detect natural language Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/writer-detector/check/)\r\n##\r\n### Writing Assistant \r\nGet intelligent suggestions for improving grammar, spelling, style, and overall writing quality.\r\n\r\n```python\r\nimport base64\r\nfrom copyleaks.copyleaks import Copyleaks\r\nfrom copyleaks.exceptions.command_error import CommandError\r\nfrom copyleaks.models.submit.document import WritingAssistantDocument\r\nfrom copyleaks.models.submit.properties.score_weights import ScoreWeights\r\n\r\nscan_id = \"your-scan-id\"\r\n\r\n# Define the text to be assessed\r\nsample_text = \"This text have some grammer mistake and it is not good written.\"\r\n\r\n# Configure score weights for different aspects of writing quality\r\nscore_weight = ScoreWeights()\r\nscore_weight.set_grammar_score_weight(0.2)\r\nscore_weight.set_mechanics_score_weight(0.3)\r\nscore_weight.set_sentence_structure_score_weight(0.5)\r\nscore_weight.set_word_choice_score_weight(0.4)\r\n\r\nsubmission = WritingAssistantDocument(sample_text)\r\nsubmission.set_score(score_weight)\r\nsubmission.set_sandbox(True) # Use sandbox for testing\r\n\r\nresponse = Copyleaks.WritingAssistantClient.submit_text(auth_token, scan_id, submission)\r\nprint(\"\\nWriting Assistant Feedback:\")\r\nprint(response)\r\n```\r\nFor a full guide please refer to our step by step [Guide](https://docs.copyleaks.com/guides/writing/check-grammar/)\r\n\r\nFor a detailed understanding of the Writing assistant process, refer to the Copyleaks writing feedback Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/writing-assistant/check/)\r\n##\r\n### Text Moderation\r\nScan and moderate text content for unsafe, inappropriate, or policy-violating material across various categories.\r\n\r\n```python\r\nimport base64\r\nfrom copyleaks.copyleaks import Copyleaks\r\n# Specific import for Text Moderation\r\nfrom copyleaks.models.submit.request_model import CopyleaksTextModerationRequestModel\r\n\r\nscan_id = \"your-scan-id\"\r\n\r\n# Initialize the text moderation request model\r\nmodel = CopyleaksTextModerationRequestModel(\r\n text=\"This is some text to scan.\",\r\n sandbox=True, # Use sandbox for testing\r\n language=\"en\",\r\n labels=[\r\n {\"id\": \"adult-v1\"},\r\n {\"id\": \"toxic-v1\"},\r\n {\"id\": \"violent-v1\"},\r\n {\"id\": \"profanity-v1\"},\r\n {\"id\": \"self-harm-v1\"},\r\n {\"id\": \"harassment-v1\"},\r\n {\"id\": \"hate-speech-v1\"},\r\n {\"id\": \"drugs-v1\"},\r\n {\"id\": \"firearms-v1\"},\r\n {\"id\": \"cybersecurity-v1\"},\r\n ]\r\n)\r\n\r\ntextModerationResponse = Copyleaks.TextModerationClient.submit_text(auth_token, scan_id, model)\r\nprint(\"\\nText Moderation:\")\r\nprint(textModerationResponse.model_dump_json())\r\n```\r\nFor a full guide please refer to our step by step [Guide](https://docs.copyleaks.com/guides/moderation/moderate-text/)\r\n\r\nFor a detailed understanding of the Text moderation process, refer to the Copyleaks text moderation Endpoint [Documentation](https://docs.copyleaks.com/reference/actions/text-moderation/check/)\r\n##\r\n## Further Resources\r\n\r\n* **Copyleaks API Dashboard:** Manage your API keys, monitor usage, and view analytics from your personalized dashboard. [Access Dashboard](https://api.copyleaks.com/dashboard)\r\n* **Copyleaks SDK Documentation:** Explore comprehensive guides, API references, and code examples for seamless integration. [Read Documentation](https://docs.copyleaks.com/resources/sdks/overview/)\r\n\r\n\r\n## Support\r\n* If you need assistance, please contact Copyleaks Support via our support portal: Contact Copyleaks [Support](https://help.copyleaks.com/s/contactsupport).\r\n* To arrange a product demonstration, book a demo here: [Booking Link](https://copyleaks.com/book-a-demo).\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Copyleaks API gives you access to a variety of plagiarism detection technologies to protect your online content. Get the most comprehensive plagiarism report for your content that is easy to use and integrate.",
"version": "5.0.0",
"project_urls": {
"Download": "https://github.com/Copyleaks/Python-Plagiarism-Checker",
"Homepage": "https://api.copyleaks.com"
},
"split_keywords": [
"copyleaks",
" api",
" plagiarism",
" content",
" checker",
" online",
" academic",
" publishers",
" websites"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "272f568dda29b04544098ff0a6ca91854238879b94dced2a6578484728fe48e1",
"md5": "1667b6a619b4b6dc59607a2634502896",
"sha256": "6ec87a44372109ca12420e4d8fa4cf3b2ea8a50f0ec7ff770e7d2108546f9eaf"
},
"downloads": -1,
"filename": "copyleaks-5.0.0.tar.gz",
"has_sig": false,
"md5_digest": "1667b6a619b4b6dc59607a2634502896",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 31008,
"upload_time": "2025-08-31T10:34:15",
"upload_time_iso_8601": "2025-08-31T10:34:15.593152Z",
"url": "https://files.pythonhosted.org/packages/27/2f/568dda29b04544098ff0a6ca91854238879b94dced2a6578484728fe48e1/copyleaks-5.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-31 10:34:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Copyleaks",
"github_project": "Python-Plagiarism-Checker",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "copyleaks"
}