Code Plagiarism
Detection API
Build plagiarism detection into your apps. Check code against 20+ billion sources.
Getting Started with the Codequiry API
Everything you need to go from zero to your first plagiarism check in under 10 minutes. Follow this step-by-step guide to integrate Codequiry's powerful plagiarism detection into your application.
Prerequisites
1. Create an Account
Sign up at codequiry.com/signup to get access to the API. Free and paid plans available.
2. Generate an API Key
Navigate to your dashboard settings and generate an API key. Keep it secure - treat it like a password.
3. Have a REST Client
Use cURL, Postman, or any HTTP library in your programming language (fetch, requests, axios, etc.).
Step 1: Test Your API Key
First, verify your API key is working by calling the account endpoint:
curl -H "apikey: YOUR_API_KEY_HERE" \
https://codequiry.com/api/v1/account
You should see a response with your account details:
{
"id": 12345,
"name": "Your Name",
"email": "[email protected]",
"plan": "pro",
"checks_remaining": 100
}
Step 2: Create a Plagiarism Check
A "check" is a container for your plagiarism analysis. Create one by providing a name and programming language:
curl -X POST "https://codequiry.com/api/v1/check/create" \
-H "apikey: YOUR_API_KEY_HERE" \
-d "name=My First Check" \
-d "language=14"
{
"id": 2810,
"name": "My First Check",
"status_id": 1,
"created_at": "2024-01-15 14:30:22"
}
id value (e.g., 2810) for all subsequent API calls.
Common Language IDs
| Language | ID | Language | ID |
|---|---|---|---|
| Python | 14 |
JavaScript | 39 |
| Java | 13 |
C++ | 17 |
| C# | 18 |
TypeScript | 55 |
| Go | 30 |
PHP | 21 |
See Languages API for the complete list of 65+ supported languages.
Step 3: Upload Code Files
Upload ZIP files containing source code. Each ZIP represents one student's submission:
# Upload first submission
curl -X POST "https://codequiry.com/api/v1/check/upload" \
-H "apikey: YOUR_API_KEY_HERE" \
-F "check_id=2810" \
-F "file=@student1_code.zip"
# Upload second submission
curl -X POST "https://codequiry.com/api/v1/check/upload" \
-H "apikey: YOUR_API_KEY_HERE" \
-F "check_id=2810" \
-F "file=@student2_code.zip"
Step 4: Start the Analysis
Once all files are uploaded, start the plagiarism detection:
curl -X POST "https://codequiry.com/api/v1/check/start" \
-H "apikey: YOUR_API_KEY_HERE" \
-d "check_id=2810" \
-d "test_type=1"
Test Types
0Peer Similarity - Compare submissions against each other only1Web Check - Check against 20+ billion web sources (recommended)2Database Check - Deep analysis with AI detection
Step 5: Wait for Completion
Analysis takes 2-10 minutes depending on file count and test type. Poll the status endpoint every 30 seconds:
# Poll every 30 seconds until status_id = 4 (completed)
curl -X POST "https://codequiry.com/api/v1/check/status" \
-H "apikey: YOUR_API_KEY_HERE" \
-d "check_id=2810"
{
"check_id": 2810,
"status_id": 6,
"status": "Checking",
"progress": 65,
"status_message": "Analyzing submissions..."
}
1 = Created, 6 = Checking, 7 = Queued, 4 = Completed, 5 = Error
Step 6: Retrieve Results
Once status_id is 4, retrieve the plagiarism results:
curl -X POST "https://codequiry.com/api/v1/check/overview" \
-H "apikey: YOUR_API_KEY_HERE" \
-d "check_id=2810"
{
"submissions": [
{
"id": 45001,
"filename": "student1_code.zip",
"total_result": 72.5,
"local_result": 68.3,
"web_result": 12.8,
"status": "analyzed"
},
{
"id": 45002,
"filename": "student2_code.zip",
"total_result": 15.2,
"local_result": 10.1,
"web_result": 5.3,
"status": "analyzed"
}
]
}
total_result field shows the overall similarity percentage for each submission.
Complete Code Examples
Copy-paste ready examples for the complete workflow in popular languages.
JavaScript (Node.js)
const API_KEY = 'YOUR_API_KEY_HERE';
const BASE_URL = 'https://codequiry.com/api/v1';
async function apiCall(endpoint, data = {}) {
const response = await fetch(`${BASE_URL}${endpoint}`, {
method: 'POST',
headers: { 'apikey': API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify(data)
});
return response.json();
}
async function runPlagiarismCheck() {
// 1. Create check
const check = await apiCall('/check/create', { name: 'My Check', language: 14 });
console.log(`Check created: ${check.id}`);
// 2. Upload files (using FormData for file uploads)
const formData = new FormData();
formData.append('check_id', check.id);
formData.append('file', fileBlob, 'student1.zip');
await fetch(`${BASE_URL}/check/upload`, {
method: 'POST',
headers: { 'apikey': API_KEY },
body: formData
});
// 3. Start analysis
await apiCall('/check/start', { check_id: check.id, test_type: 1 });
// 4. Poll for completion
let status;
do {
await new Promise(r => setTimeout(r, 30000)); // Wait 30s
status = await apiCall('/check/status', { check_id: check.id });
console.log(`Progress: ${status.progress}%`);
} while (status.status_id !== 4 && status.status_id !== 5);
// 5. Get results
const results = await apiCall('/check/overview', { check_id: check.id });
results.submissions.forEach(sub => {
console.log(`${sub.filename}: ${sub.total_result}% similarity`);
});
}
runPlagiarismCheck();
Python
import requests
import time
API_KEY = 'YOUR_API_KEY_HERE'
BASE_URL = 'https://codequiry.com/api/v1'
HEADERS = {'apikey': API_KEY}
def run_plagiarism_check():
# 1. Create check
check = requests.post(f'{BASE_URL}/check/create',
headers=HEADERS,
data={'name': 'My Check', 'language': 14}
).json()
print(f"Check created: {check['id']}")
# 2. Upload files
with open('student1.zip', 'rb') as f:
requests.post(f'{BASE_URL}/check/upload',
headers=HEADERS,
data={'check_id': check['id']},
files={'file': f}
)
# 3. Start analysis
requests.post(f'{BASE_URL}/check/start',
headers=HEADERS,
data={'check_id': check['id'], 'test_type': 1}
)
# 4. Poll for completion
while True:
time.sleep(30)
status = requests.post(f'{BASE_URL}/check/status',
headers=HEADERS,
data={'check_id': check['id']}
).json()
print(f"Progress: {status['progress']}%")
if status['status_id'] in (4, 5):
break
# 5. Get results
results = requests.post(f'{BASE_URL}/check/overview',
headers=HEADERS,
data={'check_id': check['id']}
).json()
for sub in results['submissions']:
print(f"{sub['filename']}: {sub['total_result']}% similarity")
run_plagiarism_check()
Faster Alternative: Quick Check API
Want to skip the multi-step workflow? The Quick Check API combines create, upload, and start into a single API call - 3x faster integration.
# All-in-one: create + upload + start in one request
curl -X POST "https://codequiry.com/api/v1/check/quick" \
-H "apikey: YOUR_API_KEY_HERE" \
-F "name=Quick Check" \
-F "language=14" \
-F "test_type=1" \
-F "files[][email protected]" \
-F "files[][email protected]"
Troubleshooting
Cause: Invalid or missing API key
Fix: Ensure the apikey header (lowercase) is included in every request. Check for typos or extra spaces.
Cause: Missing or invalid parameters
Fix: Check that all required parameters are included. Name must be 3+ characters, language must be a valid ID.
Cause: Large files or high server load
Fix: Wait up to 15 minutes. If status doesn't change, create a new check and retry. Contact support if issues persist.
Cause: Invalid file format or size
Fix: Files must be ZIP archives under 10MB. Ensure you're using multipart/form-data encoding.
What's Next?
Now that you've completed your first check, explore these features to get the most out of Codequiry: