Scan a Partial Library

As you add media items to a library, you will need to scan the library to have the items appear in Plex. If you have a many media items in a library, the scan can take a long time if you scan the whole library.

The solution is to only scan the items that have been added to the folder associated with the library.

This API command will allow you to scan a specific folder that contains the media item for a library, which will reduce the amount of time needed for scanning.

URL

GET http://[IP address]:32400/library/sections/[Library ID]/refresh?path=[Folder]&X-Plex-Token=[PlexToken]

Parameters

NameDescription
IP addressThe IP address of the Plex Media server.
PlexTokenThe temporary authentication Plex token.
Library IDThe key associated with the library. This key can be found by calling the Libraries API command.
FolderThe path of the folder to be scanned for new media items. This value needs to be URL encoded.

Return Status

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

Response

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

Remarks

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.

Examples

curl -X GET http://[IP address]:32400/library/sections/[Library ID]/refresh?path=[Folder]&X-Plex-Token=[PlexToken]
import requests
plex_url = http://[IP address]:32400/library/sections/[Library ID]/refresh?path=[Folder]&X-Plex-Token=[PlexToken]
response = requests.get(plex_url)
print(response.text)
$response = Invoke-RestMethod 'http://[IP address]:32400/library/sections/[Library ID]/refresh?path=[Folder]&X-Plex-Token=[PlexToken]' -Method 'GET'
Write-Output $response
Subscribe
Display