Code Plagiarism
Detection API
Build plagiarism detection into your apps. Check code against 20+ billion sources.
Batch Upload Files
Upload multiple ZIP files to a check in a single request. Upload up to 50 files at once, significantly faster than uploading one at a time.
API Endpoint
Authentication
Include your API key in the request header:
apikey: YOUR_API_KEY_HERE
Request Parameters
Send as multipart/form-data:
| Parameter | Type | Required | Description |
|---|---|---|---|
check_id |
Integer | Required | The check ID to upload files to |
files[] |
File[] | Required | Array of ZIP files (1-50 files, max 10MB each). Each ZIP should contain one student's code submission. |
Success Response
HTTP Status: 200 OK
{
"success": true,
"message": "Batch upload completed",
"uploaded": [
"student1_submission.zip",
"student2_submission.zip",
"student3_submission.zip"
],
"uploaded_count": 3,
"failed_count": 1,
"failed_uploads": [
{
"filename": "invalid_file.txt",
"error": "File must be a ZIP archive"
}
],
"check": {
"id": 2810,
"name": "Python Assignment - Week 5",
"total_submissions": 28
}
}
Response Fields
- success — Boolean indicating the batch upload completed (even if some files failed)
- uploaded — Array of filenames that were successfully uploaded
- uploaded_count — Number of successfully uploaded files
- failed_count — Number of files that failed to upload
- failed_uploads — Array of objects describing each failed upload with filename and error reason
- check — Updated check information including total submission count
Error Responses
Invalid or missing API key.
Check not found or does not belong to your account.
No files provided, files exceed size limits, or more than 50 files in a single request.
Cannot upload to a check that is currently being processed.
Code Examples
cURL
curl -X POST "https://codequiry.com/api/v1/check/upload-batch" \
-H "apikey: YOUR_API_KEY_HERE" \
-F "check_id=2810" \
-F "files[][email protected]" \
-F "files[][email protected]" \
-F "files[][email protected]"
JavaScript
async function batchUpload(checkId, files) {
const formData = new FormData();
formData.append('check_id', checkId);
files.forEach(file => {
formData.append('files[]', file);
});
const response = await fetch('https://codequiry.com/api/v1/check/upload-batch', {
method: 'POST',
headers: { 'apikey': 'YOUR_API_KEY_HERE' },
body: formData
});
const data = await response.json();
if (data.success) {
console.log(`Uploaded: ${data.uploaded_count} files`);
if (data.failed_count > 0) {
console.warn(`Failed: ${data.failed_count} files`);
data.failed_uploads.forEach(f => {
console.warn(` ${f.filename}: ${f.error}`);
});
}
}
return data;
}
// Usage with file input
const fileInput = document.querySelector('input[type="file"]');
await batchUpload(2810, Array.from(fileInput.files));
Python
import requests
import os
import glob
def batch_upload(check_id, file_paths, api_key):
"""Upload multiple ZIP files to a check."""
files = []
for path in file_paths:
filename = os.path.basename(path)
files.append(('files[]', (filename, open(path, 'rb'), 'application/zip')))
response = requests.post(
'https://codequiry.com/api/v1/check/upload-batch',
headers={'apikey': api_key},
data={'check_id': check_id},
files=files
)
data = response.json()
print(f"Uploaded: {data['uploaded_count']}, Failed: {data['failed_count']}")
return data
# Upload all ZIP files from a directory
zip_files = glob.glob('/path/to/submissions/*.zip')
result = batch_upload(2810, zip_files, 'YOUR_API_KEY_HERE')
Best Practices
One Student Per ZIP
Each ZIP file should contain one student's submission. Name ZIPs descriptively (e.g., john_doe.zip).
Batch for Speed
Use batch upload instead of individual uploads when you have more than 2 files. It's significantly faster.
Handle Partial Failures
Check failed_uploads in the response and retry failed files individually if needed.
Optimize File Sizes
Keep each ZIP under 10MB. Remove unnecessary files (node_modules, .git, etc.) before zipping.