euphoria360 edited this page Mar 4, 2018 · 22 revisions

URL

All API endpoints are based off of /api. As in, if you access Sonarr via http://localhost:8989, the API root would be http://localhost:8989/api. You can also take the example http://192.168.1.20:8989/sonarr/api.

All other items build after this.

Authentication

All requests made to the API endpoint require the API Key authentication using the X-Api-Key header or using the ?apikey= query string:

http://localhost:8989/api/system/status?apikey=${YOUR_API_KEY}

Where:

  1. http://localhost:8989/api is the main API Endpoint
  2. /system/status would be the specific GET request, which can be submitted by the other commands.
  3. ?apikey=${YOUR_API_KEY} is required for requests against your Sonarr instance, and gets stuck here at the end.
  4. There are other commands that request/require additional information, of which will be explained on those pages.

API Key

  • Can be accessed and reset via Settings -> General through the GUI
  • Also can be accessed via the Config.xml file, in the AppData Directory
  • alpha-numeric (lower case)

Dates & Times

  • All dates/timestamps are ISO-8601 formatted in UTC 2014-01-27T01:30:00Z
  • Episodes (and episode based endpoints, missing & calendar) also include the airdate in the original timezone for display purposes
  • Date parameters should be ISO-8601 UTC dates to ensure proper handling by Sonarr

Content Type

  • All POST/PUT requests require all parameters to be JSON encoded in the body, unless otherwise noted.
  • All GET requests will return a JSON encoded response

Endpoints

EXAMPLES

Powershell POST RescanSeries example

Post processing example to refresh the series.

$sonarr_seriesid = $env:sonarr_series_id
$params = @{"name"="RescanSeries";"seriesId"="$sonarr_seriesid";} | ConvertTo-Json
Invoke-WebRequest -Uri http://SONARRIP:SONARRPORT/api/command?apikey=SONARRAPIKEY -Method POST -Body $params

Linux Curl missingEpisodeSearch example

A backlog search example which uses curl to instruct Sonarr to search and download all missing episodes.

curl -d '{name: "missingEpisodeSearch"}' -H "Content-Type: application/json" -X POST http://SONARRIP:SONARRPORT/api/command?apikey=SONARRAPIKEY
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.