I'm ticking off the boxes needed to automate archiving images from a new camera I picked up. I have taken care of SD card access, and now I'm dealing with pushing files to Google Photos.
What I wanted was a lightweight, curl-based wrapper around the Google Photos Library API. By now, I've written many of these REST wrappers, so I wasn't especially daunted.
I set up new OAuth Credentials and went to work on the first API endpoint: /v1/albums/list. And that's where I hit a roadblock. Despite having hundreds of albums in my Google Photos account, I kept getting a response with this shape:
$ curl -s -H 'Authorization: Bearer <token>' -G https://photoslibrary.googleapis.com/v1/albums
{
"nextPageToken": "CkAKPnR5cGUuZ29vZ2xlYXBpcy5jb20vZ29vZ2xlLnBob3Rvcy5saWJyYXJ5LnYxLkxpc3RBbGJ1bXNSZXF1ZXN0EowDQUhfdVE0M0Qtd2FKY0FTNkNNSUl3RUdqdHFIQmRuY1FSTy0wTjAxa1lLMUVyWVNFQWFBTnowOE9UZTdlS3dlRTlDd3JRTktvMUxsanhoc3lQZFJ4UWtUdzhUbXlMcm1PYm45Ymk0TVdLSktjalV0dHpSUzZ4OUdoOGpSc29EZ1VQQV9CVUJiVTFOdWNUSVZETVJhRWE1bnFrX3JNQWsta3NuQUFfYmZrVzZnaG5QNXJzMWVNN2FGYWlta1ozMGZ1cGs2MEVLRjRBdm11ek5FRUxvb2M3VXJVQmZtSjhwUkRZbFNrd3dzYzBXT2k4VzdmOGpzeHY1VUxVbThHSkdLZWtSQ0lRUGREamlNMURud2hXZzk2SGc1djJwTFlJdmhXOGRGMzdFUG44OFBVQTRsQy16RlBROXVUeWVJYW52cF9WQ1c5OTJRbk1lLWZ2UjF6bkRxVVJDd0o5V1l1Mzh0a3Q2Q1FpYUxuZHAzUTlQQkJ5WFhwT00tQnJpaENFdlF1RGdQel9raUtJY095GgA"
}
Where's My Stuff?
I found this response baffling: not only were the albums in my Google Photos account not shown, there wasn't even an albums entry in the JSON response. What gives?
Ahhh, the joy of fine print. Taking a moment to actually read the docs for albums/list revealed this description: "Lists all albums created by your app" (emphasis is mine). Wait, what? My app? Do I even have an app?
There's also this note, flagged as a change since April 1st, 2025:
Listing, searching, and retrieving media items and albums
What's changing: You can now only list, search, and retrieve albums and media items that were created by your app.
... If your app relies on accessing the user's entire library, you may need to re-evaluate your app or consider alternative approaches.
So the list of albums is blank because the newly created OAuth configuration I set up has never created any albums. Got it. It's still a bit strange that Google doesn't even return an empty albums array in the JSON response. But, I suppose that's a minor detail I can work around.
Once this sandboxing of images came into focus, I had no problem coding against the API. After all, my albums-list function was working just fine; I just assumed it should return something else.
You can grab gphotoassist here. As always, feel free to customize this script however you would like. Here's a transcript of me using gphotoassist. As a bonus, feel free to pick up geminiassists, too.
Happy hacking!
The Script In Action
# Prepare a directory to store files locally
$ photos_dir=$HOME/dl/pics
$ rm -rf $photos_dir
$ mkdir -p $photos_dir
# My reference photo
$ us=$HOME/dl/20250905_172927.jpg
# Generate some fresh images to upload
$ themes="sci-fi jungle western"
$ for t in $themes ; do \
echo $t \
geminiassist -a generate-image -f $us -p "Edit this photo so the couple is in a $t themed photo. Their clothes and background should be updated to match the theme." > $photos_dir/$t.png \
done
sci-fi
jungle
western
$ album_id=$(gphotosassist -a album-create -n "Fun Us Pics" | cut -d'|' -f1)
$ echo "Album Created: $album_id"
Album Created: AHnaBgu1ZNHo6zvalh4C7EFq4HZJO5jPXVhC39PZcfsW8qNVfRskSNwta7lJ4zldnNcB0BAY1mzw
$ for f in $HOME/dl/pics/* ; do \
gphotosassist -a album-add -i $album_id -f $f > /dev/null \
echo "Added $f" \
done
Added /home/ben/dl/pics/jungle.png
Added /home/ben/dl/pics/sci-fi.png
Added /home/ben/dl/pics/western.png
# Confirm the photos are now in the album
$ gphotosassist -a media-list -i $album_id | while read line ; do \
name=$(echo $line | cut -d'|' -f 2) \
echo "$name" \
done
jungle.png
sci-fi.png
western.png
And here's the newly created pics in Google Photos:













