API Reference¶
Comprehensive documentation for the VPN Exit Controller REST API.
API Overview¶
The VPN Exit Controller API provides programmatic access to all system functions:
- RESTful Design: Clean, predictable URL structure
- JSON Format: All requests and responses use JSON
- HTTP Basic Auth: Simple, secure authentication
- Comprehensive: Full control over nodes, metrics, and configuration
- Well-Documented: OpenAPI/Swagger specification available
Quick Start¶
Base URL¶
Authentication¶
Example Request¶
curl -X POST \
-u admin:password \
-H "Content-Type: application/json" \
-d '{"country": "us"}' \
https://api.vpn.yourdomain.com/api/nodes/start
API Documentation¶
-
Authentication
Learn about API authentication methods and security
-
Endpoints
Complete reference for all API endpoints
-
Examples
Code examples in multiple languages
-
SDKs
Official and community SDKs
API Categories¶
Node Management¶
Control VPN nodes - start, stop, monitor
GET /api/nodes- List all nodesPOST /api/nodes/start- Start a nodeDELETE /api/nodes/{id}- Stop a nodeGET /api/nodes/{id}/health- Node health
Load Balancing¶
Configure and query load balancing
GET /api/load-balancer/best-node/{country}- Get optimal nodePOST /api/load-balancer/strategy- Set strategyGET /api/load-balancer/status- Current status
Metrics & Monitoring¶
Access performance and health data
GET /api/metrics- System metricsGET /api/health- Health checkPOST /api/speed-test/{id}- Run speed test
Configuration¶
Manage system configuration
GET /api/config- Get configurationPUT /api/config- Update settingsPOST /api/config/reload- Reload config
Response Format¶
Success Response¶
{
"status": "success",
"data": {
"id": "vpn-us-1",
"country": "us",
"status": "running"
},
"timestamp": "2024-01-15T10:30:00Z"
}
Error Response¶
{
"status": "error",
"error": {
"code": "NODE_NOT_FOUND",
"message": "No node with ID 'vpn-xyz' exists",
"details": {}
},
"timestamp": "2024-01-15T10:30:00Z"
}
Status Codes¶
| Code | Description | Usage |
|---|---|---|
| 200 | OK | Successful GET/PUT |
| 201 | Created | Successful POST |
| 204 | No Content | Successful DELETE |
| 400 | Bad Request | Invalid parameters |
| 401 | Unauthorized | Missing/invalid auth |
| 404 | Not Found | Resource not found |
| 409 | Conflict | Resource conflict |
| 429 | Too Many Requests | Rate limited |
| 500 | Internal Error | Server error |
Rate Limiting¶
API requests are rate limited:
- Default: 100 requests/minute
- Burst: 20 requests/second
- Headers: Rate limit info included
API Versioning¶
The API uses URL versioning:
- Current:
/api/v1/(or/api/) - Legacy: Not applicable (v1 is first version)
OpenAPI Specification¶
Interactive API documentation available at:
- Swagger UI:
https://api.vpn.yourdomain.com/api/docs - ReDoc:
https://api.vpn.yourdomain.com/api/redoc - OpenAPI JSON:
https://api.vpn.yourdomain.com/api/openapi.json
Quick Links¶
- Authentication Guide - Set up API access
- Complete Endpoint Reference - All endpoints documented
- Code Examples - Copy-paste examples
- SDK Documentation - Language-specific libraries
Interactive Documentation
Visit /api/docs on your deployment for interactive API documentation with a built-in testing interface.