SabNZBd Automation Support
To help connect SABnzbd to other utilities, some automation functions are available through the web-interface.
PLEASE NOTE: Starting with release 0.4.9 each API call must have the extra parameter “apikey=secret-key“.
The secret-key can be found in Config->General.
In the commands, substitute elements in <> by proper values.
Example: get an NZB from an indexer (using its full URL):
http://host:port/sabnzbd/api?mode=addurl&name=<url>&cat=linux&pp=3&script=None
Where <url> is the URL of the indexer. Please note that this URL requires proper quoting.
So:
http://indexer.org/get-nzb.php/123456
becomes
http%3A%2F%2Findexer.org%2Fget-nzb.php%2F123456
These commands give a one line response. Either “ok\n” or “error\n”.
Only the shutdown command will give no response.
When the web interface username and password are set, you need to add two extra parameters:
ma_username and ma_password.
So the above example will become:
http://host:port/sabnzbd/api?mode=addid&ma_username=USER&ma_password=PASSWORD&name=123456&cat="movies"
Upload an NZB file, the <name> is the pathless name of the filename
http://host:port/sabnzbd/api?mode=addfile&name=<filename>&cat=<category>&pp=<job-option>&script=<script>
Omitted parameters (cat, pp or script) will get default values.
If you want to force an empty parameter, use an empty string, e.g. script=””.
Send the URL from where SABnzbd must download an NZB file
http://host:port/sabnzbd/api?mode=addurl&name=<url>&cat=<category>&pp=<job-option>&script=<script>
Pause the downloading of SABnzbd
http://host:port/sabnzbd/api?mode=pause
Resume the downloading of SABnzbd
http://host:port/sabnzbd/api?mode=resume
Shutdown SABnzbd
http://host:port/sabnzbd/api?mode=shutdown
Set the autoshutdown feature of SABnzbd on (1) or off (0)
http://host:port/sabnzbd/api?mode=autoshutdown&name=<0|1>
Brief queue status report (json or xml)
http://host:port/sabnzbd/api?mode=qstatus&output=json|xml
Returns a JSON object containing:
“paused” | <pause-status>, |
“kbpersec” | <downloadspeed in KB/sec>, |
“mbleft” | <MB to be downloaded>, |
“mb” | <MB that have been downloaded>, |
“noofslots” | <number of jobs in the queue>, |
“diskspace1” | <free space on download_dir disk>, |
“diskspace2” | <free space on complete_dir disk>, |
“jobs” | <queue object> |
where <queue object> is an array of the following objects: | |
“id” | <job id>, |
“filename” | <name of job>, |
“mb” | <MB of job>, |
“mbleft” | <MB left>, |
“msgid” | <indexer’s report number> |
or return an XML object:
<qstatus>
<paused></paused>
<kbpersec></kbpersec>
<mbleft></mbleft>
<mb></mb>
<noofslots></nofslots>
<diskspace1></diskspace1>
<diskspace2></diskspace2>
<jobs>
<job>
<id></id>
<filename></filename>
<mb></mb>
<mbleft></mbleft>
<msgid></msgid>
</job>
</jobs>
</qstatus>
Set speed limit
http://host:port/sabnzbd/api?mode=config&name=speedlimit&value=400
Set the download speed limit.
Set action for empty queue
http://host:port/sabnzbd/api?mode=queue&name=change_complete_action&value=<action>
Action to be executed when the download queue becomes empty:
- script_xxx, where ‘xxx’ is a script from the list returned by the api call get_scripts.
- shutdown_pc
- hibernate_pc
- shutdown_program
Warnings overview
http://host:port/sabnzbd/api?mode=warnings&output=json|xml
Returns a JSON or XML object containing an array of warning strings.
Category list
http://host:port/sabnzbd/api?mode=get_cats&output=json|xml
Returns a JSON or XML object containing an array of category strings.
Script list
http://host:port/sabnzbd/api?mode=get_scripts&output=json|xml
Returns a JSON or XML object containing an array of script strings.
Version
http://host:port/sabnzbd/api?mode=version&output=json|xml
Returns a JSON or XML object containing the version of SABnzbd.