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
Field Type Description source_typestring Source of code: paste, upload, github contentstring Code content (for paste/upload) or repository URL analysis_typestring Analysis level: mini, standard, ultra
Field Type Description languagestring Programming language (auto-detected if not provided) titlestring Custom title for the analysis descriptionstring Description or notes about the analysis optionsobject Analysis configuration options
Field Type Description focus_areasarray Specific vulnerability types to focus on compliance_standardsarray Compliance standards to check against exclude_patternsarray File patterns to exclude from analysis include_testsboolean Whether to analyze test files (default: false) max_file_sizeinteger Maximum 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" ]
}
}
{
"error" : {
"code" : "INVALID_REQUEST" ,
"message" : "Invalid analysis request" ,
"details" : {
"field" : "content" ,
"reason" : "Content is required for paste source type"
}
},
"request_id" : "req_1234567890"
}
{
"error" : {
"code" : "INSUFFICIENT_CREDITS" ,
"message" : "Not enough credits to perform analysis" ,
"details" : {
"required_credits" : 8 ,
"available_credits" : 3 ,
"credit_purchase_url" : "https://clipron.com/credits"
}
},
"request_id" : "req_1234567890"
}
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
Pending Analysis
Completed Analysis
Failed Analysis
{
"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
}
{
"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" ,
"credits_used" : 8 ,
"results" : {
"security_score" : 35 ,
"total_vulnerabilities" : 12 ,
"severity_breakdown" : {
"critical" : 2 ,
"high" : 3 ,
"medium" : 4 ,
"low" : 3
},
"vulnerabilities" : [
{
"id" : "vuln_001" ,
"type" : "SQL Injection" ,
"severity" : "critical" ,
"confidence" : 95 ,
"file" : "main.py" ,
"line" : 2 ,
"column" : 12 ,
"description" : "User input is directly concatenated into SQL query without sanitization" ,
"impact" : "Attackers can execute arbitrary SQL commands, potentially accessing or modifying sensitive data" ,
"cwe_id" : "CWE-89" ,
"owasp_category" : "A03:2021 – Injection" ,
"code_snippet" : "query = \" SELECT * FROM users WHERE username = ' \" + username + \" ' \" " ,
"fix_recommendation" : {
"summary" : "Use parameterized queries or prepared statements" ,
"code_example" : "query = \" SELECT * FROM users WHERE username = %s \"\n cursor.execute(query, (username,))" ,
"references" : [
"https://owasp.org/www-community/attacks/SQL_Injection"
]
}
}
],
"compliance_results" : {
"owasp_top_10" : {
"score" : 4 ,
"total_checks" : 10 ,
"passed" : 4 ,
"failed" : 6 ,
"details" : [
{
"category" : "A03:2021 – Injection" ,
"status" : "failed" ,
"issues_found" : 2
}
]
}
},
"code_metrics" : {
"lines_of_code" : 150 ,
"files_analyzed" : 3 ,
"functions_analyzed" : 12 ,
"complexity_score" : 7.2
}
}
}
{
"analysis_id" : "analysis_clp_1234567890abcdef" ,
"status" : "failed" ,
"created_at" : "2024-06-18T10:30:00Z" ,
"failed_at" : "2024-06-18T10:31:15Z" ,
"error" : {
"code" : "ANALYSIS_TIMEOUT" ,
"message" : "Analysis timed out after 5 minutes" ,
"details" : {
"stage" : "ai_analysis" ,
"progress" : 75
}
},
"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
Parameter Type Description Default pageinteger Page number (1-based) 1 limitinteger Items per page (max 100) 20 statusstring Filter by status: pending, completed, failed all source_typestring Filter by source: paste, upload, github all analysis_typestring Filter by type: mini, standard, ultra all languagestring Filter by programming language all created_afterstring ISO 8601 date filter none created_beforestring ISO 8601 date filter none
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
Success (204)
Not Found (404)
{
"error" : {
"code" : "ANALYSIS_NOT_FOUND" ,
"message" : "Analysis not found or access denied"
}
}
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
Parameter Type Description Default formatstring Report format: pdf, json, csv, html json include_codeboolean Include code snippets in report true include_fixesboolean Include fix recommendations true
Analysis Status Codes
Status Description 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
Code HTTP Status Description INVALID_REQUEST400 Request validation failed INSUFFICIENT_CREDITS402 Not enough credits ANALYSIS_NOT_FOUND404 Analysis doesn’t exist ANALYSIS_TIMEOUT408 Analysis timed out RATE_LIMIT_EXCEEDED429 Too many requests INTERNAL_ERROR500 Server error
Performance Tip : Use webhooks to get notified when long-running analyses complete instead of polling the API repeatedly.