Introduction
The Management API provides programmatic control over switchAILocal’s configuration, monitoring, and intelligent systems. Use it to automate operations, build management dashboards, or integrate with DevOps tools.Base URL
/v0/management prefix.
Authentication
Management endpoints require a secret key for authentication:Initialize Secret
On first run, initialize your management secret:Endpoint Categories
Configuration
Manage server configuration and settings
- Get/update
config.yaml - Manage API keys
- Configure providers
Monitoring
Track usage and performance
- Usage statistics
- Provider health
- Request logs
Intelligent Systems
Access advanced AI capabilities
- Memory statistics
- Steering rules
- Hook status
- Analytics
Provider Management
Control AI providers
- Test connectivity
- Discover models
- Manage credentials
Quick Examples
Get Server Configuration
Update Configuration
Get Usage Statistics
Test Provider
Setup Workflow
New installations can use the setup flow:1. Check Setup Status
2. Initialize or Skip
3. Access Management Endpoints
After initialization, use the secret key:Localhost Bypass
When accessing fromlocalhost and remote management is disabled:
config.yaml
Remote Access
To enable remote management:config.yaml
Security Features
Rate Limiting
Failed authentication attempts trigger temporary IP bans:- Max failures: 5 attempts
- Ban duration: 30 minutes
- Scope: Per remote IP
CORS Disabled
Management endpoints disable CORS to prevent browser-based attacks.Localhost Restriction
Optionally restrict management to localhost only:config.yaml
Response Format
All management endpoints return JSON:Success Response
Error Response
Common Headers
| Header | Required | Description |
|---|---|---|
X-Management-Key | Yes | Management secret key |
Content-Type | Varies | application/json or application/yaml |
Authorization | No | Alternative to X-Management-Key: Bearer <key> |
Version Information
All responses include version headers:Available Endpoints
Configuration Management
| Endpoint | Method | Description |
|---|---|---|
/config | GET | Get JSON configuration |
/config.yaml | GET | Get YAML configuration |
/config.yaml | PUT | Update configuration |
/debug | GET/PUT | Get/set debug mode |
/logging-to-file | GET/PUT | Get/set file logging |
/usage-statistics-enabled | GET/PUT | Get/set usage tracking |
/proxy-url | GET/PUT/DELETE | Manage proxy settings |
Provider Management
| Endpoint | Method | Description |
|---|---|---|
/providers/test | POST | Test provider connectivity |
/providers/discover-models | POST | Discover available models |
/gemini-api-key | GET/PUT/PATCH/DELETE | Manage Gemini keys |
/claude-api-key | GET/PUT/PATCH/DELETE | Manage Claude keys |
/switchai-api-key | GET/PUT/PATCH/DELETE | Manage switchAI keys |
/codex-api-key | GET/PUT/PATCH/DELETE | Manage Codex keys |
Monitoring
| Endpoint | Method | Description |
|---|---|---|
/usage | GET | Usage statistics |
/metrics | GET | Superbrain metrics |
/logs | GET | Server logs |
/request-error-logs | GET | Error logs |
/request-log-by-id/:id | GET | Specific request log |
Intelligent Systems
| Endpoint | Method | Description |
|---|---|---|
/memory/stats | GET | Memory system statistics |
/heartbeat/status | GET | Provider health status |
/steering/rules | GET | Loaded steering rules |
/steering/reload | POST | Reload steering rules |
/hooks/status | GET | Hook execution status |
/hooks/reload | POST | Reload hooks |
/analytics | GET | Computed analytics |
Advanced
| Endpoint | Method | Description |
|---|---|---|
/cache/metrics | GET | Cache statistics |
/cache/clear | POST | Clear semantic cache |
/state-box/status | GET | State directory info |
/latest-version | GET | Check for updates |
Python Client Example
JavaScript Client Example
Next Steps
Configuration
Manage server configuration
Providers
Control AI provider settings
Authentication
Set up management authentication