Documentation
PolicyCortex Scans API: Trigger, Retrieve & Schedule Cloud Scans
The Scans API provides comprehensive cloud resource scanning capabilities for compliance monitoring, security assessment, and governance enforcement. Trigger on-demand scans, schedule automated assessments, and retrieve detailed scan results with actionable insights.
Scans API Documentation & Quick Start Guide
API Overview
🔍 Resource Discovery
Automated discovery and inventory of cloud resources across AWS, Azure, GCP, and hybrid environments.
🛡️ Compliance Assessment
Comprehensive compliance evaluation against SOC2, HIPAA, ISO27001, and custom frameworks.
⚡ Automated Scheduling
Flexible scheduling with cron expressions, resource-specific triggers, and event-driven scanning.
Scan Types and Capabilities
Scan Types
Compliance Frameworks
List Scans
/v1/scansRetrieve a list of scans with filtering by status, environment, scan type, and time range. Results include scan metadata, progress information, and summary statistics.
curl -X GET "https://api.policycortex.com/v1/scans?limit=20&status=completed&environment=production&scan_type=full" \
-H "Authorization: Bearer sk_live_1234567890abcdef" \
-H "Content-Type: application/json"Query Parameters
Response Example
{
"scans": [
{
"id": "scan_1234567890abcdef",
"name": "Production Full Compliance Scan",
"scan_type": "full",
"status": "completed",
"environment": "production",
"cloud_providers": ["aws", "azure"],
"frameworks": ["soc2", "hipaa"],
"started_at": "2024-01-21T08:00:00Z",
"completed_at": "2024-01-21T08:45:00Z",
"duration": "45m32s",
"results_summary": {
"compliance_score": 94.7,
"total_violations": 127,
"critical_violations": 8,
"high_violations": 23,
"resources_scanned": 15432
}
}
],
"pagination": {
"total": 1247,
"limit": 20,
"offset": 0,
"has_more": true
}
}Get Scan Details
/v1/scans/:scan_idRetrieve detailed information about a specific scan, including real-time progress, detailed results, violation breakdowns, and remediation recommendations.
curl -X GET "https://api.policycortex.com/v1/scans/scan_1234567890abcdef" \
-H "Authorization: Bearer sk_live_1234567890abcdef" \
-H "Content-Type: application/json"Response Example
{
"id": "scan_1234567890abcdef",
"name": "Production Full Compliance Scan",
"scan_type": "full",
"status": "completed",
"environment": "production",
"started_at": "2024-01-21T08:00:00Z",
"completed_at": "2024-01-21T08:45:00Z",
"duration": "45m32s",
"progress": {
"total_resources": 15432,
"scanned_resources": 15432,
"percentage": 100
},
"results": {
"compliance_score": 94.7,
"previous_score": 93.2,
"total_violations": 127,
"new_violations": 15,
"resolved_violations": 23,
"violation_breakdown": {
"critical": 8,
"high": 23,
"medium": 54,
"low": 42
}
},
"remediation": {
"auto_remediated": 45,
"manual_required": 82,
"estimated_effort": "14.5h"
}
}Trigger Scan
/v1/scansTrigger a new compliance scan with customizable scope, policies, and execution parameters. Supports both immediate execution and scheduled future scans.
curl -X POST "https://api.policycortex.com/v1/scans" \
-H "Authorization: Bearer sk_live_1234567890abcdef" \
-H "Content-Type: application/json" \
-d '{
"name": "Emergency Security Audit",
"scan_type": "policy_specific",
"environment": "production",
"cloud_providers": ["aws"],
"frameworks": ["soc2"],
"scope": {
"include_policies": ["pol_encryption", "pol_access_control"],
"include_resources": ["arn:aws:s3:::*"],
"exclude_resources": ["arn:aws:s3:::test-*"]
},
"execution": {
"immediate": true,
"parallel_execution": true,
"timeout": "1h"
},
"notifications": {
"on_completion": true,
"channels": ["email", "slack"]
}
}'Required Fields
- name: Descriptive scan name
- scan_type: Type of scan to perform
- environment: Target environment
- cloud_providers: Providers to scan
Optional Fields
- frameworks: Compliance frameworks
- scope: Resource and policy filters
- execution: Runtime parameters
- notifications: Alert preferences
Response Example
{
"id": "scan_abcdef1234567890",
"name": "Emergency Security Audit",
"scan_type": "policy_specific",
"status": "pending",
"environment": "production",
"created_at": "2024-01-21T14:30:00Z",
"estimated_duration": "25m",
"estimated_resources": 3456,
"queue_position": 2,
"monitoring": {
"progress_url": "https://api.policycortex.com/v1/scans/scan_abcdef1234567890",
"websocket_url": "wss://api.policycortex.com/v1/scans/scan_abcdef1234567890/stream"
}
}Cancel Scan
/v1/scans/:scan_idCancel a running or queued scan. Running scans will be gracefully stopped, preserving partial results. Queued scans will be removed from the execution queue.
curl -X DELETE "https://api.policycortex.com/v1/scans/scan_1234567890abcdef" \
-H "Authorization: Bearer sk_live_1234567890abcdef" \
-H "Content-Type: application/json"Response Example
{
"id": "scan_1234567890abcdef",
"status": "cancelled",
"cancelled_at": "2024-01-21T14:45:00Z",
"partial_results": {
"resources_scanned": 2847,
"total_resources": 5432,
"completion_percentage": 52.4,
"violations_found": 23,
"data_available": true
}
}Scan Schedules
/v1/scans/schedulesCreate automated scan schedules with flexible cron expressions, custom triggers, and environment-specific configurations.
curl -X POST "https://api.policycortex.com/v1/scans/schedules" \
-H "Authorization: Bearer sk_live_1234567890abcdef" \
-H "Content-Type: application/json" \
-d '{
"name": "Weekly Production Compliance Scan",
"description": "Comprehensive compliance assessment every Sunday",
"schedule": {
"cron": "0 6 * * 0",
"timezone": "UTC"
},
"scan_config": {
"scan_type": "full",
"environment": "production",
"cloud_providers": ["aws", "azure", "gcp"],
"frameworks": ["soc2", "hipaa", "iso27001"]
},
"notifications": {
"on_completion": true,
"on_failure": true,
"channels": ["email", "slack"]
},
"enabled": true
}'📅 Schedule Examples
⚡ Trigger Options
- • Cron Schedule - Time-based execution
- • Resource Changes - Event-driven triggers
- • Policy Updates - Automatic re-evaluation
- • Compliance Drift - Score-based triggers
- • Manual Trigger - On-demand execution
- • API Webhooks - External system triggers
Error Responses
400 Bad Request
Invalid scan configuration{
"error": "invalid_scan_config",
"error_description": "Scan configuration validation failed",
"error_code": "SCAN_001",
"details": [
{
"field": "cloud_providers",
"message": "At least one cloud provider must be specified"
}
],
"timestamp": "2024-01-21T15:00:00Z"
}429 Rate Limited
Too many concurrent scans{
"error": "scan_limit_exceeded",
"error_description": "Maximum concurrent scans exceeded",
"error_code": "SCAN_002",
"current_scans": 10,
"max_concurrent": 10,
"queue_position": 5,
"estimated_wait_time": "15m",
"retry_after": 900,
"timestamp": "2024-01-21T15:00:00Z"
}