Remotely Shutdown/Restart Sonarr or Radarr with cUrl

I’ve been searching for a working solution to remotely shutdown/restart Sonarr for quite a while.

I couldn’t find one and with the knowledge I gained from the articles I read about the subject I started tinkering and finally found a solution.

Enter cUrl.

Sonarr shutdown:

curl --data "{apikey:[YOUR-API-KEY]}" http://[YOUR-SERVER-ADDRESS]:[YOUR-PORT]/api/system/shutdown?apikey=[YOUR-API-KEY]

Sonarr Restart:

curl --data "{apikey:[YOUR-API-KEY]}" http://[YOUR-SERVER-ADDRESS]:[YOUR-PORT]/api/system/restart?apikey=[YOUR-API-KEY]

Prerequisites:

  • Install cUrl
  • Add cUrl to your system’s environment PATH variable
  • Replace:
    [YOUR-API-KEY] with the api key you configured in Settings->General->Security
    [YOUR-SERVER-ADDRESS] with your server address (IP address or computer name)
    [YOUR-PORT] with the port number you configured in Settings->General->Start-Up

Examples:

curl --data "{apikey:dtoj40rztfedbj6895jyg4ansq1fm3q9}" http://192.168.0.255:8989/api/system/shutdown?apikey=dtoj40rztfedbj6895jyg4ansq1fm3q9
curl --data "{apikey:dtoj40rztfedbj6895jyg4ansq1fm3q9}" http://192.168.0.255:8989/api/system/restart?apikey=dtoj40rztfedbj6895jyg4ansq1fm3q9

I have no idea why the apikey needs to be used twice. I tried using them once. Only as a data parameter and only as a querystring but both attempts failed.
I welcome any comments :slight_smile:

I created two batch files (.bat on my Windows 10 system) which I run to execute the tasks.

I thought it might come in handy for folks that are also searching for this.

This also works for Radarr :slight_smile:

How do you turn it back on?

Also, using ssh keys you could remotely start and stop Sonarr if you are running it as a service.

ssh username@servername 'sudo service sonarr start'

I use Remote Launcher client app on my Android tablet to execute a batch file on my Windows machine (which runs Remote Launcher Server) that starts Sonarr/Radarr.

Remote Launcher works on Linux as well :slight_smile: