Security
Security API Reference
Complete API reference for NeuronEdge security features: guardrail rules, presets, security events, and red team scanning.
Authentication
All endpoints require an Authorization header with a valid API key:
Authorization: Bearer <api-key>
Security endpoints require Professional tier or above.
Guardrail Rules
/api/security/rulesList all guardrail rules. Supports filtering by category, action, and pagination.
Request Body
curl -X GET "https://api.neuronedge.ai/api/security/rules?category=prompt_injection&limit=20" \
-H "Authorization: Bearer <api-key>"
# Response
{
"rules": [
{
"id": "rule_abc123",
"name": "Block SQL Injection Attempts",
"category": "prompt_injection",
"pattern": "(?i)(union|select|insert|drop|delete)\\s+(from|into|table)",
"action": "block",
"description": "Detects common SQL injection patterns",
"priority": 100,
"enabled": true,
"created_at": "2026-03-01T10:00:00Z"
}
],
"total": 42,
"limit": 20,
"offset": 0
}/api/security/rulesCreate a custom guardrail rule with specified pattern, category, and action.
Request Body
curl -X POST "https://api.neuronedge.ai/api/security/rules" \
-H "Authorization: Bearer <api-key>" \
-H "Content-Type: application/json" \
-d '{
"name": "Block Credit Card Numbers",
"category": "pii_leakage",
"pattern": "\\b\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}\\b",
"action": "redact",
"description": "Detects and redacts credit card numbers",
"priority": 90
}'
# Response
{
"id": "rule_xyz789",
"name": "Block Credit Card Numbers",
"category": "pii_leakage",
"pattern": "\\b\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}\\b",
"action": "redact",
"description": "Detects and redacts credit card numbers",
"priority": 90,
"enabled": true,
"created_at": "2026-03-10T14:30:00Z"
}/api/security/rules/:idRetrieve details for a specific guardrail rule, including match statistics.
Request Body
curl -X GET "https://api.neuronedge.ai/api/security/rules/rule_abc123" \
-H "Authorization: Bearer <api-key>"
# Response
{
"id": "rule_abc123",
"name": "Block SQL Injection Attempts",
"category": "prompt_injection",
"pattern": "(?i)(union|select|insert|drop|delete)\\s+(from|into|table)",
"action": "block",
"description": "Detects common SQL injection patterns",
"priority": 100,
"enabled": true,
"created_at": "2026-03-01T10:00:00Z",
"updated_at": "2026-03-05T08:15:00Z",
"match_count": 1247
}/api/security/rules/:idUpdate an existing rule. Supports partial updates of any field.
Request Body
curl -X PATCH "https://api.neuronedge.ai/api/security/rules/rule_abc123" \
-H "Authorization: Bearer <api-key>" \
-H "Content-Type: application/json" \
-d '{
"enabled": false,
"priority": 80
}'
# Response
{
"id": "rule_abc123",
"name": "Block SQL Injection Attempts",
"enabled": false,
"priority": 80,
"updated_at": "2026-03-10T14:35:00Z"
}/api/security/rules/:idDelete a guardrail rule permanently.
Request Body
curl -X DELETE "https://api.neuronedge.ai/api/security/rules/rule_abc123" \
-H "Authorization: Bearer <api-key>"
# Response
{
"deleted": true,
"id": "rule_abc123"
}/api/security/rules/:id/testTest a rule against sample input to validate pattern matching before deployment.
Request Body
curl -X POST "https://api.neuronedge.ai/api/security/rules/rule_abc123/test" \
-H "Authorization: Bearer <api-key>" \
-H "Content-Type: application/json" \
-d '{
"input": "SELECT * FROM users WHERE id = 1 UNION SELECT password FROM admin"
}'
# Response
{
"matched": true,
"category": "prompt_injection",
"action": "block",
"confidence": 0.95,
"matched_pattern": "(?i)(union|select|insert|drop|delete)\\s+(from|into|table)"
}Guardrail Presets
/api/security/presetsList available rule presets (OWASP LLM Top 10, PII compliance, etc.).
Request Body
curl -X GET "https://api.neuronedge.ai/api/security/presets" \
-H "Authorization: Bearer <api-key>"
# Response
{
"presets": [
{
"id": "preset_owasp_llm",
"name": "OWASP LLM Top 10",
"description": "Comprehensive protection against OWASP LLM Top 10 vulnerabilities",
"categories": [
"prompt_injection",
"data_leakage",
"model_denial",
"supply_chain"
],
"rule_count": 87
},
{
"id": "preset_pii_compliance",
"name": "PII Compliance",
"description": "GDPR and CCPA compliant PII detection and redaction",
"categories": ["pii_leakage"],
"rule_count": 42
}
]
}/api/security/from-presetApply a preset to a policy, creating all associated rules.
Request Body
curl -X POST "https://api.neuronedge.ai/api/security/from-preset" \
-H "Authorization: Bearer <api-key>" \
-H "Content-Type: application/json" \
-d '{
"preset_id": "preset_owasp_llm",
"policy_id": "pol_production"
}'
# Response
{
"rules_created": 87,
"policy_updated": true,
"preset_id": "preset_owasp_llm",
"policy_id": "pol_production"
}Security Events
/api/security/eventsList security events with filtering by type, category, severity, action, and time range.
curl -X GET "https://api.neuronedge.ai/api/security/events?severity=high&limit=10" \
-H "Authorization: Bearer <api-key>"
# Response
{
"events": [
{
"id": "evt_abc123",
"type": "guardrail_triggered",
"category": "prompt_injection",
"severity": "high",
"action": "block",
"rule_id": "rule_abc123",
"request_id": "01JKX8G7M2PQRSTUVWXYZ12345",
"timestamp": "2026-03-10T14:25:30Z",
"metadata": {
"matched_pattern": "SQL injection attempt",
"customer_id": "cust_xyz789"
}
}
],
"total": 1247,
"limit": 10,
"offset": 0
}/api/security/events/statsAggregate statistics for security events over a specified period.
curl -X GET "https://api.neuronedge.ai/api/security/events/stats?from=2026-03-01&to=2026-03-10" \
-H "Authorization: Bearer <api-key>"
# Response
{
"period": {
"from": "2026-03-01T00:00:00Z",
"to": "2026-03-10T23:59:59Z"
},
"total_events": 5432,
"by_category": {
"prompt_injection": 2100,
"pii_leakage": 1800,
"data_leakage": 892,
"jailbreak": 640
},
"by_action": {
"block": 3200,
"redact": 1800,
"flag": 432
},
"by_severity": {
"critical": 120,
"high": 890,
"medium": 2400,
"low": 2022
}
}/api/security/events/timelineEvent counts over time with configurable interval (hour or day).
curl -X GET "https://api.neuronedge.ai/api/security/events/timeline?interval=day&from=2026-03-01&to=2026-03-10" \
-H "Authorization: Bearer <api-key>"
# Response
{
"interval": "day",
"data": [
{
"timestamp": "2026-03-01T00:00:00Z",
"count": 542
},
{
"timestamp": "2026-03-02T00:00:00Z",
"count": 678
},
{
"timestamp": "2026-03-03T00:00:00Z",
"count": 590
}
]
}/api/security/events/top-patternsMost frequently triggered attack patterns across all events.
curl -X GET "https://api.neuronedge.ai/api/security/events/top-patterns?limit=5" \
-H "Authorization: Bearer <api-key>"
# Response
{
"patterns": [
{
"pattern": "SQL injection via UNION",
"category": "prompt_injection",
"count": 1247,
"percentage": 22.96
},
{
"pattern": "SSN leakage",
"category": "pii_leakage",
"count": 890,
"percentage": 16.38
},
{
"pattern": "Jailbreak via role-play",
"category": "jailbreak",
"count": 640,
"percentage": 11.78
}
],
"total_events": 5432
}/api/security/events/postureOverall security posture score (0-100) with contributing factors and recommendations.
curl -X GET "https://api.neuronedge.ai/api/security/events/posture?from=2026-03-01&to=2026-03-10" \
-H "Authorization: Bearer <api-key>"
# Response
{
"score": 87,
"grade": "B+",
"factors": {
"coverage": 92,
"response_effectiveness": 88,
"incident_rate": 82,
"policy_completeness": 85
},
"recommendations": [
"Enable response-side PII detection for critical workflows",
"Review and update jailbreak rules based on recent patterns"
],
"period": {
"from": "2026-03-01T00:00:00Z",
"to": "2026-03-10T23:59:59Z"
}
}Red Team Scanning
/api/security/red-team/scanStart a red team scan with specified intensity and target policy.
curl -X POST "https://api.neuronedge.ai/api/security/red-team/scan" \
-H "Authorization: Bearer <api-key>" \
-H "Content-Type: application/json" \
-d '{
"intensity": "comprehensive",
"target_policy_id": "pol_production",
"categories": ["prompt_injection", "jailbreak", "pii_leakage"]
}'
# Response
{
"scan_id": "scan_abc123",
"status": "running",
"intensity": "comprehensive",
"target_policy_id": "pol_production",
"categories": ["prompt_injection", "jailbreak", "pii_leakage"],
"estimated_duration_minutes": 15,
"started_at": "2026-03-10T14:40:00Z"
}/api/security/red-team/reportsList all red team scan reports with status and summary metrics.
curl -X GET "https://api.neuronedge.ai/api/security/red-team/reports?limit=10" \
-H "Authorization: Bearer <api-key>"
# Response
{
"reports": [
{
"id": "scan_abc123",
"status": "completed",
"intensity": "comprehensive",
"target_policy_id": "pol_production",
"score": 87,
"grade": "B+",
"probes_run": 487,
"vulnerabilities_found": 23,
"started_at": "2026-03-10T14:40:00Z",
"completed_at": "2026-03-10T14:55:30Z"
}
],
"total": 42,
"limit": 10,
"offset": 0
}/api/security/red-team/reports/:idGet full report including category breakdown, vulnerabilities, and recommendations.
curl -X GET "https://api.neuronedge.ai/api/security/red-team/reports/scan_abc123" \
-H "Authorization: Bearer <api-key>"
# Response
{
"id": "scan_abc123",
"status": "completed",
"score": 87,
"grade": "B+",
"intensity": "comprehensive",
"target_policy_id": "pol_production",
"probes_run": 487,
"vulnerabilities_found": 23,
"by_category": {
"prompt_injection": {
"probes": 150,
"passed": 138,
"failed": 12,
"pass_rate": 92.0
},
"jailbreak": {
"probes": 200,
"passed": 189,
"failed": 11,
"pass_rate": 94.5
},
"pii_leakage": {
"probes": 137,
"passed": 137,
"failed": 0,
"pass_rate": 100.0
}
},
"weaknesses": [
{
"category": "prompt_injection",
"severity": "medium",
"description": "Vulnerable to multi-step indirect prompt injection",
"affected_probes": 8,
"recommendation": "Enable context-aware prompt analysis"
}
],
"started_at": "2026-03-10T14:40:00Z",
"completed_at": "2026-03-10T14:55:30Z"
}/api/security/red-team/reports/:id/probesGet individual probe results with filtering by category and pass/fail status.
curl -X GET "https://api.neuronedge.ai/api/security/red-team/reports/scan_abc123/probes?category=prompt_injection&passed=false" \
-H "Authorization: Bearer <api-key>"
# Response
{
"probes": [
{
"id": "probe_xyz789",
"category": "prompt_injection",
"technique": "Multi-step indirect injection",
"input": "Ignore previous instructions...",
"expected_action": "block",
"actual_action": "allow",
"passed": false,
"severity": "medium",
"timestamp": "2026-03-10T14:42:15Z"
}
],
"total": 12,
"limit": 20,
"offset": 0
}Error Responses
| Status | Description |
|---|---|
| 400 | Invalid request parameters |
| 401 | Missing or invalid API key |
| 403 | Insufficient tier / feature not available |
| 404 | Resource not found |
| 429 | Rate limit exceeded |
400 Bad Request
{
"error": {
"code": "invalid_request",
"message": "Invalid request parameters",
"details": {
"category": "Unknown category: invalid_category. Valid: prompt_injection, jailbreak, pii_leakage, data_leakage, model_denial"
}
}
}401 Unauthorized
{
"error": {
"code": "unauthorized",
"message": "Missing or invalid API key",
"details": "Authorization header must include a valid Bearer token"
}
}403 Forbidden
{
"error": {
"code": "forbidden",
"message": "Insufficient tier / feature not available",
"details": "Security API requires Professional tier or above. Current tier: Starter"
}
}404 Not Found
{
"error": {
"code": "not_found",
"message": "Resource not found",
"details": "Rule with id 'rule_invalid' does not exist"
}
}429 Rate Limit Exceeded
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded",
"details": "Security API limit: 100 requests/minute. Retry after 42 seconds.",
"retry_after": 42
}
}Rate Limits
Security API endpoints have tier-specific rate limits:
| Tier | Security API Limit |
|---|---|
| Professional | 100 requests/minute |
| Enterprise | 500 requests/minute |
Rate limits are enforced per API key. When exceeded, the API returns a 429 status with a retry_after value in seconds.