API Reference

Power Control

Control system power state remotely.

The power endpoints allow you to remotely control your computer's power state, including shutdown, restart, sleep, and hibernate.

Endpoints

MethodEndpointDescription
POST/api/pw/shutdownInitiates a system shutdown.
POST/api/pw/restartInitiates a system restart.
POST/api/pw/sleepPuts the system into sleep mode.
POST/api/pw/hibernatePuts the system into hibernation.

Response Timing

Power commands return a success response before the system action is triggered. This ensures the remote client receives confirmation before the connection is lost.

Example Requests

Shutdown

Request
curl -X POST http://192.168.1.100:9990/api/pw/shutdown

Restart

Request
curl -X POST http://192.168.1.100:9990/api/pw/restart

Sleep

Request
curl -X POST http://192.168.1.100:9990/api/pw/sleep

Hibernate

Request
curl -X POST http://192.168.1.100:9990/api/pw/hibernate

Response

All power endpoints return the same success response:

Response
{
    "status": "ok",
    "message": "Command initiated"
}

Configuration

Power commands can be enabled or disabled in your config.yaml:

config.yaml
features:
  ...
  enable_sleep: true  # Enable sleep/hibernate commands
  enable_restart: true  # Enable restart commands
  enable_shutdown: true  # Enable shutdown commands
  enable_hibernate: true  # Enable hibernate commands

Security

These endpoints perform system-level actions. Ensure your Cntrl server is only accessible on your trusted local network.

On this page