API Reference
Complete reference for ADAPT-AI's REST API, WebSocket endpoints, and SDKs.
Base URL
https://api.adapt-ai.com/v1
Authentication
All API requests require authentication using your API key. Include your key in the Authorization header:
Authorization: Bearer your-api-key
Core Endpoints
Discovery API
POST
/discovery/scan
Scan domains for AI endpoints and services
{ "targets": ["example.com", "api.example.com"], "options": { "depth": 3, "include_subdomains": true, "fingerprint_services": true, "concurrent_requests": 10 } }
Response:
{ "task_id": "550e8400-e29b-41d4-a716-446655440000", "status": "processing", "targets_found": 0, "estimated_time": 300 }
GET
/discovery/tasks/{task_id}
Get status and results of a discovery scan
Attack API
POST
/attack/gradient-optimize
Execute gradient-based attack optimization
{ "target": "https://api.example.com/chat", "objective": "jailbreak", "parameters": { "iterations": 100, "learning_rate": 0.01, "momentum": 0.9, "gradient_clipping": true, "temperature": 0.7 }, "initial_prompt": "You are a helpful assistant", "constraints": { "max_tokens": 500, "preserve_coherence": true } }
POST
/attack/multimodal
Execute coordinated multi-modal attacks
{ "target": "https://api.example.com/multimodal", "modes": ["text", "image", "audio"], "strategy": "synchronized", "attack_configs": { "text": { "type": "adversarial_suffix", "iterations": 50 }, "image": { "type": "pixel_perturbation", "epsilon": 0.1 }, "audio": { "type": "frequency_injection", "frequency": 19000 } } }
POST
/attack/session
Create and execute a comprehensive test session
Machine Learning API
POST
/ml/analyze-patterns
Analyze attack patterns and get ML insights
{ "session_id": "attack-session-123", "analysis_type": "comprehensive", "include_predictions": true, "ml_models": ["pattern_recognizer", "genetic_optimizer"] }
POST
/ml/train
Train custom ML models on your attack data
GET
/ml/insights
Get aggregated ML insights and recommendations
WebSocket API
Real-time updates for long-running operations:
ws://api.adapt-ai.com/v1/ws?token=your-api-key
Subscribe to Task Updates
{ "action": "subscribe", "task_id": "550e8400-e29b-41d4-a716-446655440000" }
Receive Updates
{ "event": "task_progress", "task_id": "550e8400-e29b-41d4-a716-446655440000", "progress": 0.75, "targets_found": 12, "current_target": "api.example.com/v2/chat" }
Response Codes
Code | Description |
---|---|
200 | Success |
201 | Created |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid API key |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error |
Rate Limits
Default Limits
- • 100 requests per minute for discovery operations
- • 50 requests per minute for attack operations
- • 1000 requests per hour total
- • WebSocket: 10 concurrent connections
Contact support for enterprise rate limits.
SDK Documentation
Python SDK
Installation:
pip install adapt-ai
Quick Example:
from adapt_ai import AdaptClient client = AdaptClient(api_key="your-key") # Discover targets targets = await client.discovery.scan( domain="example.com" ) # Run attack result = await client.attack.test( target=targets[0], strategy="adaptive" )
JavaScript SDK
Installation:
npm install @adapt-ai/sdk
Quick Example:
import { AdaptAI } from '@adapt-ai/sdk'; const adapt = new AdaptAI({ apiKey: 'your-key' }); // Discover targets const targets = await adapt.discovery.scan({ domain: 'example.com' }); // Run attack const result = await adapt.attack.test({ target: targets[0], strategy: 'adaptive' });
Error Handling
All errors follow a consistent format:
{ "error": { "code": "RATE_LIMIT_EXCEEDED", "message": "You have exceeded the rate limit of 100 requests per minute", "details": { "limit": 100, "reset_at": "2024-01-15T10:30:00Z", "retry_after": 30 } } }