Get started with the Library API

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

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:

  1. Upload media: Use the uploads endpoint to securely upload photo or video bytes to Google Photos. This step generates an uploadToken.

  2. Create media items: Use the mediaItems.batchCreate method, providing the uploadToken, to create media items in the user's library.

  3. Create albums (optional): Use the albums.create method to create albums within the user's library to organize the media items.

  4. Manage albums:

  5. Access app-created media:

    • Retrieve details about specific media items using mediaItems.get or mediaItems.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.

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.