Scan All Libraries

When you add or remove media from your Plex server you will need to scan the libraries to update Plex with the changed media. You can run the scan from the Plex Web app, or you can use this API command to scan from outside of Plex.

You should run a scan when one of the following has occurred:

  • Added or removed media files.
  • Added or removed directories from a library.
  • Renamed a media file or directory.
  • Moved any files from one location to another.

This command will run a scan for all libraries in your Plex server.


GET http://{ip_address}:32400/library/sections/all/refresh?X-Plex-Token={plex_token}


ip_addressThe IP address of the Plex Media server.
plex_tokenThe Plex token.

Return Status

HTTP CodeDescription
200Success - The request was successful.
401Unauthorized - The Plex token provided was not valid.


No response is returned. You will be able to see the scan API command run from the Plex console.


The time it takes for the scan to complete is dependent on how many media times are within each library, and the number of libraries on the Plex server.

This command will return immediately, but the scan will still be running on the Plex server.

Whenever you want to add movies, add TV shows, or add music to Plex, you will first add the media files to your Plex library location, and then run this scan.


curl -X GET http://{ip_address}:32400/library/sections/all/refresh?X-Plex-Token={plex_token}
import requests
plex_url = http://{ip_address}:32400/library/sections/all/refresh?X-Plex-Token={plex_token}
response = requests.get(plex_url)
$response = Invoke-RestMethod 'http://{ip_address}:32400/library/sections/all/refresh?X-Plex-Token={plex_token}' -Method 'GET'
Write-Output $response