dokuro
February 13, 2026, 1:46pm
1
Does anyone know if its possible to update the added_at field for an item via the plexapi ? Basically I want to achieve what I doc’ed here Collections appearing in Recently Added in Movies Page - #6 by dokuro but do it via the api rather than database sql.
I’ve tried using collection.addedAt (sample snippet below) …
for collection in plex.library.search(libtype='collection'):
print("Changing added_at Date:", collection.title)
collection.addedAt()
but get an error saying TypeError: 'datetime.datetime' object is not callable which I guess means it cannot be referenced / updated.
Yaracuy
February 13, 2026, 2:24pm
2
Sure. I do it all the time.
There are of course many ways to achieve this but you get the point.
ChangeAddedDate - Movie.py
import json
import plexapi
from plexapi.server import PlexServer
from datetime import datetime
CONFIG_FILE = 'config.json'
with open(CONFIG_FILE, 'r') as f:
config_data = json.load(f)
plex_url = config_data.get('plex_url')
plex_token = config_data.get('plex_token')
plex = PlexServer(plex_url, plex_token)
library = plex.library.section("Movies")
TEST_MODE = 0
new_date = datetime(2020, 5, 7)
movie = library.get(title="Die Hard") # movie= library.getGuid("imdb://tt3076658")
title = movie.title
print(f"Movie: {title} current date: {movie.addedAt}")
if TEST_MODE:
print(f"Movie: {title} would change to: {new_date}")
else:
updates = {"addedAt.value": new_date}
movie.edit(**updates)
print(f"✓ Changed date for {title} - new date: {new_date}")
config.json
{
"plex_url": "http://[IPADDRESSOFPLEX]:32400",
"plex_token": "PLEXTOKEN"
}
I use a config.json file because I have many scripts and if I change my token I only have to change it in one place
1 Like
It is possible that this is specifically about Collections? I’m not sure how the Added-at date of collections is defined.
i.e. it might be defined by the Added-At date of its oldest member.
Or if a collection has indeed a dedicated date field in the database, it might just be that it is a simple omission in the Plex API.
Yaracuy
February 13, 2026, 2:33pm
4
Rereading your post, you want to do it in a collection? Not in a movie r a TV Show?
I haven’t tried it but I have successfully uploaded theme.mp3 to collections. Don’t know if addedAt is editable in collections though.
dokuro
February 13, 2026, 2:36pm
5
According to Collection plexapi.collection — Python PlexAPI documentation addedAt is defined for collections.
@Yaracuy thanks, let me see if I can get this working for me.
1 Like
Yaracuy
February 13, 2026, 2:37pm
6
Apparently collection.addedAt exists
import json
import plexapi
from plexapi.server import PlexServer
CONFIG_FILE = 'config.json'
with open(CONFIG_FILE, 'r') as f:
config_data = json.load(f)
plex_url = config_data.get('plex_url')
plex_token = config_data.get('plex_token')
plex = PlexServer(plex_url, plex_token)
# select the library
library = plex.library.section("Movies")
#library = plex.library.section("TV Shows")
# select the Collection
collection = library.collection("The Bounty")
print("================================")
print(f"Collection: {collection.addedAt}")
print("================================")
Have just tested it and I got a result
Yep, for movies and TV Shows
import json
import plexapi
from plexapi.server import PlexServer
CONFIG_FILE = 'config.json'
with open(CONFIG_FILE, 'r') as f:
config_data = json.load(f)
plex_url = config_data.get('plex_url')
plex_token = config_data.get('plex_token')
plex = PlexServer(plex_url, plex_token)
# select the Movies library
#library = plex.library.section("Movies")
library = plex.library.section("TV Shows")
# select the Collection
collection = library.collection("Lonesome Dove")
print("================================")
print(f"Collection: {collection.addedAt}")
print("================================")
1 Like
Yeah the collection object is editable. 203898 is the ratingKey for a collection.
collection = plex.fetchItem(203898)
print(collection.addedAt)
new_date = datetime(2020, 5, 7)
updates = {"addedAt.value": new_date}
collection.edit(**updates)
collection.reload()
print(collection.addedAt)
output
2025-10-02 15:57:29
2020-05-06 20:00:00
1 Like
And what’s with the 4 hours time difference?
Isn’t the new date intended to be the 7th of May?
Yaracuy
February 13, 2026, 2:54pm
10
The date in the the original script is May 7th 2020. Can’t remember why I used that date. Probably to get several movies added at, sequentially.
The time component of the date don’t know where it get the hours from. Probably the system time. I don’t know.
But the results in @Atomatth test show May 6th 2020
There is surely a rational explanation
1 Like
That’ what I was referring to. The script is clearly setting 2020-05-07 (without time).
But the resulting output is showing 4 hours before that date.
If I had to guess: difference of local clock to UTC.
1 Like
dokuro
February 13, 2026, 2:58pm
12
Thanks everyone. Have it working now. Two rookie mistakes from me …
I was not doing the edit to the collection correctly
I was not importing datetime from datetime import datetime
Again, thank you all, very much appreachiated.
1 Like
Yaracuy
February 13, 2026, 3:00pm
13
The mysteries of EPOCH UNIX time?
Can you test if the outcome changes if you set an actual datetime and not just a date?
Yaracuy
February 13, 2026, 3:25pm
15
I can test tomorrow. I’m going out right now.
Friday! (at least, here, where I am)
I’m pretty sure editAddedAt works for collections.
collection = plex.fetchItem(203898)
new_date = datetime(2020, 5, 7)
collection.editAddedAt(new_date)
2 Likes
dokuro
February 13, 2026, 3:52pm
18
Confirmed, editAddedAt worked perfectly.
For the “4 hour difference” question, you can try setting a timezone.
from datetime import datetime, timezone
from zoneinfo import ZoneInfo
new_date = datetime(2020, 5, 7, tzinfo=ZoneInfo("America/Los_Angeles"))
# or
new_date = datetime(2020, 5, 7, tzinfo=timezone.utc)
I don’t know which way (using a specific timezone or UTC) converts the time in the correct direction. Timezones are confusing.