SickBeard API

Command Description
episode Displays the information of a specific episode.
episode.search Initiate a manual search for a specific episode.
episode.setstatus Set the status of an episode.
exceptions Display scene exceptions for all or a given show.
future Display the upcoming episodes.
history Display SickBeard's downloaded/snatched history.
history.clear Clear SickBeard's history.
history.trim Trim SickBeard's history.
logs View SickBeard's log.
show Display information for a given shown.
show.addexisting Add a show in SickBeard with an existing folder.
show.addnew Add a show in SickBeard.
show.cache Display if the poster/banner SickBeard's image cache is valid.
show.delete Delete a show from SickBeard.
show.getbanner Retrieve the shows banner from SickBeard's cache.
show.getposter Retrieve the shows poster from SickBeard's cache.
show.getquality Get quality settings for a show in SickBeard.
show.pause Set a show's paused state in SickBeard.
show.refresh Refresh a show in SickBeard.
show.seasonlist Display the season list for a given show.
show.seasons Display a listing of episodes for all or a given season.
show.setquality Set quality for a show in SickBeard.
show.stats Display episode statistics for a given show.
show.update Update a show in SickBeard.
shows Display all shows in SickBeard.
shows.stats Display the global episode and show statistics.
sb Display misc SickBeard related information.
sb.addrootdir Add a root (parent) directory.
sb.checkscheduler Query the SickBeard scheduler.
sb.deleterootdir Delete a root (parent) directory.
sb.forcesearch Force the episode search early.
sb.getdefaults Get SickBeard user defaults.
sb.getmessages Get messages from the notification queue.
sb.getrootdirs Get root (parent) directories set by user.
sb.pausebacklog Pause the backlog search.
sb.ping Check to see if SickBeard is running.
sb.restart Restart SickBeard.
sb.searchtvdb Search TVDB for a show name or tvdbid.
sb.setdefaults Set SickBeard user defaults.
sb.shutdown Shutdown SickBeard.
   
Special Commands Description
debug Display cherrypy's traceback if thrown.
profile Call profiler on API command and output to console.
help Display the help for the requested API command.
callback / jsonp Used for JSONP requests to provide a callback for the API output.
   
Miscellaneous Description
change log SickBeard API change log.
api builder SickBeard's API Builder tool.
advanced api Advanced usage of the API.
disclaimer Disclaimer about the API.
   





Change Log

This section is to provider developers a quick overview on SB API changes.

Updates to handle the 1080p related quality changes (rawhdtv, fullhdtv, fullhdwebdl). Build 500

Modified Commands

Changing of the SB-API version number scheme to a whole number due to python's IEEE floating-point representation error.
Modifications made to several commands for the custom_naming related changes. Build 497

Added Commands

  • callback
  • global command for jsonp style request

Modified Commands

  • sb.getdefaults
  • param season_folder was replaced with flatten_folders
  • sb.setdefaults
  • param season_folder was replaced with flatten_folders
  • show.addexisting
  • param season_folder was replaced with flatten_folders
  • show.addnew
  • param season_folder was replaced with flatten_folders
  • episode.setstatus
  • param episode was changed from required to optional
  • param force was added to support the replacement of previously downloaded episodes (now by default we skip replacing)
  • episode
  • added file_size, file_size_human and release_name to output

Minor tweaks and a few new commands. Build 492

Added Commands

Modified Commands

  • future
  • Added support to show or not show paused eps in the coming eps section of the API
  • sb.setdefaults
  • Added the ability to get/set the comping ep display default setting with regards to paused shows (future_show_paused)
Initial API design, was included to the 491 build.






Displays the information of a specific episode matching the corresponding tvdbid, season and episode number.

Parameter Description
tvdbid required

tvdbid unique show id

season required

season number

episode required

episode number

full_path optional

[0], 1

  • 0 - show only the filename for the location
  • 1 - show full path for location

Example Request

/api/1234/?cmd=episode&tvdbid=101501&season=4&episode=8&full_path=1
{
    "data": {
        "airdate": "2012-04-06", 
        "description": "Might an examination of Leonardo Da Vinci's masterful paintings, highly technical hand-drawn sketches, and private journals reveal knowledge of otherworldly technology and extraterrestrial beings?", 
        "file_size": 1369797174, 
        "file_size_human": "1.28 GB", 
        "location": "S:\\TV\\Ancient Aliens\\Season 04\\Ancient.Aliens.S04E08.HD.TV.mkv", 
        "name": "The Da Vinci Conspiracy", 
        "quality": "HD TV", 
        "release_name": "Ancient.Aliens.S04E08.720p.HDTV.x264-DiVERGE", 
        "status": "Downloaded"
    }, 
    "message": "", 
    "result": "success"
}


Initiate a search for a specific episode matching the corresponding tvdbid, season and episode number.

Parameter Description
tvdbid required

tvdbid unique show id

season required

season number

episode required

episode number

Example Request

/api/1234/?cmd=episode.search&tvdbid=194751&season=2011&episode=105
{
    "data": {}, 
    "message": "Unable to find episode", 
    "result": "failure"
}


Set the status of an epsiode or season.

Parameter Description
tvdbid required

tvdbid unique show id

season required

season number

episode optional

episode number
if an episode is not provided, then the whole seasons' status will be set.

status required

wanted, skipped, archived, ignored

force optional

[0], 1

  • 0 - skip setting the status for existing episodes
  • 1 - force status to be set for existing episodes (can replace downloaded episodes)

Example Request

/api/1234/?cmd=episode.setstatus&tvdbid=71173&season=1&status=wanted
{
    "data": [
        {
            "episode": 1, 
            "message": "Refusing to change status because it is already marked as DOWNLOADED", 
            "result": "failure", 
            "season": 1, 
            "status": "Downloaded (SD DVD)"
        }, 
        {
            "episode": 2, 
            "message": "Refusing to change status because it is already marked as DOWNLOADED", 
            "result": "failure", 
            "season": 1, 
            "status": "Downloaded (SD DVD)"
        }, 
        {
            "episode": 3, 
            "message": "Refusing to change status because it is already marked as DOWNLOADED", 
            "result": "failure", 
            "season": 1, 
            "status": "Downloaded (SD DVD)"
        }, 
...
        {
            "episode": 22, 
            "message": "", 
            "result": "success", 
            "season": 1, 
            "status": "Wanted"
        }, 
        {
            "episode": 23, 
            "message": "", 
            "result": "success", 
            "season": 1, 
            "status": "Wanted"
        }, 
        {
            "episode": 24, 
            "message": "", 
            "result": "success", 
            "season": 1, 
            "status": "Wanted"
        }
    ], 
    "message": "Failed to set all or some status. Check data. Backlog started", 
    "result": "failure"
}


Display scene exceptions for all or a given show.

Parameter Description
tvdbid optional

tvdbid unique show id

Example Request

/api/1234/?cmd=exceptions&tvdbid=248261
{
    "data": [
        "National Terrorism Strike Force: San Diego: Sport Utility Vehicle", 
        "National Terrorism Strike Force: San Diego: SUV", 
        "NTSF:SD:SUV::", 
        "NTSF SD SUV"
    ], 
    "message": "", 
    "result": "success"
}


Display the upcoming episodes for the shows currently added in the users' database.

Parameter Description
sort optional

[date], network, name

type optional

multiple types can be passed when delimited by |

  • missed - show's date is older than today
  • today - show's date is today
  • soon - show's date greater than today but less than a week
  • later - show's date greater than a week

[missed|today|soon|later]

paused optional
  • 0 - do not show paused
  • 1 - show paused

if not set then the user's default setting in SickBeard is used (future_show_paused)

Example Request

/api/1234/?cmd=future&sort=date&type=today|missed
{
    "data": {
        "missed": [
            {
                "airdate": "2011-11-21", 
                "airs": "Monday 8:00 PM", 
                "ep_name": "The Rebound Girl", 
                "ep_plot": "Ted and Barney discuss making a life-changing decision together, and Robin tries to discourage Marshall and Lily from moving to Long Island.", 
                "episode": 11, 
                "network": "CBS", 
                "paused": 0, 
                "quality": "HD", 
                "season": 7, 
                "show_name": "How I Met Your Mother", 
                "show_status": "Continuing", 
                "tvdbid": 75760, 
                "weekday": 1
            }, 
            {
                "airdate": "2011-11-21", 
                "airs": "Monday 10:00 PM", 
                "ep_name": "Kill Shot", 
                "ep_plot": "A sniper on a killing spree is terrorizing New York City. With the clock ticking down to the next murder and nothing to go on except a killer with no apparent motive but to instill terror, this could prove the team's toughest case yet. The hunt is made even more complicated when Beckett begins to experience increasingly strong moments of PTSD - moments she tries hard to hide from Castle and the detectives.", 
                "episode": 9, 
                "network": "ABC", 
                "paused": 1, 
                "quality": "SD", 
                "season": 4, 
                "show_name": "Castle (2009)", 
                "show_status": "Continuing", 
                "tvdbid": 83462, 
                "weekday": 1
            }
        ], 
        "today": [
            {
                "airdate": "2011-11-22", 
                "airs": "Monday 8:00 PM", 
                "ep_name": "Smoked Turkey", 
                "ep_plot": "Dixon tries to pursue a relationship with a resistant Adrianna, while Ivy and Raj\u2019s arguing takes a toll on their relationship. Liam plans a holiday dinner for the gang, and an unexpected guest shows up. Meanwhile, Naomi goes to extremes to prove her love to Austin.", 
                "episode": 10, 
                "network": "The CW", 
                "paused": 0, 
                "quality": "SD", 
                "season": 4, 
                "show_name": "90210", 
                "show_status": "Continuing", 
                "tvdbid": 82716, 
                "weekday": 2
            }
        ]
    }, 
    "message": "", 
    "result": "success"
}


Display SickBeard's downloaded/snatched history.

Parameter Description
limit optional

[100]

There is an artificial max limit of 100 currently imposed for the limit command to ensure performance.
Use 0 if you want to see all history, note this could cause heavy cpu/disk usage for the user as well as cause your application to time out while it's waiting for the data.

type optional

downloaded, snatched

Example Request

/api/1234/?cmd=history&limit=2
{
    "data": [
        {
            "date": "2011-08-19 12:58", 
            "episode": 4, 
            "provider": "-1", 
            "quality": "SD TV", 
            "resource": "project.runway.s09e04.all.about.nina.hdtv.xvid-crimson.avi", 
            "resource_path": "C:\\Users\\sickbeard\\Documents\\downloads\\complete\\TV\\Project.Runway.S09E04.All.About.Nina.HDTV.XviD-CRiMSON", 
            "season": 9, 
            "show_name": "Project Runway", 
            "status": "Downloaded", 
            "tvdbid": 74285
        }, 
        {
            "date": "2011-08-19 12:25", 
            "episode": 4, 
            "provider": "NZBs.org", 
            "quality": "SD TV", 
            "resource": "Project.Runway.S09E04.All.About.Nina.HDTV.XviD-CRiMSON", 
            "resource_path": "", 
            "season": 9, 
            "show_name": "Project Runway", 
            "status": "Snatched", 
            "tvdbid": 74285
        }
    ], 
    "message": "", 
    "result": "success"
}


Clear SickBeard's history.

Parameter Description

Example Request

/api/1234/?cmd=history.clear
{
    "data": {}, 
    "message": "History Cleared", 
    "result": "success"
}


Trim SickBeard's history by removing entries greater than 30 days old.

Parameter Description

Example Request

/api/1234/?cmd=history.trim
{
    "data": {}, 
    "message": "Removed history entries greater than 30 days old", 
    "result": "success"
}


View SickBeard's log.

Parameter Description
min_level optional

debug, info, warning, [error]

The minimum level classification of log entries to show, with each level inherting its above level.

Example Request

/api/1234/?cmd=logs&min_level=info
{
    "data": [
        "Aug-10 02:57:36 INFO     SHOWQUEUE-REFRESH :: No new cache images needed, not retrieving new ones", 
        "Aug-10 02:57:36 INFO     SHOWQUEUE-REFRESH :: Checking & filling cache for show True Blood", 
        "Aug-10 02:57:36 INFO     SHOWQUEUE-REFRESH :: 82283: Writing NFOs for all episodes", 
        "Aug-10 02:57:36 INFO     SHOWQUEUE-REFRESH :: 82283: Loading all episodes with a location from the database", 
        "Aug-10 02:57:35 INFO     SHOWQUEUE-REFRESH :: 82283: Loading all episodes from the show directory S:\\TV\\True Blood", 
        "Aug-10 02:57:35 INFO     SHOWQUEUE-REFRESH :: Performing refresh on True Blood", 
        "Aug-10 02:54:36 WARNING  SHOWQUEUE-FORCE-UPDATE :: Unable to add TVRage info: Show is already in database, not adding the TVRage info", 
        "Aug-10 02:54:36 INFO     SHOWQUEUE-FORCE-UPDATE :: Checking the last aired episode to see if the dates match between TVDB and TVRage", 
        "Aug-10 02:54:32 INFO     SHOWQUEUE-FORCE-UPDATE :: 95011: Loading all episodes from theTVDB...", 
        "Aug-10 02:54:30 INFO     SHOWQUEUE-FORCE-UPDATE :: Loading all episodes from the DB", 
        "Aug-10 02:54:30 INFO     SHOWQUEUE-FORCE-UPDATE :: 95011: Loading show info from theTVDB", 
        "Aug-10 02:54:30 INFO     SHOWQUEUE-FORCE-UPDATE :: Beginning update of Modern Family", 
        "Aug-10 02:54:25 ERROR    SEARCHQUEUE-BACKLOG-248261 :: No NZB/Torrent providers found or enabled in the sickbeard config. Please check your settings.", 
        "Aug-10 02:54:25 INFO     SEARCHQUEUE-BACKLOG-248261 :: Searching for stuff we need from NTSF:SD:SUV:: season 1"
    ], 
    "message": "", 
    "result": "success"
}


Display information for a given show.

Parameter Description
tvdbid required

tvdbid unique show id

Example Request

/api/1234/?cmd=show&tvdbid=79349
{
    "data": {
        "air_by_date": 0, 
        "airs": "Sunday 9:00 PM", 
        "cache": {
            "banner": 1, 
            "poster": 1
        }, 
        "flatten_folders": 0, 
        "genre": [
            "Action and Adventure", 
            "Drama"
        ], 
        "language": "en", 
        "location": "S:\\TV\\Dexter", 
        "network": "Showtime", 
        "next_ep_airdate": "2013-06-30", 
        "paused": 0, 
        "quality": "HD720p", 
        "quality_details": {
            "archive": [], 
            "initial": [
                "hdtv", 
                "hdwebdl", 
                "hdbluray"
            ]
        }, 
        "season_list": [
            8, 
            7, 
            6, 
            5, 
            4, 
            3, 
            2, 
            1, 
            0
        ], 
        "show_name": "Dexter", 
        "status": "Continuing", 
        "tvrage_id": 7926, 
        "tvrage_name": "Dexter"
    }, 
    "message": "", 
    "result": "success"
}


Add a show to SickBeard using an existing folder.

Parameter Description
tvdbid required

tvdbid unique show id

location required

path to existing show folder

flatten_folders optional
  • 0 - use season folders if part of rename string
  • 1 - do not use season folders

if not provided then the config setting (default) is used

initial optional

multiple types can be passed when delimited by |

sdtv, sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray, unknown

if not provided then the config setting (default) is used

archive optional

multiple types can be passed when delimited by |

sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray

if not provided then the config setting (default) is used

Example Request

/api/1234/?cmd=show.addexisting&tvdbid=80348&location=S:\TV\Chuck&flatten_folders=0&initial=hdtv&archive=hdwebdl|hdbluray
{
    "data": {
        "name": "Chuck"
    }, 
    "message": "Chuck has been queued to be added", 
    "result": "success"
}


Add a show to SickBeard providing the parent directory where the tv shows folder should be created.

Parameter Description
tvdbid required

tvdbid unique show id

location optional

path to existing folder to store show

if not provided then the config setting (default) is used -- if valid

lang optional

two letter tvdb language, en = english

[en], zh, hr, cs, da, nl, fi, fr, de, el, he, hu, it, ja, ko, no, pl, pt, ru, sl, es, sv, tr

flatten_folders optional
  • 0 - use season folders if part of rename string
  • 1 - do not use season folders

if not provided then the config setting (default) is used

status optional

wanted, skipped, archived, ignored

if not provided then the config setting (default) is used

initial optional

multiple types can be passed when delimited by |

sdtv, sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray, unknown

if not provided then the config setting (default) is used

archive optional

multiple types can be passed when delimited by |

sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray

if not provided then the config setting (default) is used

Example Request

/api/1234/?cmd=show.addnew&tvdbid=101501&location=S:\TV&status=archived
{
    "data": {
        "name": "Ancient Aliens"
    }, 
    "message": "Ancient Aliens has been queued to be added", 
    "result": "success"
}


Display if the poster/banner SickBeard's image cache is valid.

Parameter Description
tvdbid required

tvdbid unique show id

Example Request

/api/1234/?cmd=show.cache&tvdbid=224041
{
    "data": {
        "banner": 1, 
        "poster": 0
    }, 
    "message": "", 
    "result": "success"
}


Delete a show from SickBeard.

Parameter Description
tvdbid required

tvdbid unique show id

Example Request

/api/1234/?cmd=show.delete&tvdbid=80348
{
    "data": {}, 
    "message": "Chuck has been deleted", 
    "result": "success"
}


Retrieve the stored banner image from SickBeard's cache for a particular tvdbid.
If no image is found then the default sb banner is shown.

Parameter Description
tvdbid required

tvdbid unique show id

Example Request

/api/1234/?cmd=show.getbanner&tvdbid=82066


Retrieve the stored poster image from SickBeard's cache for a particular tvdbid.
If no image is found then the default sb poster is shown.

Parameter Description
tvdbid required

tvdbid unique show id

Example Request

/api/1234/?cmd=show.getposter&tvdbid=82066


Get quality settings of a show in SickBeard.

Parameter Description
tvdbid required

tvdbid unique show id

Example Request

/api/1234/?cmd=show.getquality&tvdbid=80348
{
    "data": {
        "initial": [
            "hdtv", 
            "hdwebdl", 
            "hdbluray"
        ], 
        "archive": [
            "hdwebdl", 
            "hdbluray"
        ]
    }, 
    "message": "", 
    "result": "success"
}


Set a show's paused state in SickBeard.

Parameter Description
tvdbid required

tvdbid unique show id

pause optional

[0],1

  • 0 - unpause show
  • 1 - pause show

Example Request

/api/1234/?cmd=show.pause&tvdbid=76707&pause=0
{
    "data": {}, 
    "message": "Fear Factor has been unpaused", 
    "result": "success"
}


Refresh a show in SickBeard by rescanning local files.

Parameter Description
tvdbid required

tvdbid unique show id

Example Request

/api/1234/?cmd=show.refresh&tvdbid=82283
{
    "data": {}, 
    "message": "True Blood has queued to be refreshed", 
    "result": "success"
}


Display the season list for a given show.

Parameter Description
tvdbid required

tvdbid unique show id

sort optional

asc, [desc]

Example Request

/api/1234/?cmd=show.seasonlist&tvdbid=80621
{
    "data": [
        4, 
        3, 
        2, 
        1, 
        0
    ], 
    "message": "", 
    "result": "success"
}


Display a listing of episodes for all or a given season.

Parameter Description
tvdbid required

tvdbid unique show id

season optional

season number

Example Request

/api/1234/?cmd=show.seasons&tvdbid=182061&season=2
{
    "data": {
        "1": {
            "airdate": "2011-09-04", 
            "name": "Something Wicked This Fae Comes", 
            "quality": "HD TV", 
            "status": "Downloaded"
        }, 
        "2": {
            "airdate": "2011-09-11", 
            "name": "I Fought the Fae (And the Fae Won)", 
            "quality": "N/A", 
            "status": "Wanted"
        }, 
        "3": {
            "airdate": "2011-09-18", 
            "name": "Scream a Little Dream", 
            "quality": "N/A", 
            "status": "Unaired"
        }, 
        "4": {
            "airdate": "2011-09-25", 
            "name": "Episode 4", 
            "quality": "N/A", 
            "status": "Unaired"
        }, 
        "5": {
            "airdate": "", 
            "name": "Episode 5", 
            "quality": "N/A", 
            "status": "Skipped"
        }
    }, 
    "message": "", 
    "result": "success"
}


Set desired quality of a show in SickBeard.

Parameter Description
tvdbid required

tvdbid unique show id

initial optional

multiple types can be passed when delimited by |

sdtv, sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray, unknown

archive optional

multiple types can be passed when delimited by |

sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray

Example Request

/api/1234/?cmd=show.setquality&tvdbid=79488&initial=sdtv|sddvd&archive=sddvd|hdwebdl|hdbluray
{
    "data": {}, 
    "message": "30 Rock quality has been changed to Custom", 
    "result": "success"
}


Display episode statistics for a given show.

Parameter Description
tvdbid required

tvdbid unique show id

Example Request

/api/1234/?cmd=show.stats&tvdbid=80270
{
    "data": {
        "archived": 0, 
        "downloaded": {
            "1080p_bluray": 0, 
            "1080p_hdtv": 0, 
            "1080p_web-dl": 0, 
            "720p_bluray": 0, 
            "720p_web-dl": 2, 
            "hd_tv": 34, 
            "rawhd_tv": 0, 
            "sd_dvd": 13, 
            "sd_tv": 50, 
            "total": 99, 
            "unknown": 0
        }, 
        "ignored": 0, 
        "skipped": 0, 
        "snatched": {
            "1080p_bluray": 0, 
            "1080p_hdtv": 0, 
            "1080p_web-dl": 0, 
            "720p_bluray": 0, 
            "720p_web-dl": 0, 
            "hd_tv": 0, 
            "rawhd_tv": 0, 
            "sd_dvd": 0, 
            "sd_tv": 0, 
            "total": 0, 
            "unknown": 0
        }, 
        "total": 99, 
        "unaired": 0, 
        "wanted": 0
    }, 
    "message": "", 
    "result": "success"
}


Update a show in SickBeard by pulling down information from TVDB and rescan local files.

Parameter Description
tvdbid required

tvdbid unique show id

Example Request

/api/1234/?cmd=show.update&tvdbid=95011
{
    "data": {}, 
    "message": "Modern Family has queued to be updated", 
    "result": "success"
}


Display a list of all shows in SickBeard.

Parameter Description
sort optional

[id], name

  • id - sort by tvdbid
  • name - sort by show name
paused optional
  • 0 - show only non paused
  • 1 - show only paused

if not set then both paused and non paused are shown

Example Request

/api/1234/?cmd=shows
{
    "data": {
        "71489": {
            "air_by_date": 0, 
            "cache": {
                "banner": 1, 
                "poster": 1
            }, 
            "language": "en", 
            "network": "USA Network", 
            "next_ep_airdate": "", 
            "paused": 0, 
            "quality": "HD720p", 
            "show_name": "Law & Order: Criminal Intent", 
            "status": "Ended", 
            "tvdbid": 71489, 
            "tvrage_id": 4203, 
            "tvrage_name": "Law & Order: Criminal Intent"
        }, 
        "140141": {
            "air_by_date": 0, 
            "cache": {
                "banner": 0, 
                "poster": 0
            }, 
            "language": "fr", 
            "network": "CBS", 
            "next_ep_airdate": "2012-01-15", 
            "paused": 0, 
            "quality": "Any", 
            "show_name": "Undercover Boss (US)", 
            "status": "Continuing", 
            "tvdbid": 140141, 
            "tvrage_id": 22657, 
            "tvrage_name": "Undercover Boss"
        }, 
...
        "194751": {
            "air_by_date": 1, 
            "cache": {
                "banner": 1, 
                "poster": 1
            }, 
            "language": "en", 
            "network": "TBS Superstation", 
            "next_ep_airdate": 2011-11-28", 
            "paused": 0, 
            "quality": "Custom", 
            "show_name": "Conan (2010)", 
            "status": "Continuing", 
            "tvdbid": 194751, 
            "tvrage_id": 0, 
            "tvrage_name": ""
        }, 
        "248261": {
            "air_by_date": 0, 
            "cache": {
                "banner": 1, 
                "poster": 1
            }, 
            "language": "en", 
            "network": "Cartoon Network", 
            "next_ep_airdate": "", 
            "paused": 1, 
            "quality": "HD", 
            "show_name": "NTSF:SD:SUV::", 
            "status": "Continuing", 
            "tvdbid": 248261, 
            "tvrage_id": 28439, 
            "tvrage_name": "NTSF:SD:SUV"
        }
    }, 
    "message": "", 
    "result": "success"
}


Display global episode and show statistics.

Parameter Description

Example Request

/api/1234/?cmd=shows.stats
{
    "data": {
        "ep_downloaded": 2754, 
        "ep_total": 2808, 
        "shows_active": 49, 
        "shows_total": 61
    }, 
    "message": "", 
    "result": "success"
}


Display misc SickBeard related information. This is also the default command that the api will show if none is specified.

Parameter Description

Example Request

/api/1234/?cmd=sb
{
    "data": {
        "api_commands": [
            "episode", 
            "episode.search", 
            "episode.setstatus", 
            "exceptions", 
            "future", 
            "help", 
            "history", 
            "history.clear", 
            "history.trim", 
            "logs", 
            "sb", 
            "sb.addrootdir", 
            "sb.checkscheduler", 
            "sb.deleterootdir", 
            "sb.forcesearch", 
            "sb.getdefaults", 
            "sb.getmessages", 
            "sb.getrootdirs", 
            "sb.pausebacklog", 
            "sb.ping", 
            "sb.restart", 
            "sb.searchtvdb", 
            "sb.setdefaults", 
            "sb.shutdown", 
            "show", 
            "show.addexisting", 
            "show.addnew", 
            "show.cache", 
            "show.delete", 
            "show.getbanner", 
            "show.getposter", 
            "show.getquality", 
            "show.pause", 
            "show.refresh", 
            "show.seasonlist", 
            "show.seasons", 
            "show.setquality", 
            "show.stats", 
            "show.update", 
            "shows", 
            "shows.stats"
        ], 
        "api_version": 4, 
        "sb_version": "master"
    }, 
    "message": "", 
    "result": "success"
}


Add a root (parent) directory (only if it is a valid location), and set as the default root dir if requested to SickBeard's config.

Parameter Description
location required

full path to a root (parent) directory of tv shows

default optional

[0], 1

  • 0 - do not change global default
  • 1 - set location as the new global default

Example Request

/api/1234/?cmd=sb.addrootdir&location=C:\Temp&default=1
{
    "data": [
        {
            "default": 0, 
            "location": "S:\\Invalid_Location", 
            "valid": 0
        }, 
        {
            "default": 1, 
            "location": "C:\\Temp", 
            "valid": 1
        }, 
        {
            "default": 0, 
            "location": "D:\\SickBeard_TV", 
            "valid": 1
        }
    ], 
    "message": "Root directories updated", 
    "result": "success"
}


Query the SickBeard scheduler.

Parameter Description

Example Request

/api/1234/?cmd=sb.checkscheduler
{
    "data": {
        "backlog_is_paused": 0, 
        "backlog_is_running": 1, 
        "last_backlog": "2011-09-18", 
        "next_backlog": "2011-10-09", 
        "next_search": "16:38:49", 
        "search_is_running": 0
    }, 
    "message": "", 
    "result": "success"
}


Delete a root (parent) directory from the root directory list in SickBeard's config.

Parameter Description
location required

full path to a root (parent) directory of tv shows

Example Request

/api/1234/?cmd=sb.deleterootdir&location=C:\Temp
{
    "data": [
        {
            "default": 0, 
            "location": "S:\\Invalid_Location", 
            "valid": 0
        }, 
        {
            "default": 1, 
            "location": "D:\\SickBeard_TV", 
            "valid": 1
        }
    ], 
    "message": "Root directory deleted", 
    "result": "success"
}


Force the episode search early.

Parameter Description

Example Request

/api/1234/?cmd=sb.forcesearch
{
    "data": {}, 
    "message": "Episode search forced", 
    "result": "success"
}


Get default settings from SickBeard's config.

Parameter Description

Example Request

/api/1234/?cmd=sb.getdefaults
{
    "data": {
        "archive": [
            "fullhdtv", 
            "fullhdwebdl", 
            "fullhdbluray"
        ], 
        "flatten_folders": 0, 
        "future_show_paused": 1, 
        "initial": [
            "hdtv", 
            "hdwebdl", 
            "hdbluray"
        ], 
        "status": "ignored"
    }, 
    "message": "", 
    "result": "success"
}


Get un-claimed messages from the ui.notification queue.

Parameter Description

Example Request

/api/1234/?cmd=sb.getmessages
{
    "data": [
        {
            "message": "This is test number 2", 
            "title": "Test 2", 
            "type": "error"
        }, 
        {
            "message": "This is test number 1", 
            "title": "Test 1", 
            "type": "notice"
        }
    ], 
    "message": "", 
    "result": "success"
}


Get the root (parent) directories from SickBeard's config, test if valid, and which is the default.

Parameter Description

Example Request

/api/1234/?cmd=sb.getrootdirs
{
    "data": [
        {
            "default": 0, 
            "location": "S:\\Invalid_Location", 
            "valid": 0
        }, 
        {
            "default": 0, 
            "location": "C:\\Temp", 
            "valid": 1
        }, 
        {
            "default": 1, 
            "location": "D:\\SickBeard_TV", 
            "valid": 1
        }
    ], 
    "message": "", 
    "result": "success"
}


Pause the backlog search.

Parameter Description
pause optional

[0], 1

  • 0 - unpause the backlog
  • 1 - pause the backlog

Example Request

/api/1234/?cmd=sb.pausebacklog&pause=1
{
    "data": {}, 
    "message": "Backlog Paused", 
    "result": "success"
}


Check to see if SickBeard is running.

Parameter Description

Example Request

/api/1234/?cmd=sb.ping
{
    "data": {
        "pid": 13152
    }, 
    "message": "Pong", 
    "result": "success"
}


Restart SickBeard.

Parameter Description

Example Request

/api/1234/?cmd=sb.restart
{
    "data": {}, 
    "message": "SickBeard is restarting...", 
    "result": "success"
}


Search TVDB for a show with a given string or tvdbid.

Parameter Description
name optional

show name

tvdbid optional

tvdbid unique show id

lang optional

two letter tvdb language, en = english

[en], zh, hr, cs, da, nl, fi, fr, de, el, he, hu, it, ja, ko, no, pl, pt, ru, sl, es, sv, tr

Example Request

/api/1234/?cmd=sb.searchtvdb&name=Leno&lang=en
{
    "data": {
        "langid": 7, 
        "results": [
            {
                "first_aired": "1992-05-25", 
                "name": "The Tonight Show with Jay Leno", 
                "tvdbid": 70336
            }, 
            {
                "first_aired": "2009-09-14", 
                "name": "The Jay Leno Show", 
                "tvdbid": 113921
            }
        ]
    }, 
    "message": "", 
    "result": "success"
}


Set default settings for SickBeard.

Parameter Description
future_show_paused optional
  • 0 - exclude paused shows on coming ep
  • 1 - include paused shows on coming ep
status optional

wanted, skipped, archived, ignored

flatten_folders optional
  • 0 - use season folders if part of rename string
  • 1 - do not use season folders
initial optional

multiple types can be passed when delimited by |

sdtv, sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray, unknown

archive optional

multiple types can be passed when delimited by |

sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray

Example Request

/api/1234/?cmd=sb.setdefaults&status=skipped&flatten_folders=0&initial=sdtv|sddvd
{
    "data": {}, 
    "message": "Saved Defaults", 
    "result": "success"
}


Shutdown SickBeard.

Parameter Description

Example Request

/api/1234/?cmd=sb.shutdown
{
    "data": {}, 
    "message": "SickBeard is shutting down...", 
    "result": "success"
}





Special Commands

There are a few special commands that when passed and set to 1, they modify how the API processor functions.

When passing an API command generally you get back either a; success, failure, timeout, error, fatal, or denied result.
This keeps things predictable and nice, however if you wanted to get the traceback returned instead you would need to use debug.
This would allow you to test, see what the problem and fix it without having to replicate the issue manually.
I would not recommend using debug for any production code as this would break json processing as predicting the result would be hard.

/api/1234/?cmd=xxx&debug=1
{
xxx
}


The profile option when enabled attaches a profiler before the command is issued and detaches when completed.
This will analyze the function being called and report back various stats.
The results of the call dispatcher is displayed to the console and not the API caller.
For details on how to read the output visit: http://docs.python.org/library/profile.html

/api/1234/?cmd=shows.stats&profile=1
{
    "data": {
        "ep_downloaded": 2962, 
        "ep_total": 3891, 
        "shows_active": 48, 
        "shows_total": 62
    }, 
    "message": "", 
    "result": "success"

}

console shows:
*** PROFILER RESULTS ***
call_dispatcher (C:\Program Files (x86)\Sick-Beard\sickbeard\webapi.py:181)
function called 1 times

         471 function calls in 0.024 seconds

   Ordered by: cumulative time, internal time, call count
   List reduced from 91 to 40 due to restriction <40>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000    0.024    0.024 webapi.py:181(call_dispatcher)
        1    0.000    0.000    0.024    0.024 webapi.py:2255(run)
        2    0.000    0.000    0.023    0.012 db.py:93(select)
        2    0.000    0.000    0.023    0.012 db.py:57(action)
        2    0.023    0.011    0.023    0.011 {method 'execute' of 'sqlite3.Connection' objects}
        5    0.000    0.000    0.001    0.000 logger.py:178(log)
        5    0.000    0.000    0.001    0.000 logger.py:140(log)
        5    0.000    0.000    0.001    0.000 __init__.py:1110(debug)
        5    0.000    0.000    0.000    0.000 __init__.py:1231(_log)
        1    0.000    0.000    0.000    0.000 {method 'close' of 'sqlite3.Connection' objects}
        5    0.000    0.000    0.000    0.000 __init__.py:1252(handle)
        1    0.000    0.000    0.000    0.000 db.py:48(__init__)
        5    0.000    0.000    0.000    0.000 __init__.py:1284(callHandlers)
        5    0.000    0.000    0.000    0.000 __init__.py:731(handle)
        1    0.000    0.000    0.000    0.000 {_sqlite3.connect}
        5    0.000    0.000    0.000    0.000 __init__.py:917(emit)
        5    0.000    0.000    0.000    0.000 __init__.py:830(emit)
        5    0.000    0.000    0.000    0.000 __init__.py:1218(makeRecord)
        5    0.000    0.000    0.000    0.000 __init__.py:242(__init__)
        5    0.000    0.000    0.000    0.000 __init__.py:708(format)
        5    0.000    0.000    0.000    0.000 __init__.py:451(format)
        5    0.000    0.000    0.000    0.000 __init__.py:1531(getLogger)
        5    0.000    0.000    0.000    0.000 __init__.py:994(getLogger)
        5    0.000    0.000    0.000    0.000 __init__.py:823(flush)
        5    0.000    0.000    0.000    0.000 __init__.py:1197(findCaller)
        5    0.000    0.000    0.000    0.000 {method 'flush' of 'file' objects}
        5    0.000    0.000    0.000    0.000 ntpath.py:196(basename)
        5    0.000    0.000    0.000    0.000 {method 'write' of 'file' objects}
        5    0.000    0.000    0.000    0.000 ntpath.py:164(split)
       10    0.000    0.000    0.000    0.000 threading.py:115(acquire)
        5    0.000    0.000    0.000    0.000 __init__.py:404(formatTime)
        2    0.000    0.000    0.000    0.000 {method 'fetchall' of 'sqlite3.Cursor' objects}
       10    0.000    0.000    0.000    0.000 threading.py:135(release)
        5    0.000    0.000    0.000    0.000 ntpath.py:189(splitext)
        5    0.000    0.000    0.000    0.000 __init__.py:210(_acquireLock)
        5    0.000    0.000    0.000    0.000 genericpath.py:85(_splitext)
        1    0.000    0.000    0.000    0.000 db.py:35(dbFilename)
        5    0.000    0.000    0.000    0.000 ntpath.py:42(normcase)
        5    0.000    0.000    0.000    0.000 __init__.py:695(release)
        5    0.000    0.000    0.000    0.000 __init__.py:688(acquire)


When set this will overide running the command and show the command specific help instead.
This will list the required and optinal parameters along with their allowed values.

/api/1234/?cmd=sb.setdefaults&help=1
{
    "data": {
        "optionalParameters": {
            "archive": {
                "allowedValues": [
                    "sddvd", 
                    "hdtv", 
                    "rawhdtv", 
                    "fullhdtv", 
                    "hdwebdl", 
                    "fullhdwebdl", 
                    "hdbluray", 
                    "fullhdbluray"
                ], 
                "defaultValue": null, 
                "desc": "archive quality for the show"
            }, 
            "flatten_folders": {
                "allowedValues": [
                    0, 
                    1
                ], 
                "defaultValue": null, 
                "desc": "flatten subfolders within the show directory"
            }, 
            "future_show_paused": {
                "allowedValues": [
                    0, 
                    1
                ], 
                "defaultValue": null
            }, 
            "initial": {
                "allowedValues": [
                    "sdtv", 
                    "sddvd", 
                    "hdtv", 
                    "rawhdtv", 
                    "fullhdtv", 
                    "hdwebdl", 
                    "fullhdwebdl", 
                    "hdbluray", 
                    "fullhdbluray", 
                    "unknown"
                ], 
                "defaultValue": null, 
                "desc": "initial quality for the show"
            }, 
            "status": {
                "allowedValues": [
                    "wanted", 
                    "skipped", 
                    "archived", 
                    "ignored"
                ], 
                "defaultValue": null, 
                "desc": "status of missing episodes"
            }
        }, 
        "requiredParameters": {}
    }, 
    "message": "set sickbeard user defaults", 
    "result": "success"
}


Added for developers that need to do JSONP.
This provides the ability to wrap the api response in a callback method by using the callback or jsonp parameter in the request.
The value used for the callback can be whatever the user wants, however non alpha numeric characters are not allowed with the exception of $, ., and _.

/api/1234/?cmd=shows.stats&callback=parseResponse
parseResponse({
    "data": {
        "ep_downloaded": 3277, 
        "ep_total": 3480, 
        "shows_active": 55, 
        "shows_total": 70
    }, 
    "message": "", 
    "result": "success"
});

/api/1234/?cmd=exceptions&tvdbid=110381&jsonp=foo
foo({
    "data": [
        "Archer", 
        "Archer (2009)"
    ], 
    "message": "", 
    "result": "success"
});

You can write a javascript handler to process the callback above like this:

function foo(response) {
  var result = response.result
  var data = response.data
  if result === "success" {
    console.log(data)
  }
}





SickBeard API Builder

The API Builder is a JavaScript based tool that uses a series of linked drop down list to allow the user to quickly and easily select from a pre-defined set of commands with corresponding options to try out. Upon submission of said options it will generate a URL string and also send the generated query to the SickBeard API code to process, with the processed result being returned back in the same window below. This allows the user to generate some data without needing to know any programming knowledge. Note that a valid API key must first be generated, this can be done from the (Config > General) section at the bottom. The API accesses the information the same way as the actual SickBeard program does but is streamlined to be returned as JSON (JavaScript Object Notation) in a consistent manner that should be easy to understand and parse. Once the key is created, launch the API Builder and try it out.

Here is an example of the API Builder using the Shows command but limiting the results to tvshows that is in my database marked as paused:

API Builder

The api data URL constructed CAN be written in several different valid formats/order with all returning the same output.
This adds flexibility for programmers however we do suggest using the provided format that the API Builder generates as we feel it is the most logical and least error prone when starting out.

When defining the arguments/options/commands in the post format the object key must be in lower case; 'cmd', 'tvdbid', 'apikey' as 'cMd' would return unexpected results. While we try to support true/false/TRUE/FALSE as acceptable input, we recommend you use the Boolean values of 1 for true and 0 for false. As this is much more efficient and less error prone to code for.

Note that all the examples below are all requesting the SAME command/option but written in the different formats.
Similar fields have been color coded to help with the comparison of URL formats. ( apikey command arguments option )

  • shorthand format:
    (the order must be followed! as each segment is inferred)
    • /api/<api_key>/<tvdb_id>/<season_number>/<episode_number>
  • shorthand format with command explicitly defined:
    • /api/<api_key>/episode/<tvdb_id>/<season_number>/<episode_number>
  • shorthand can be converted into a traditional serialized post/get format:
    (you must define the command but the options may be placed in any order):
    • /api/?cmd=episode&apikey=<api_key>&tvdbid=<tvdb_id>&season=<season_number>&episode=<episode_number>
  • and finally you can mix-n-match the shorthand and post format:
    (if using shorthand the apikey must be first if not explicitly defined otherwise the 'command' will be wrongly used as the apikey)
    • /api/<api_key>/?cmd=episode&tvdbid=<tvdb_id>&season=<season_number>&episode=<episode_number>
    • /api/episode/?tvdbid=<tvdb_id>&season=<season_number>&episode=<episode_number>&apikey=<api_key>





Advanced API Use

Besides being able to write the URL in different formats you may also combine commands* together in one request, this is called chaining.
This can be useful in the mobile environment when the functionality of saving a request outweighs the complexity of doing so.

Show.GetBanner and Show.GetPoster can not be used in chaining since the commands returning an image rather than JSON data.

Delimitate each command by |. Each command passed will be used as your object key to reference.

Each command will be returned as its own subset, with the command name as the object key along with retaining its result status. The chained group also has its own result status as well.

So let us pretend we wanted to get the output of the commands: sb.getdefaults, sb.getrootdirs, and logs (with the min_level set to error).
You could issue 3 separate commands and then you would have to parse/process 3 separate requests. Or you could chain all these in 1 command.


Chaining Example (using the command name as the returned object key)

/api/1234/?cmd=sb.getdefaults|sb.getrootdirs|logs&min_level=error
{
    "data": {
        "logs": {
            "data": [
                "Nov-16 10:22:09 ERROR    SEARCHQUEUE-RSS-SEARCH :: No NZB/Torrent providers found or enabled in the sickbeard config. Please check your settings."
            ], 
            "message": "", 
            "result": "success"
        }, 
        "sb.getdefaults": {
            "data": {
                "archive": [
                    "fullhdbluray"
                ], 
                "flatten_folders": 1, 
                "future_show_paused": 1, 
                "initial": [
                    "sddvd"
                ], 
                "status": "ignored"
            }, 
            "message": "", 
            "result": "success"
        }, 
        "sb.getrootdirs": {
            "data": [
                {
                    "default": 0, 
                    "location": "S:\\TV", 
                    "valid": 1
                }, 
                {
                    "default": 1, 
                    "location": "I:\\PUB\\TV1", 
                    "valid": 0
                }, 
                {
                    "default": 0, 
                    "location": "D:\\Sickbeard_TV", 
                    "valid": 1
                }
            ], 
            "message": "", 
            "result": "success"
        }
    }, 
    "message": "", 
    "result": "success"
}

If you need to call the same command but pass different options you can do this by:
Delimitate each command by | as done before.
Append a '_' along with a unique string/number as a suffix to each similar command.
The _? (? being a unique string/number) will used as the object key to reference for each command subset inside.
Each argument/option must be explicitly defined in the format of command_?.option, however similar arguments/options may be defined without the specific command_? as it will be used globally for each command.

So let us pretend we wanted to get the output of the commands: episode (with the tvdbid set to 79349, season set to 6, episode set to 5) and episode (with the tvdbid set to 79349, season set to 6, episode set to 6).
Since the tvdbid and season are the same we can just use leave them as they are so each command uses them, however if we could explicitly define them for each command that would be fine as well.


Chaining Example (similar commands, using global options and an uniquely defined option)

/api/1234/?cmd=episode_1234|episode_6&tvdbid=79349&season=6&episode_1234.episode=5&episode_6.episode=6
{
    "data": {
        "episode": {
            "1234": {
                "data": {
                    "airdate": "2011-10-30", 
                    "description": "With the help of his newfound friend Brother Sam, Dexter wonders if there is light within him to counter the darkness, while the search for the Doomsday Killers takes him in a new direction; Batista and Quinn pay a visit to the university where Professor Gellar taught; due to departmental regulations following the shooting, Debra is forced to begin therapy.", 
                    "location": "Season 06\\Dexter.S06E05.HD.TV.mkv", 
                    "name": "The Angel of Death", 
                    "quality": "HD TV", 
                    "status": "Downloaded"
                }, 
                "message": "", 
                "result": "success"
            }, 
            "6": {
                "data": {
                    "airdate": "2011-11-06", 
                    "description": "Dexter is caught up in a very personal case that awakens the needs of his Dark Passenger; Debra feels overwhelmed by her new Lieutenant duties, made all the more complicated when she finds out Quinn slept with a witness in the Doomsday case.", 
                    "location": "Season 06\\Dexter.S06E06.HD.TV.mkv", 
                    "name": "Just Let Go", 
                    "quality": "HD TV", 
                    "status": "Downloaded"
                }, 
                "message": "", 
                "result": "success"
            }
        }
    }, 
    "message": "", 
    "result": "success"
}

So let us pretend we wanted to get the output of the commands: episode (with the tvdbid set to 79349, season set to 1, episode set to 1) and episode (with the tvdbid set to 79349, season set to 6, episode set to 1 and full_path set to 1).
Since the tvdbid and episode are the same we can just use leave them as they are and define the episode option uniquely for each similar command.


Chaining Example (similar commands, global options and an uniquely defined option -- more advanced)

/api/1234/?cmd=episode_s01e01|episode_s06e01&episode_s01e01.season=1&tvdbid=79349&episode=1&episode_s06e01.season=6&episode_s06e01.full_path=1
{
    "data": {
        "episode": {
            "s01e01": {
                "data": {
                    "airdate": "2006-10-01", 
                    "description": "Dexter is a forensic expert in blood patterns who works with the Miami Police Department. He is also a serial killer, who kills people that the police can't bring to justice. He has to hide his double life from his sister, his girlfriend and his co-workers. He is intrigued by a killer who has found a way to kill girls without leaving blood behind.", 
                    "location": "Dexter.S01.DVDRip.XviD-SAiNTS\\Dexter.S01E01.Dexter.DVDRip.XviD-SAiNTS.avi", 
                    "name": "Dexter", 
                    "quality": "SD DVD", 
                    "status": "Downloaded"
                }, 
                "message": "", 
                "result": "success"
            }, 
            "s06e01": {
                "data": {
                    "airdate": "2011-10-02", 
                    "description": "Dexter shows up at his 20th high-school reunion with the intention of confronting the former prom king. Elsewhere, an investigation into a heinous murder with religious overtones leads Dexter to ponder spiritual matters and wonder about his son's legacy. And an unexpected situation results in Debra becoming a hero.", 
                    "location": "S:\\TV\\Dexter\\Season 06\\Dexter.S06E01.HD.TV.mkv", 
                    "name": "Those Kinds of Things", 
                    "quality": "HD TV", 
                    "status": "Downloaded"
                }, 
                "message": "", 
                "result": "success"
            }
        }
    }, 
    "message": "", 
    "result": "success"
}





Disclaimer

SickBeard is currently in 'alpha' state and the development is far from stable.
We do not anticipate the API breaking upon a new release, however, any modifications to the database may require a code update for the API module for it to fully take advantage of the change. For example there is a future branch of SickBeard where it will store the file size and original scene name of the release downloaded. When this update gets merged to source the API will not display this data until the affected API commands are updated.