Incorrect or missing information? API reference
Jump quickly to: Queue functions, History functions, Status functions and Other functions.
Introduction
The SABnzbd API can be reached via:
http://host:port/sabnzbd/api
Request types
Supported output types are json
(default) and xml
, which can be specified in the request:
http://host:port/sabnzbd/api?output=json
API Key and NZB key
API requires the users API key to be supplied all API requests in order for it to work. The API key is randomly generated and is static unless the user decides to change the key. The user can see their API key on the General page of the configuration pages.
http://host:port/sabnzbd/api?output=json&apikey=APIKEY
If the API-key is missing the request will return error: API Key Required
, if it is incorrect: error: API Key Incorrect
.
There is also a separate NZB key, which only allows for adding, modifying and removing jobs in the queue. When this key is used for something else, the request will return error: API Key Incorrect
.
The version
and auth
functions do not require the API key.
Documentation
NOTE In all examples below the apikey=APIKEY&output=json
part is not shown but still necessary.
True/False Indicates the API will return the status, for some functions it's always true
, even if the operation failed. Sorry about that!
Queue functions
Function | Description |
---|---|
queue | Full Queue output |
pause (queue) | Pause whole queue |
resume (queue) | Resume whole queue |
speedlimit | Set speedlimit |
change_complete_action | Action on queue complete |
sort | Sort the queue |
addurl | Add NZB by URL |
addfile | Add NZB by file upload |
addlocalfile | Add NZB by local file path |
pause (single job) | Pause a single job |
resume (single job) | Resume a single job |
delete | Delete job |
purge | Delete all jobs or based on keyword |
move | Change position of job in queue |
change_cat | Change job category |
change_script | Change job script |
priority | Change job priority |
change_opts | Change job post-processing |
rename | Change name and password of job |
get_files | Get details of files in a job |
move_nzf_bulk | Move file(s) inside a job |
delete_nzf | Remove file(s) from a job |
Full Queue output
Full queue output with details about all jobs.
api?mode=queue&start=START&limit=LIMIT&cat=CATEGORY&priority=PRIORITY&search=SEARCH&nzo_ids=NZO_ID_1,NZO_ID_2,NZO_ID_3
NOTE Some of the less obvious output parameters are described below.
Input parameter | Description |
---|---|
start optional |
Index of job to start at |
limit optional |
Number of jobs to display |
search optional |
Filter job names by search term |
category / cat optional |
Only return jobs with the specified category or categories (separated by a comma) Use * for Default
|
priority optional |
Only return jobs with the specified priority or priorities (separated by a comma)
|
status optional |
Only return jobs with the specified status or statuses (separated by a comma)
|
nzo_ids optional |
Only return jobs with these nzo_ids (separated by a comma) |
Output parameter | Description |
---|---|
speedlimit |
In percentage of maximum set by user |
speedlimit_abs |
In bytes/s |
labels |
Labels like DUPLICATE , ENCRYPTED and PROPAGATING X min |
unpackopts |
See change_opts |
Pause queue True/False
Pauses the whole queue (do not confuse this will pausing an individual download, this is a global pause).
api?mode=pause
Pauses for value
minutes.
api?mode=config&name=set_pause&value=50
Resume queue True/False
Resumes the whole queue (do not confuse this will resuming an individual download, this is a global pause).
api?mode=resume
Set speedlimit True/False
Sets the speedlimit to value
in percentage of the maximum line speed (set by user).
api?mode=config&name=speedlimit&value=30
It can also be followed by K,M
to define speedlimit in KB/s,MB/s
, respectively.
api?mode=config&name=speedlimit&value=400K
Action on queue complete True/False
Set an end-of-queue action
api?mode=queue&name=change_complete_action&value=ACTION
Options:
hibernate_pc
standby_pc
shutdown_program
- Script: prefix the name of the script with
script_
, for examplescript_test.py
On some systems additional packages are required to allow SABnzbd to control power states, if there are problems in queue it will show as power_options=false
.
Sort the queue True/False
Sort the queue by avg_age
, name
or size
in asc
or desc
order.
api?mode=queue&name=sort&sort=avg_age&dir=desc
Add NZB by URL
Add NZB using an URL that needs to be accessible by SABnzbd, so make sure to include authentication information if the Indexer requires it. Example of a full request with everything set to default values is shown below, but only the name
parameter is required.
api?mode=addurl&name=https%3A%2F%indexer.info%2Fget.php%3Fguid%3Ded731c0b37f25f84aea563d6ddb210b1%26api%3D6f235b80fab0c76e1ce7da21b2c6c48c&nzbname=&cat=*&script=Default&priority=-100&pp=-1
Returns the nzo_id
of the job:
Input parameter | Description |
---|---|
name |
URL-encoded version of the link to the NZB to be fetched. |
nzbname optional |
Name of the job, if empty the NZB filename is used. |
password optional |
Password to use when unpacking the job. |
cat optional |
Category to be assigned, * means Default . List of available categories can be retrieved from get_cats. |
script optional |
Script to be assigned, Default will use the script assigned to the category. List of available scripts can be retrieved from get_scripts. |
priority optional |
Priority to be assigned:
|
pp optional |
Post-processing options:
|
Add NZB by file upload
Upload NZB using POST multipart/form-data
. In your form, set the value of the field mode
to addfile
; the file data should be in the field name
or the field nzbfile
.
For other parameters and output see addurl.
Add NZB by local file path
Upload NZB from a location on the file system that SABnzbd can access. The path should be URL-encoded.
For other parameters and output see addurl.
Example of adding a file E:\Downloads\Movie.BRRip.x264.1080p-NPW.nzb
:
api?mode=addlocalfile&name=E%3A%5CDownloads%5CMovie.BRRip.x264.1080p-NPW.nzb&nzbname=The.Job.Name&cat=*&script=Default&priority=-100&pp=-1
Pause single job True/False
Pause a single job based on its nzo_id
. Returns a boolean status, and a list of affected nzo_ids.
api?mode=queue&name=pause&value=NZO_ID
Resume single job True/False
Resume a single job based on its nzo_id
. Returns a boolean status, and a list of affected nzo_ids.
api?mode=queue&name=resume&value=NZO_ID
Delete jobs True/False
Delete job(s) based on nzo_id
. Returns a boolean status, and a list of affected nzo_ids.
NOTE By default already download files of a job are not removed, add del_files=1
to have all files removed.
api?mode=queue&name=delete&value=NZO_ID
Deleting multiple items:
api?mode=queue&name=delete&value=NZO_ID_1,NZO_ID_2,NZO_ID_3
Deleting all items:
api?mode=queue&name=delete&value=all&del_files=1
Purge queue
Remove all jobs from the queue, or only the ones matching search
. Returns nzb_id
of the jobs removed.
api?mode=queue&name=purge&search=SEARCH&del_files=1
NOTE By default already download files of a job are not removed, add del_files=1
to have all files removed.
Move job in queue
Job's can be switched by providing 2 nzo_id
, value
is the item you want to move, value2
is the name of the job where you want to put value
one above, shifting job value2
down.
api?mode=switch&value=NZO_ID_1&value2=NZO_ID_2
You can also move to a specific location in the queue, where 0
is the top of the queue:
api?mode=switch&value=NZO_ID&value2=2
Both commands will return the new position and priority, since a job's location is also dependent on its priority:
Change job category True/False
Change category of job with nzo_id
. List of available categories can be retrieved from get_cats.
api?mode=change_cat&value=NZO_ID&value2=Category
Change job script True/False
Change script of job with nzo_id
. List of available scripts can be retrieved from get_scripts.
api?mode=change_script&value=NZO_ID&value2=script.py
Change job priority
Change priority of job with nzo_id
.
-100
= Default Priority (of category)-4
= Stop-3
= Duplicate-2
= Paused-1
= Low Priority0
= Normal Priority1
= High Priority2
= Force
api?mode=queue&name=priority&value=NZO_ID&value2=0
The command will return the new position, since a job's location also depends on its priority:
Change job post-processing options True/False
Change post-processing of job with nzo_id
.
0
= None1
= +Repair2
= +Repair/Unpack3
= +Repair/Unpack/Delete
api?mode=change_opts&value=NZO_ID&value2=0
Change job name True/False
Change name and password of job with nzo_id
.
NOTE value3
can be empty, but to set a password value
and value2
must also be filled, using the current name.
api?mode=queue&name=rename&value=NZO_ID&value2=NEW_NAME&value3=PASSWORD
Or you can set a password as part of the new name in value2
, see: RAR with password.
api?mode=queue&name=rename&value=NZO_ID&value2=NEW_NAME{{PASSWORD}}
Get files in job
Get files of job with nzo_id
.
api?mode=get_files&value=NZO_ID
The status
indicates if a file was finished
, in the process of being downloaded (active
) or will only be downloaded when necessary (queued
, like .par2
files). The set
shows to which part of the download the .par2
files belong to, in case of multiple sets in 1 job. Files are sorted in order: finished, active, queued.
Move file(s) inside a job True/False
Move files specified by nzf_ids
inside job nzo_id
to top
or bottom
.
To move a file a size
number of spots, use up
or down
.
api?mode=move_nzf_bulk&name=LOCATION&value=NZO_ID&nzf_ids=NZF_ID,NZF_ID2&size=X
Remove file(s) from a job
Remove file(s) using nzo_id
of the job and nzf_id
of the file(s). Returns the nzf_ids
of removed file.
api?mode=queue&name=delete_nzf&value=NZO_ID&value2=NZF_ID,NZF_ID2
History functions
Function | Description |
---|---|
history | Full history output |
retry | Retry failed job |
retry_all | Retry all failed jobs |
delete | Delete/Archive history item |
History output
Full history output with details about all jobs. The queue
and the history
output share many common fields, but the history also contains statistics about how much has been downloaded in the past day, week, month and total.
api?mode=history&start=START&limit=LIMIT&cat=CATEGORY&search=SEARCH&nzo_ids=NZO_ID_1,NZO_ID_2,NZO_ID_3&failed_only=0
NOTE Some of the less obvious output parameters are described below.
Input parameter | Description |
---|---|
start optional |
Index of job to start at |
limit optional |
Number of jobs to display |
archive optional |
Display history (default) or archived items |
search optional |
Filter job names by search term |
category / cat optional |
Only return jobs with the specified category or categories (separated by a comma) Use * for Default
|
status optional |
Only return jobs with the specified status or statuses (separated by a comma)
|
nzo_ids optional |
Only return jobs with these nzo_ids (separated by a comma) |
failed_only optional |
Only show failed jobs (shorthand for status=Failed ) |
last_history_update optional |
Only return full output if anything has changed since last_history_update , the last update is given by a previous call to history |
Output parameter | Description |
---|---|
duplicate_key |
How SABnzbd identified the show and season/episode info |
pp |
Different format than the queue:
|
path |
Temporary destination |
storage |
Final destination |
loaded |
If true , item is post-processing |
Retry history item True/False
Retry history item(s) based on nzo_id
. Optionally provide a password
and an additional NZB as POST multipart/form-data
in the nzbfile
field.
NOTE Pay attention to the different variable names used here: value
and nzbfile
.
api?mode=retry&value=NZO_ID&password=password
Retry all history items True/False
Will retry all failed jobs in the history. However, you are not able to supply passwords or extra NZB's.
api?mode=retry_all
Delete/Archive history items True/False
Delete or archive history item(s) based on nzo_id
.
NOTE By default files of failed jobs are not removed, add del_files=1
to also have them removed.
NOTE By default items are moved to the Archive, add archive=0
to completely remove them.
api?mode=history&name=delete&value=NZO_ID
Deleting multiple items (skipping Archive):
api?mode=history&name=delete&archive=0&value=NZO_ID_1,NZO_ID_2,NZO_ID_3
Deleting all items:
api?mode=history&name=delete&value=all
Deleting all failed items:
api?mode=history&name=delete&value=failed
Status functions
NOTE Added in 3.4.0, older versions only have fullstatus.
Function | Description |
---|---|
status / fullstatus | All status information |
unblock_server | True/False Unblock server |
delete_orphan | True/False Delete orphaned job |
mode=status name=delete_all_orphan |
True/False Delete all orphaned jobs |
add_orphan | True/False Retry orphaned job |
mode=status name=add_all_orphan |
True/False Retry all orphaned jobs |
Status information
Get all status information available from SABnzbd. Below are only the values that are different from calls to queue
.
NOTE Getting the public IPv4 address might take some time, so it can be skipped by setting skip_dashboard=1
. To calculate performance measures, add calculate_performance=1
.
api?mode=status&skip_dashboard=0
NOTE Some of the less obvious output parameters are described below.
Output parameter | Description |
---|---|
darwin |
true when OS running SABnzbd is macOS |
nt |
true when OS running SABnzbd is Windows |
folders |
The orphaned job folder left in the Incomplete folder. Orphaned jobs can only be removed from a skin, not through the API |
pystone |
Indication of CPU speed, see Highspeed Downloading |
loadavg |
On Linux this will contain a string with information about system load |
Unblock server True/False
Unblock server based on servername
from the status.
api?mode=status&name=unblock_server&value=SERVERNAME
Delete orphaned job True/False
Delete orphaned job based on the folder name from the status. Make sure that you URL-encode the folder name.
api?mode=status&name=delete_orphan&value=FOLDERNAME
Retry orphaned job True/False
Retry orphaned job based on the folder name from the status. Make sure that you URL-encode the folder name.
api?mode=status&name=add_orphan&value=FOLDERNAME
Other functions
NOTE Other functions are listed below, some straightforward commands are described only in this table and can simply be activated by calling:
api?mode=FUNCTION
Function | Description |
---|---|
version |
Get version of running SABnzbd |
auth |
Get authentication methods available for interaction with the API |
warnings | Get all active warnings |
warnings clear | True/False Clear all active warnings |
get_cats | Get all categories |
get_scripts | Get all scripts |
server_stats | Get download statistics |
showlog | Get the anonymized log file |
del_config | True/False Delete a configuration item within the "servers", "rss", "categories", or "sorters" sections. |
get_config | Get value of configuration item |
set_config | Set configuration item to value |
set_config_default | True/False Reset config item to default value |
shutdown |
True/False Shutdown SABnzbd |
restart |
True/False Restart SABnzbd |
restart_repair |
True/False Restart SABnzbd and perform a queue repair |
pause_pp |
True/False Pause post-processing queue |
resume_pp |
True/False Resume post-processing queue |
rss_now |
True/False Fetch and process all RSS feeds |
watched_now |
True/False Scan Watched Folder now |
reset_quota |
True/False Reset the user defined quota to 0 |
mode=config name=set_apikey |
Reset the API key, returns the new key |
mode=config name=set_nzbkey |
Reset the NZB key, returns the new key |
mode=config name=regenerate_certs |
True/False Regenerate the self-signed certificate for HTTPS connection to interface, requires SABnzbd restart to take effect |
translate | Translate a text to user's locale |
Get all categories
api?mode=get_cats
Get all scripts
api?mode=get_scripts
Download statistics
Return download statistics in bytes, total and per-server.
api?mode=server_stats
Get the anonymized log file
The log file is automatically anonymized and a copy of the sabnzbd.ini
is attached.
NOTE This call ignores the output
parameter, it will always serve the file as a download.
api?mode=showlog
Delete a configuration item within the "servers", "rss", "categories", or "sorters" sections.
Used to delete an entry from the limited sections.
Example of deleting aservers
by keyword:
api?mode=del_config§ion=servers&keyword=ServerName
Example of deleting a rss
by keyword:
api?mode=del_config§ion=rss&keyword=Feed1
Example of deleting a categories
by keyword:
api?mode=del_config§ion=categories&keyword=audio
If you attempt to delete the default category *
from the categories
section, the system will replace the default categories.
api?mode=del_config§ion=categories&keyword=*
Get config item(s)
You can read the whole configuration, a sub-set or a single setting.
NOTE You will never receive passwords, each character will be replaced by ***
characters. You can set new passwords through the set_config call.
api?mode=get_config
All elements in misc
section:
api?mode=get_config§ion=misc
Example of filtering the server settings by keyword:
api?mode=get_config§ion=servers&keyword=ServerName
Set config item
In order to change a setting, you need to provide the section
and keyword
of the setting:
api?mode=set_config§ion=SECTION&keyword=KEYWORD&value=VALUE
Returns the new setting when saved successfully.
For example, changing the Cleanup-list to .sfv,.nzb,.nfo,.ext
would look like this:
api?mode=set_config§ion=misc&keyword=cleanup_list&value=.sfv,.nzb,.nfo,.ext
Setting server, RSS feed, category, or sorter settings
Changing settings for these sections is a bit different and requires one to specify the correct name
of the server, RSS feed, category, or sorter. This name
you can find in between double square brackets in the relevant section of your sabnzbd.ini
, where it will for example say [[news.newshosting.com]]
within the [servers]
section, or [[Feed1]]
in the [rss]
section, and so on. Below the name you can see all variables you could set via the API for an item in that section. If the specified name
doesn't match an existing one in the given section, it will be added there as a new item.
Server example:
api?mode=set_config§ion=servers&name=SERVER_NAME&username=VALUE_1&connections=VALUE_2
Category example:
api?mode=set_config§ion=categories&name=CATEGORY_NAME&dir=CATEGORY_DIR
RSS feed example:
api?mode=set_config§ion=rss&name=FEED_NAME&enable=VALUE_1&pp=VALUE_2
Sorter example:
api?mode=set_config§ion=sorters&name=SORTER_NAME&sort_string=VALUE_1&sort_cats=VALUE_2&sort_type=VALUE_3
Reset config item to default value True/False
NOTE Currently only for settings in the misc
section of the config. Can accept multiple keywords to reset.
api?mode=set_config_default&keyword=SETTING_1&keyword=SETTING_2
Get all active warnings
api?mode=warnings
Clear all active warnings True/False
api?mode=warnings&name=clear
Translate a text
Translate any text known to SABnzbd from English to the locale setting of the user.
api?mode=translate&value=Watched%20Folder
Will return for Dutch: