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!
AI DETECTION RESULTS API

Get AI Detection Results

Retrieve detailed AI-generated code detection results for an assignment. Identifies code that may have been generated by AI tools like ChatGPT, GitHub Copilot, or Claude, with per-file analysis and risk levels.

API Endpoint

POST https://codequiry.com/api/v1/ai-results
GET https://codequiry.com/api/v1/ai-results
Both POST and GET are accepted and behave identically. Pass assignment_id as a body field (POST) or query string parameter (GET).

Authentication

Include your API key in the request header:

apikey: YOUR_API_KEY_HERE

Request Parameters

Parameter Type Required Description
assignment_id Integer Required The check/assignment ID to retrieve AI detection results for

Success Response

HTTP Status: 200 OK

{
    "success": true,
    "assignment_id": 2810,
    "assignment_name": "Python Assignment - Week 5",
    "assignment_status": 4,
    "statistics": {
        "total_submissions": 25,
        "submissions_with_ai_detection": 25,
        "submissions_with_code_quality": 25,
        "avg_ai_detection": 22.3,
        "avg_code_quality": 78.4,
        "high_ai_risk_count": 3,
        "medium_ai_risk_count": 5,
        "low_ai_risk_count": 17
    },
    "submissions": [
        {
            "submission_id": 45001,
            "filename": "student1_solution",
            "status": "Completed",
            "status_id": 4,
            "plagiarism_score": {
                "local": 12.3,
                "web": 40.0,
                "total": 52.3
            },
            "matches": {
                "local": 2,
                "web": 5
            },
            "ai_detection": {
                "total_files": 4,
                "avg_ai_probability": 72.5,
                "max_ai_probability": 85.2,
                "min_ai_probability": 45.8,
                "risk_level": "high",
                "files": [
                    {
                        "id": 991,
                        "file_path": "main.py",
                        "ai_probability": 85.2,
                        "human_probability": 14.8,
                        "classification": "ai_generated",
                        "confidence": 0.92,
                        "summary": "Strong indicators of AI-generated code.",
                        "detailed_report": "...",
                        "created_at": "2024-09-15T12:30:00.000000Z"
                    }
                ]
            },
            "ai_code_quality": {
                "total_files": 4,
                "avg_score": 82.5,
                "max_score": 90.0,
                "min_score": 72.0,
                "files": [
                    {
                        "id": 771,
                        "file_path": "main.py",
                        "score": 82.5,
                        "level": "good",
                        "total_lines": 120,
                        "comment_density": 0.18,
                        "entropy": 4.21,
                        "issues": "...",
                        "created_at": "2024-09-15T12:30:00.000000Z"
                    }
                ]
            },
            "file_size": 24576,
            "created_at": "2024-09-15T12:25:00.000000Z",
            "updated_at": "2024-09-15T12:30:00.000000Z"
        }
    ]
}
        
JSON Response
Response Fields
  • assignment_status — The assignment's numeric status ID (e.g. 4 = Completed)
  • statistics — Aggregate AI detection and code-quality statistics for the entire assignment
  • statistics.submissions_with_ai_detection — Count of submissions that have AI detection results
  • statistics.submissions_with_code_quality — Count of submissions that have code-quality results
  • statistics.avg_ai_detection — Average AI probability across all submissions (%)
  • statistics.avg_code_quality — Average code-quality score across all submissions
  • statistics.high_ai_risk_count — Submissions with avg AI probability >= 70%
  • statistics.medium_ai_risk_count — Submissions with avg AI probability 45-69%
  • statistics.low_ai_risk_count — Submissions with avg AI probability < 45%
  • submissions[].status / status_id — Submission processing status (text and numeric ID)
  • submissions[].plagiarism_score — Object with local, web, and total similarity scores
  • submissions[].matches — Object with local and web match counts
  • submissions[].ai_detection — Per-submission AI detection breakdown (null when no AI results exist)
  • submissions[].ai_detection.avg_ai_probability / max_ai_probability / min_ai_probability — AI probability stats across the submission's files (%)
  • submissions[].ai_detection.risk_level — Overall risk classification: high, medium, or low
  • submissions[].ai_detection.files[] — Per-file AI detection analysis
  • files[].file_path — Path of the analyzed file
  • files[].ai_probability / human_probability — Probability the file is AI- / human-written (0-100%)
  • files[].classification — Model classification label
  • files[].confidence — Confidence score of the AI detection model
  • files[].summary / detailed_report — Narrative explanation of the detection result
  • submissions[].ai_code_quality — Per-submission code-quality breakdown (null when no results exist) with total_files, avg_score, max_score, min_score, and per-file score, level, total_lines, comment_density, entropy, and issues
No submissions yet? If the assignment has no submissions, the endpoint still returns 200 OK with "success": true, a "message": "No submissions found for this assignment", and an empty submissions array.

Understanding AI Risk Levels

High Risk (>= 70%)

Strong indicators of AI-generated code. The submission shows patterns highly consistent with AI output such as uniform formatting, templated structures, and characteristic comment styles.

Medium Risk (45-69%)

Some indicators of AI assistance. The code may have been partially generated or heavily influenced by AI tools. Manual review recommended.

Low Risk (< 45%)

Minimal AI indicators detected. The code appears to be primarily human-written with natural coding patterns and style variations.

Important: AI detection scores should be used as guidance, not as definitive proof. Always combine AI detection with human review and consider the context of the assignment before making academic integrity decisions.

Error Responses

401 Unauthorized

Invalid or missing API key.

422 Validation Error

Missing or invalid assignment_id (must be an integer >= 1).

404 Not Found

Assignment not found or does not belong to your account.

Code Examples

cURL
curl -X POST "https://codequiry.com/api/v1/ai-results" \
  -H "apikey: YOUR_API_KEY_HERE" \
  -d "assignment_id=2810"
        
cURL
JavaScript
const response = await fetch('https://codequiry.com/api/v1/ai-results', {
    method: 'POST',
    headers: {
        'apikey': 'YOUR_API_KEY_HERE',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({ assignment_id: 2810 })
});

const data = await response.json();

if (data.success) {
    console.log(`AI Detection Stats:`);
    console.log(`  High risk: ${data.statistics.high_ai_risk_count}`);
    console.log(`  Medium risk: ${data.statistics.medium_ai_risk_count}`);
    console.log(`  Low risk: ${data.statistics.low_ai_risk_count}`);

    // Flag high-risk submissions
    const highRisk = data.submissions.filter(
        s => s.ai_detection.risk_level === 'high'
    );

    highRisk.forEach(s => {
        console.log(`\nFlagged: ${s.filename}`);
        console.log(`  AI Probability: ${s.ai_detection.avg_ai_probability}%`);
        s.ai_detection.files.forEach(f => {
            console.log(`  ${f.filename}: ${f.ai_probability}% - ${f.indicators.join(', ')}`);
        });
    });
}
        
JavaScript
Python
import requests

response = requests.post(
    'https://codequiry.com/api/v1/ai-results',
    headers={'apikey': 'YOUR_API_KEY_HERE'},
    data={'assignment_id': 2810}
)

data = response.json()

if data['success']:
    stats = data['statistics']
    print(f"Total submissions: {stats['total_submissions']}")
    print(f"High AI risk: {stats['high_ai_risk_count']}")
    print(f"Medium AI risk: {stats['medium_ai_risk_count']}")
    print(f"Average AI detection: {stats['avg_ai_detection']}%")

    # Process each submission
    for sub in data['submissions']:
        ai = sub['ai_detection']
        if ai['risk_level'] in ('high', 'medium'):
            print(f"\nFlagged: {sub['filename']} ({ai['risk_level']} risk)")
            for f in ai['files']:
                print(f"  {f['filename']}: {f['ai_probability']}%")
        
Python