Welcome to the NetPulse API documentation. This document provides a comprehensive overview of the microservices architecture and available endpoints.
NetPulse follows a microservices architecture with the following services:
| Service | Port | Base URL | Responsibility |
|---|---|---|---|
| API Gateway | 8000 | http://localhost:8000 |
Request routing & authentication |
| Auth Service | 8001 | http://localhost:8001 |
User authentication & authorization |
| Device Service | 8002 | http://localhost:8002 |
Device management |
| Monitoring Service | 8003 | http://localhost:8003 |
Real-time monitoring & metrics |
| Alert Service | 8004 | http://localhost:8004 |
Alert processing & management |
| Notification Service | 8005 | http://localhost:8005 |
Multi-channel notifications |
| Reporting Service | 8006 | http://localhost:8006 |
Analytics & reporting |
All client requests should go through the API Gateway at http://localhost:8000. The gateway handles:
- Request routing to appropriate microservices
- JWT token validation
- Rate limiting and CORS
- Request/response transformation
http://localhost:8000
The NetPulse API uses JWT-based authentication. Include the token in the Authorization header:
Authorization: Bearer <YOUR_ACCESS_TOKEN>
Register a new user account.
Request Body:
{
"email": "user@example.com",
"password": "secure_password",
"full_name": "John Doe",
"organization_id": "123e4567-e89b-12d3-a456-426614174000"
}Authenticate and receive access token.
Request Body:
{
"username": "user@example.com",
"password": "secure_password"
}Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "bearer"
}Verify JWT token validity.
Headers: Authorization: Bearer <token>
Response:
{
"user_id": "123e4567-e89b-12d3-a456-426614174000",
"email": "user@example.com",
"organization_id": "123e4567-e89b-12d3-a456-426614174000",
"is_active": true
}Retrieve all devices for the authenticated user's organization.
Query Parameters:
skip(int): Number of records to skip (default: 0)limit(int): Maximum records to return (default: 100)
Response:
[
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Router-01",
"ip_address": "192.168.1.1",
"device_type": "router",
"location": "Data Center A",
"status": "online",
"last_seen": "2025-07-15T10:30:00Z",
"created_at": "2025-07-01T09:00:00Z",
"updated_at": "2025-07-15T10:30:00Z"
}
]Add a new device to monitoring.
Request Body:
{
"name": "Switch-01",
"ip_address": "192.168.1.2",
"device_type": "switch",
"location": "Data Center A"
}Get details for a specific device.
Update device information.
Remove device from monitoring.
Get latest metrics for a specific device.
Query Parameters:
metric_type(str): Filter by metric type (cpu, memory, network, ping)hours(int): Hours of historical data (default: 24)
Response:
[
{
"device_id": "123e4567-e89b-12d3-a456-426614174000",
"metric_type": "cpu",
"value": 75.5,
"unit": "%",
"time": "2025-07-15T10:30:00Z"
}
]Submit new metrics (typically used by monitoring agents).
Check real-time device status and perform ping test.
Real-time monitoring updates via WebSocket connection.
Message Format:
{
"type": "device_status_change",
"data": {
"device_id": "123e4567-e89b-12d3-a456-426614174000",
"status": "offline",
"timestamp": "2025-07-15T10:30:00Z"
}
}Get alerts for the user's organization.
Query Parameters:
skip(int): Number of records to skiplimit(int): Maximum records to return
Response:
[
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"device_id": "123e4567-e89b-12d3-a456-426614174000",
"alert_type": "high_cpu",
"severity": "warning",
"message": "CPU usage is high: 85%",
"acknowledged": false,
"resolved": false,
"created_at": "2025-07-15T10:30:00Z"
}
]Create a new alert.
Acknowledge an alert.
Mark alert as resolved.
Send notification via multiple channels.
Request Body:
{
"type": "email",
"recipients": ["admin@example.com"],
"subject": "Network Alert",
"message": "Device Router-01 is offline",
"data": {
"device_id": "123e4567-e89b-12d3-a456-426614174000",
"severity": "critical"
}
}Send email notification.
Send SMS notification.
Generate device uptime report.
Query Parameters:
days(int): Number of days to include (default: 30)
Generate alert summary report.
Get organization overview with key metrics.
Response:
{
"organization_id": "123e4567-e89b-12d3-a456-426614174000",
"device_stats": {
"total_devices": 25,
"online_devices": 23,
"offline_devices": 2,
"uptime_percentage": 92.0
},
"alert_stats": {
"recent_alerts_24h": 5,
"critical_unresolved": 1
},
"last_updated": "2025-07-15T10:30:00Z"
}API Gateway health check.
Individual service health checks:
/auth/health- Auth service/devices/health- Device service/monitoring/health- Monitoring service/alerts/health- Alert service/notifications/health- Notification service/reports/health- Reporting service
All APIs return consistent error responses:
{
"detail": "Error description",
"status_code": 400,
"timestamp": "2025-07-15T10:30:00Z"
}Common HTTP status codes:
200- Success201- Created400- Bad Request401- Unauthorized403- Forbidden404- Not Found500- Internal Server Error503- Service Unavailable
The API Gateway implements rate limiting:
- Authenticated users: 1000 requests per hour
- Unauthenticated users: 100 requests per hour
Rate limit headers are included in responses:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1626345600
- GET /alerts
- Description: Retrieves a list of all alerts.
- GET /alerts/{alert_id}
- Description: Retrieves details for a specific alert.
- PUT /alerts/{alert_id}
- Description: Updates the status of an alert (e.g., acknowledge, resolve).