# Add to plex library from CLI

**URL:** <https://forums.plex.tv/t/add-to-plex-library-from-cli/92411>\
**Category:** Dev/API Corner\
**Tags:** other-dev\
**Created:** [February 3, 2015, 3:27am UTC](https://forums.plex.tv/t/add-to-plex-library-from-cli/92411 "2015-02-03T03:27:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![klikevil](https://avatars.discourse-cdn.com/v4/letter/k/57b2e6/32.png) [@klikevil](https://forums.plex.tv/u/klikevil)\
**Post date:** [February 3, 2015, 3:27am UTC](https://forums.plex.tv/t/add-to-plex-library-from-cli/92411/1 "2015-02-03T03:27:09Z")

</div>

Is it possible to add libraries to PLEX from the command line with bash in Linux?

&nbsp;

I am writing a service that will symlink all new media directories I add with PLEX friendly filenames and then add them to PLEX automatically without user intervention. I add and remove media periodically and it is troublesome to have to log into my server to fix the file names then go to the PLEX web interface to add the new media. The first half of this service works fine (symlinking proper file names for all media that hasn't already been fixed), but I cannot figure out how or if it is possible to add libraries manually from bash/CLI so they appear in the PLEX interface.

&nbsp;

Is there documentation for this somewhere or has anyone done this before?

---

<div class="post-metadata">

**Author:** ![BigWheel](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/bigwheel/32/78783_2.png) [@BigWheel](https://forums.plex.tv/u/BigWheel)\
**Post date:** [February 3, 2015, 3:37am UTC](https://forums.plex.tv/t/add-to-plex-library-from-cli/92411/2 "2015-02-03T03:37:51Z")

</div>

to create a new library I dunno.

to update a library you add media to yes, not sure when this was last updated

[https://support.plex.tv/hc/en-us/articles/201242707-Plex-Media-Scanner-via-Command-Line](https://support.plex.tv/hc/en-us/articles/201242707-Plex-Media-Scanner-via-Command-Line)

---

<div class="post-metadata">

**Author:** ![ZeroQI](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/zeroqi/32/6522_2.png) [@ZeroQI](https://forums.plex.tv/u/ZeroQI)\
**Post date:** [May 7, 2015, 3:35pm UTC](https://forums.plex.tv/t/add-to-plex-library-from-cli/92411/3 "2015-05-07T15:35:53Z")

</div>

[https://forums.plex.tv/topic/160013-pms-09120-doesnt-let-me-create-libraries-with-alternate-agent-or-scanner/?p=923746](https://forums.plex.tv/topic/160013-pms-09120-doesnt-let-me-create-libraries-with-alternate-agent-or-scanner/?p=923746)

You can get it to work manually by issuing the add library command via HTTP POST, for example:

http://localhost:32400/library/sections?scanner=SageTV+Scanner&language=en&agent=com.plexapp.agents.bmtagenttvshows&location=somepath&type=show&name=SageTV

Note this needs to be HTTP post so simply paste this in the browser window won't work. You can use curl or browser extension to issue the POST.

You will need no auth possibly to be allowed to run it

&nbsp;

Also:&nbsp;[https://support.plex.tv/hc/en-us/articles/201242707-Plex-Media-Scanner-via-Command-Line](https://support.plex.tv/hc/en-us/articles/201242707-Plex-Media-Scanner-via-Command-Line)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 21, 2019, 4:30am UTC](https://forums.plex.tv/t/add-to-plex-library-from-cli/92411/4 "2019-12-21T04:30:53Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
