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 run the 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 a single in your Plex server.
GET http://[IP address]:32400/library/sections/[Library ID]/refresh?X-Plex-Token=[PlexToken]
|IP address||The IP address of the Plex Media server.|
|PlexToken||The temporary authentication Plex token.|
|Library ID||The key associated with the library. This key can be found by calling the Libraries API command.|
|200||Success - The request was successful.|
|401||Unauthorized - 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 the library
This command will return immediately, but the scan will still be running on the Plex server.
Scan the library associated with ID 2 for the Plex server located at IP address of 192.168.1.4: