Switch device slot
POST /api/slot/:deviceId/:slot
Manually switch a device to a specific connection slot
Path parameters
Device identifier
Target slot to switch toOptions:
primary, secondaryResponse
Indicates if the slot switch was successful
Device identifier
The slot that is now active
Error message if the switch failed
Example: Switch to secondary slot
Example: Switch to primary slot
Slot switching behavior
Pre-switch validation
Before switching, the system validates:- Device exists - Device ID is valid and device exists in database
- Slot configured - The target slot has connection details configured
- Slot availability - The target slot is reachable and healthy
Post-switch actions
After a successful slot switch:- Database update - Device
activeSlotfield is updated - Stream URL update - PocketBase hook updates stream URLs to use new slot’s host
- Notification sent - Users are notified about the slot change
- Health check reset - Failure counters are reset for the new slot
Automatic failback
When automatic slot switching is enabled and a manual switch is performed:- Health checks continue on both slots
- System can automatically switch back if the original slot recovers
- Manual switches take precedence over automatic failover temporarily
Error responses
400 Invalid slot
404 Device not found
400 Slot not configured
503 Slot unavailable
Use cases
Testing failover
Manually switch slots to test failover behavior:Maintenance mode
Switch to alternate slot before performing maintenance:Load balancing
Distribute devices across different network connections:Integration with health checks
Manual slot switching works alongside automatic health check failover:- Manual override - Manual switches are respected by health checks
- Continued monitoring - Health checks continue on both slots
- Automatic recovery - If enabled, system can auto-switch when conditions improve
- Status visibility - Use health check endpoints to monitor both slots
Slot configuration
For slot switching to work, devices must have both slots configured:Primary slot
host- Primary connection hostname or IPphone- Primary phone number for cellular connection
Secondary slot
secondSlotHost- Secondary connection hostname or IPsecondSlotPhone- Secondary phone number for cellular connectionautoSlotSwitch- Enable automatic failover (optional)