HedgeAI API Documentation
Comprehensive RESTful API for integrating HedgeAI's cybersecurity AI capabilities into your applications, with secure endpoints and real-time streaming support.
API Overview
🔐 Secure by Design
OAuth 2.0, JWT tokens, rate limiting, and end-to-end encryption for all API communications
⚡ Real-time Streaming
WebSocket and Server-Sent Events for live AI responses and collaborative features
📊 Usage Analytics
Detailed request metrics, performance monitoring, and billing integration
API Endpoints
💬 Chat API
POST /api/v1/chat
Send messages to AI assistant
GET /api/v1/chat/history
Retrieve conversation history
DELETE /api/v1/chat/{id}
Clear conversation thread
Rate Limit: 100 requests/minute
🔄 Streaming API
WS /api/v1/stream
WebSocket for real-time responses
GET /api/v1/stream/sse
Server-sent events endpoint
POST /api/v1/stream/close
Terminate streaming session
Rate Limit: 10 concurrent connections
🎯 Vibe Coder API
POST /api/v1/vibe/generate
Generate code from natural language
POST /api/v1/vibe/analyze
Analyze and improve existing code
POST /api/v1/vibe/explain
Explain code functionality
Rate Limit: 50 requests/minute
🛡️ Security Templates
GET /api/v1/templates
List available security templates
GET /api/v1/templates/{id}
Download specific template
POST /api/v1/templates/custom
Create custom template
Rate Limit: 200 requests/hour
Authentication & Security
🔐 Security First Approach
Authentication Methods
- • API Keys: For server-to-server communication
- • OAuth 2.0: For user-authorized applications
- • JWT Tokens: Short-lived access tokens
- • HEDGE Token: Pay with native token for discounts
Security Features
- • TLS 1.3: All connections encrypted
- • Rate Limiting: DDoS and abuse protection
- • IP Whitelisting: Restrict access by IP
- • Request Signing: HMAC signature validation
API Key Authentication Example
# Get your API key from dashboard
curl
-X POST \"https://api.hedgeai.com/v1/chat" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{'
"message": "Generate a Python script for port scanning",
"stream": false
'}'
Rate Limits & Pricing
Free Tier
API Requests
1,000/month
Rate Limit
10/minute
- • Basic chat API access
- • Limited template library
- • Community support only
Professional
API Requests
50,000/month
Rate Limit
100/minute
- • Full API access
- • Streaming support
- • Premium templates
- • Priority support
$49/month
Enterprise
API Requests
Unlimited
Rate Limit
Custom
- • Dedicated infrastructure
- • Custom integrations
- • SLA guarantees
- • 24/7 support
Custom pricing
HEDGE Token Integration
Token Payment Benefits
- • 15% Discount: Pay API fees with HEDGE tokens
- • Priority Processing: Token holders get faster responses
- • Higher Limits: Increased rate limits for token holders
- • Beta Access: Early access to new API features
Implementation
# Pay with HEDGE tokens
-H
"X-Payment-Token: HEDGE"-H
"X-Token-Amount: 0.1"Error Handling & Status Codes
Standard HTTP Status Codes
200Success
201Created
400Bad Request
401Unauthorized
429Rate Limited
500Server Error
Error Response Format
{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests",
"details": {
"limit": 100,
"reset_time": 1640995200
}
}
}
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests",
"details": {
"limit": 100,
"reset_time": 1640995200
}
}
}
Quick Start Guide
1
Get API Key
2
Choose Endpoint
3
Make Request
4
Build Amazing Apps