Skip to content

Instantly share code, notes, and snippets.

@pstadler
Last active June 18, 2022 09:59
Show Gist options
  • Save pstadler/bc0afefe35f608e9552e764b31f45f19 to your computer and use it in GitHub Desktop.
Save pstadler/bc0afefe35f608e9552e764b31f45f19 to your computer and use it in GitHub Desktop.
#!/bin/sh
# See: https://github.com/Radarr/Radarr/wiki/Mass-Delete-via-API
HOST=http://radarr.local:7878
API_KEY= # Settings > General
ids=$(curl --silent $HOST/api/movie -X GET -H "X-Api-Key: $API_KEY" \
| jq '.[] | select(.monitored == false) | .id')
for id in $ids; do
echo "Deleting movie id $id"
curl --silent $HOST/api/movie/$id -X DELETE -H "X-Api-Key: $API_KEY"
done
@linds1234
Copy link

linds1234 commented May 8, 2017

Nice script

To confirm- this will just delete the entries in the Radarr database/list correct? Not actually delete the movies from disk?

Edit: gave it a go- nice, saved a lot of time. Thank you.

Copy link

ghost commented Jul 25, 2017

Bad PHP version that deletes the first 1000 movies (To be used as reference)

for ($i = 1; $i <= 1000; $i++) {
		$ch = curl_init(); 
        curl_setopt($ch, CURLOPT_URL, "http://localhost:7878/api/movie/" . $i); 
		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
			'X-Api-Key: API_KEY_HERE'
			));
        $output = curl_exec($ch); 
		echo $output;
        curl_close($ch);    
}

@kmdavis
Copy link

kmdavis commented Jul 30, 2017

jQuery version:

$.getJSON("http://localhost:7878/api/movie?page=1&pageSize=250&sortKey=sortTitle&sortDir=asc&filterKey=downloaded&filterValue=false&filterType=equal")
    .then(missing => _.each(missing.records, (movie) => {
        console.log("Deleting Movie", movie.id, movie.title);
        $.ajax({
            url: `http://localhost:7878/api/movie/${movie.id}?deleteFiles=false&addExclusion=false`,
            method: "DELETE"
        }); 
    }))

@jbeck22
Copy link

jbeck22 commented Sep 13, 2018

This removed all the movies that were not downloaded, not just the ones that were missing and unmonitored. Any updates or suggestions would be awesome!

@billettg
Copy link

billettg commented Jun 18, 2022

For this to work with Radarr 3.0.0 you will need to add /v3 to both API paths as per API docs.

API path should be /api/v3/movie/{id}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment