CodeGuardian AI API Reference

Complete REST API Documentation

Base URL

https://api.codeguardian.lovelogicai.com/v1

Production Ready

Enterprise-grade API with 99.9% uptime SLA

High Performance

Sub-second response times with global CDN

Unlimited Scale

Process files of any size with adaptive processing

Authentication

API Key Authentication

CodeGuardian AI uses API keys for authentication. Include your API key in the Authorization header using the Bearer token format.

Request Header

Authorization: Bearer YOUR_API_KEY

cURL Example

curl -H "Authorization: Bearer sk-proj-abc123..." \
     https://api.codeguardian.lovelogicai.com/v1/scan

Getting Your API Key

Generate API keys from your dashboard at CodeGuardian AI Platform. Store keys securely and rotate them regularly.

File Processing APIs

POST

/v1/scan

Basic file upload and security scan

Upload and analyze files up to 500MB using our basic scanning agents. Supports common archive formats and returns comprehensive security findings.

Request Parameters

file required

File to analyze (multipart/form-data). Max size: 500MB

engines optional

Comma-separated list: security,dependency,secrets,sbom

format optional

Output format: json, sarif, cyclonedx (default: json)

webhook optional

Webhook URL for async result delivery

Example Request

curl -X POST https://api.codeguardian.lovelogicai.com/v1/scan \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F "file=@./codebase.tar.gz" \
  -F "engines=security,dependency,secrets" \
  -F "format=sarif" \
  -F "webhook=https://your-webhook.com/results"

Response Example

{
  "scan_id": "scan_abc123def456",
  "status": "processing",
  "created_at": "2025-01-16T10:30:00Z",
  "estimated_completion": "2025-01-16T10:32:30Z",
  "agents": ["security", "dependency", "secrets"],
  "webhook_url": "https://your-webhook.com/results"
}
POST

/v1/scan/unlimited

PREMIUM
Unlimited file processing with all engines

Process files of unlimited size and any type using our revolutionary Universal Processor. Supports streaming upload, resume capability, and all 7 specialized processing engines.

Advanced Parameters

chunk_size optional

Chunk size for streaming upload (default: 64MB)

enable_resume optional

Enable upload resume capability (default: true)

processing_strategy optional

Processing strategy: adaptive, performance, memory_optimized

JavaScript SDK Example

import { CodeGuardianAPI } from '@lovelogicai/codeguardian';

const client = new CodeGuardianAPI({
  apiKey: 'YOUR_API_KEY'
});

const result = await client.scan.unlimited({
  file: fileBlob,
  engines: 'all',
  chunkSize: '128MB',
  enableResume: true,
  onProgress: (progress) => {
    console.log(`Upload: ${progress.percent}%`);
  }
});

Scan Management

GET

/v1/scan/{scan_id}/status

Get real-time status updates for a running scan, including progress, active agents, and ETA.

Response Fields

status pending, processing, completed, failed
progress 0-100 percentage complete
active_agents Currently running agent names
eta Estimated completion time

Example Response

{
  "scan_id": "scan_abc123def456",
  "status": "processing",
  "progress": 65,
  "active_agents": [
    "Security Auditor",
    "Dependency Agent"
  ],
  "completed_agents": [
    "Manager Agent",
    "Secrets Hunter"
  ],
  "eta": "2025-01-16T10:31:45Z",
  "files_processed": 42,
  "total_files": 65,
  "current_phase": "vulnerability_scanning"
}
GET

/v1/scan/{scan_id}/results

Retrieve comprehensive scan results including all findings, SARIF export, and SBOM data.

{
  "scan_id": "scan_abc123def456",
  "status": "completed",
  "completed_at": "2025-01-16T10:32:15Z",
  "summary": {
    "total_vulnerabilities": 12,
    "critical": 2,
    "high": 4,
    "medium": 5,
    "low": 1,
    "secrets_found": 3,
    "dependencies_analyzed": 156,
    "vulnerable_dependencies": 8
  },
  "findings": [
    {
      "id": "SEC-001",
      "severity": "HIGH",
      "type": "SQL Injection",
      "file": "src/auth/login.py",
      "line": 42,
      "description": "Unsanitized user input in database query",
      "cwe": "CWE-89",
      "agent": "Security Auditor"
    }
  ],
  "agents": {
    "security_auditor": {
      "files_scanned": 47,
      "vulnerabilities_found": 12,
      "processing_time": "23.4s"
    }
  }
}

Agent Management

GET

/v1/agents

List all available agents with their current status, capabilities, and performance metrics.

{
  "agents": [
    {
      "name": "Manager Agent",
      "status": "active",
      "role": "orchestrator",
      "capabilities": ["task_delegation", "state_management"],
      "performance": {
        "tasks_completed": 1247,
        "avg_processing_time": "0.3s",
        "success_rate": "99.8%"
      }
    },
    {
      "name": "Security Auditor",
      "status": "active",
      "role": "security_analysis",
      "tools": ["semgrep", "codeql", "pattern_matching"],
      "performance": {
        "files_scanned": 15420,
        "vulnerabilities_found": 892,
        "false_positive_rate": "12%"
      }
    }
  ]
}

Rate Limiting

CodeGuardian AI implements intelligent rate limiting based on your plan tier and resource usage. Rate limit headers are included in all API responses.

Rate Limit Headers

X-RateLimit-Limit Requests per hour limit
X-RateLimit-Remaining Remaining requests
X-RateLimit-Reset Reset time (Unix timestamp)
X-RateLimit-Retry-After Retry after seconds (when limited)

Plan Limits

Basic 100 requests/hour
Pro 1,000 requests/hour
Enterprise Custom limits