The CubeOS API provides programmatic access to all system functions.
http://api.cubeos.cube/api/v1
http://10.42.24.1:6010/api/v1
All endpoints except /auth/login require a JWT token.
POST /api/v1/auth/login
Content-Type: application/json
{
"username": "admin",
"password": "cubeos"
}Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "bearer",
"expires_in": 86400,
"user": {
"username": "admin",
"role": "admin"
}
}Include in all requests:
Authorization: Bearer <access_token>GET /api/v1/system/infoReturns hostname, model, serial number, OS version.
GET /api/v1/system/statsReturns CPU usage, memory usage, disk usage, temperature.
POST /api/v1/system/rebootPOST /api/v1/system/shutdownGET /api/v1/servicesReturns all Docker containers with status.
GET /api/v1/services/{name}POST /api/v1/services/{name}/startPOST /api/v1/services/{name}/stopPOST /api/v1/services/{name}/restartGET /api/v1/services/{name}/logs?lines=100GET /api/v1/network/interfacesGET /api/v1/network/wifi/ap/statusPUT /api/v1/network/wifi/ap/config
Content-Type: application/json
{
"ssid": "MyCubeOS",
"password": "newpassword123",
"channel": 6
}GET /api/v1/clientsGET /api/v1/network/dhcp/leasesGET /api/v1/power/statusReturns battery percentage, charging status, voltage (if UPS installed).
POST /api/v1/chat
Content-Type: application/json
{
"message": "How do I access Pi-hole?",
"history": []
}GET /api/v1/chat/statusReturns Ollama availability and model status.
GET /api/v1/backupPOST /api/v1/backup/create
Content-Type: application/json
{
"name": "my-backup",
"include_docker_volumes": true
}POST /api/v1/backup/restore/{backup_id}All errors return:
{
"error": "Error message",
"code": 400
}Common HTTP status codes:
400- Bad request (invalid parameters)401- Unauthorized (invalid/expired token)403- Forbidden (insufficient permissions)404- Not found500- Internal server error
ws://api.cubeos.cube/ws/stats
Streams system stats every 2 seconds.
ws://api.cubeos.cube/api/monitoring/ws
Real-time monitoring data.
Full OpenAPI 3.0 specification available at:
http://api.cubeos.cube/api/v1/openapi.yaml
Interactive documentation (Swagger UI):
http://api.cubeos.cube/api/v1/docs
- No rate limits for local network access
- Reasonable use expected (avoid polling < 1 second)
# Login
TOKEN=$(curl -s -X POST http://10.42.24.1:6010/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"cubeos"}' | jq -r '.access_token')
# Get system stats
curl -s http://10.42.24.1:6010/api/v1/system/stats \
-H "Authorization: Bearer $TOKEN" | jq
# Restart a service
curl -X POST http://10.42.24.1:6010/api/v1/services/cubeos-pihole/restart \
-H "Authorization: Bearer $TOKEN"import requests
# Login
resp = requests.post('http://10.42.24.1:6010/api/v1/auth/login',
json={'username': 'admin', 'password': 'cubeos'})
token = resp.json()['access_token']
# Get stats
headers = {'Authorization': f'Bearer {token}'}
stats = requests.get('http://10.42.24.1:6010/api/v1/system/stats',
headers=headers).json()
print(stats)const login = await fetch('http://10.42.24.1:6010/api/v1/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username: 'admin', password: 'cubeos' })
});
const { access_token } = await login.json();
const stats = await fetch('http://10.42.24.1:6010/api/v1/system/stats', {
headers: { 'Authorization': `Bearer ${access_token}` }
}).then(r => r.json());