Our AI detection models just got upgraded. They now catch ChatGPT and Claude in student code more accurately than ever. See what's new
Developer API

Code Plagiarism
Detection API

Build plagiarism detection into your apps. Check code against 20+ billion sources.

const response = await fetch('https://codequiry.com/api/v1/check', { method: 'POST', headers: { 'apikey': 'YOUR_API_KEY' }, body: formData }); // Check created!
BATCH UPLOAD API

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

POST https://codequiry.com/api/v1/check/upload-batch
Performance Tip: Batch upload is significantly faster than making individual upload requests. Use it whenever you have more than 2 files to upload.

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.
File Requirements: Each file must be a ZIP archive containing source code files. Maximum 50 files per request, 10MB per file.

Success Response

HTTP Status: 200 OK

{
    "success": true,
    "message": "Uploaded 3 file(s) successfully",
    "uploaded": [
        {
            "id": 45001,
            "filename": "student1_submission",
            "file_size": 24576,
            "status_id": 2
        },
        {
            "id": 45002,
            "filename": "student2_submission",
            "file_size": 18432,
            "status_id": 2
        },
        {
            "id": 45003,
            "filename": "student3_submission",
            "file_size": 20480,
            "status_id": 2
        }
    ],
    "uploaded_count": 3,
    "failed_count": 1,
    "failed_uploads": [
        {
            "file": "invalid_file.zip",
            "error": "Invalid or corrupted file"
        }
    ],
    "check": {
        "id": 2810,
        "name": "Python Assignment - Week 5",
        "status_id": 2,
        "course_id": 512,
        "created_at": "2024-01-15 14:30:22",
        "updated_at": "2024-01-15 14:35:10"
    }
}
        
JSON Response
Response Fields
  • success — Boolean indicating the batch upload completed (even if some files failed)
  • message — Confirmation message ("Uploaded {n} file(s) successfully")
  • uploaded — Array of objects for each successfully created submission, each with id, filename (with the .zip extension stripped), file_size (bytes), and status_id
  • 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, each with file (the original filename) and error (reason)
  • check — The full updated check (assignment) object as stored, including id, name, status_id, timestamps, and all other model attributes

Error Responses

401 Unauthorized

Invalid or missing API key.

403 Forbidden

Attempting to upload to a demo assignment ("Demo assignments are read-only.").

422 Unprocessable Entity

Validation failure: check_id missing or not an integer; no files supplied; more than 50 files; or any file over 10MB or not a ZIP (mimes:zip). The response includes a validation_errors object. Also returned when the check is not found / not yours ("Invalid check_id provided.") or no API Checks folder exists.

500 Internal Server Error

An unexpected failure occurred during the batch ("Batch upload failed"). Note: individual files that fail are reported per-file in failed_uploads with a 200 response, not a 500.

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]"
        
cURL
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.file}: ${f.error}`);
            });
        }
    }

    return data;
}

// Usage with file input
const fileInput = document.querySelector('input[type="file"]');
await batchUpload(2810, Array.from(fileInput.files));
        
JavaScript
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')
        
Python

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.