The Library API lets you to interact with photos, videos, and albums within your users' Google Photos libraries, but with an important focus: you can only access and manage content that was created by your application.
Before you start
- Check out the overview: Compare the Picker API and the Library API to make sure the Library API is the right fit for your use case.
- Configure Your app: Enable the API and set up authentication. See Configure your app for detailed steps.
Key use cases of the Library API
The Library API is ideal for scenarios where your app needs to:
- Upload and store media: Securely import photos and videos (generated by your app) into your users' Google Photos libraries.
- Organize content: Create and manage albums to help users organize their app-related media.
- Enhance photos and albums: Add context to media items and albums through enrichments like titles, descriptions, or location information.
- Access app-created data: Retrieve and interact with the photos, videos, and albums that your app has previously created.
Typical Library API workflow
While the Library API offers various functionalities, a common workflow might involve these steps:
Upload media: Use the uploads endpoint to securely upload photo or video bytes to Google Photos. This step generates an
uploadToken
.Create media items: Use the
mediaItems.batchCreate
method, providing theuploadToken
, to create media items in the user's library.Create albums (optional): Use the
albums.create
method to create albums within the user's library to organize the media items.Manage albums:
- Add media items (created by your app) to albums using
albums.batchAddMediaItems
. - Remove media items from albums using
albums.batchRemoveMediaItems
. - Add enrichments to albums (like titles or locations) using
albums.addEnrichment
. - Retrieve information about specific albums using
albums.get
. - List albums created by your app using
albums.list
.
- Add media items (created by your app) to albums using
Access app-created media:
- Retrieve details about specific media items using
mediaItems.get
ormediaItems.batchGet
. - Search for media items created by your app using
mediaItems.search
. - List media items within a specific app-created album using
mediaItems.search
with the album ID.
- Retrieve details about specific media items using
Next steps
- Review the reference docs: Explore the detailed Library API reference documentation to learn about all the available methods and parameters.
- Try out the samples: Check out our sample to see the Library API in action and get inspiration for your integration.