Skip to main content

Analysis Endpoints

The Analysis API provides endpoints for creating, managing, and retrieving code security analyses. These endpoints are the core of the Clipron AI platform.

Base URL

All analysis endpoints are available at:
https://clipron.com/api/analysis

Authentication

All analysis endpoints require authentication. Include your access token in the Authorization header:
Authorization: Bearer <your_access_token>

Create Analysis

Create a new code security analysis.
curl -X POST "https://clipron.com/api/analysis" \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "source_type": "paste",
    "content": "def login(username, password):\n    query = \"SELECT * FROM users WHERE username = '\" + username + \"'\"\n    return execute_query(query)",
    "language": "python",
    "analysis_type": "standard",
    "options": {
      "focus_areas": ["sql_injection", "authentication"],
      "compliance_standards": ["owasp_top_10"]
    }
  }'

Request Body

FieldTypeDescription
source_typestringSource of code: paste, upload, github
contentstringCode content (for paste/upload) or repository URL
analysis_typestringAnalysis level: mini, standard, ultra
FieldTypeDescription
languagestringProgramming language (auto-detected if not provided)
titlestringCustom title for the analysis
descriptionstringDescription or notes about the analysis
optionsobjectAnalysis configuration options
FieldTypeDescription
focus_areasarraySpecific vulnerability types to focus on
compliance_standardsarrayCompliance standards to check against
exclude_patternsarrayFile patterns to exclude from analysis
include_testsbooleanWhether to analyze test files (default: false)
max_file_sizeintegerMaximum file size to analyze in bytes

Response

{
  "analysis_id": "analysis_clp_1234567890abcdef",
  "status": "pending",
  "created_at": "2024-06-18T10:30:00Z",
  "estimated_completion": "2024-06-18T10:32:00Z",
  "estimated_cost": 8,
  "source_type": "paste",
  "analysis_type": "standard",
  "language": "python",
  "title": "Python Security Analysis",
  "options": {
    "focus_areas": ["sql_injection", "authentication"],
    "compliance_standards": ["owasp_top_10"]
  }
}

Get Analysis

Retrieve a specific analysis by ID.
curl -X GET "https://clipron.com/api/analysis/analysis_clp_1234567890abcdef" \
  -H "Authorization: Bearer <access_token>"

Response

{
  "analysis_id": "analysis_clp_1234567890abcdef",
  "status": "pending",
  "progress": 45,
  "current_stage": "ai_analysis",
  "created_at": "2024-06-18T10:30:00Z",
  "estimated_completion": "2024-06-18T10:32:00Z",
  "source_type": "paste",
  "analysis_type": "standard",
  "language": "python",
  "credits_used": 0
}

List Analyses

Get a paginated list of user’s analyses.
curl -X GET "https://clipron.com/api/analysis?page=1&limit=20&status=completed" \
  -H "Authorization: Bearer <access_token>"

Query Parameters

ParameterTypeDescriptionDefault
pageintegerPage number (1-based)1
limitintegerItems per page (max 100)20
statusstringFilter by status: pending, completed, failedall
source_typestringFilter by source: paste, upload, githuball
analysis_typestringFilter by type: mini, standard, ultraall
languagestringFilter by programming languageall
created_afterstringISO 8601 date filternone
created_beforestringISO 8601 date filternone

Response

{
  "analyses": [
    {
      "analysis_id": "analysis_clp_1234567890abcdef",
      "status": "completed",
      "created_at": "2024-06-18T10:30:00Z",
      "completed_at": "2024-06-18T10:31:45Z",
      "source_type": "paste",
      "analysis_type": "standard",
      "language": "python",
      "title": "Python Security Analysis",
      "security_score": 35,
      "total_vulnerabilities": 12,
      "credits_used": 8
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total_items": 156,
    "total_pages": 8,
    "has_next": true,
    "has_previous": false
  }
}

Delete Analysis

Delete a specific analysis.
curl -X DELETE "https://clipron.com/api/analysis/analysis_clp_1234567890abcdef" \
  -H "Authorization: Bearer <access_token>"

Response

HTTP/1.1 204 No Content

Download Report

Download analysis report in various formats.
# Download PDF report
curl -X GET "https://clipron.com/api/analysis/analysis_clp_1234567890abcdef/report?format=pdf" \
  -H "Authorization: Bearer <access_token>" \
  -o "security_report.pdf"

# Download JSON report
curl -X GET "https://clipron.com/api/analysis/analysis_clp_1234567890abcdef/report?format=json" \
  -H "Authorization: Bearer <access_token>" \
  -o "security_report.json"

Query Parameters

ParameterTypeDescriptionDefault
formatstringReport format: pdf, json, csv, htmljson
include_codebooleanInclude code snippets in reporttrue
include_fixesbooleanInclude fix recommendationstrue

Analysis Status Codes

StatusDescription
pendingAnalysis is queued or in progress
preprocessingCode is being preprocessed
ai_analysisAI models are analyzing the code
post_processingResults are being processed and formatted
completedAnalysis completed successfully
failedAnalysis failed due to an error
cancelledAnalysis was cancelled by user

Error Codes

CodeHTTP StatusDescription
INVALID_REQUEST400Request validation failed
INSUFFICIENT_CREDITS402Not enough credits
ANALYSIS_NOT_FOUND404Analysis doesn’t exist
ANALYSIS_TIMEOUT408Analysis timed out
RATE_LIMIT_EXCEEDED429Too many requests
INTERNAL_ERROR500Server error
Performance Tip: Use webhooks to get notified when long-running analyses complete instead of polling the API repeatedly.