# 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

- **Check out the overview:** [Compare the Picker API and the Library API](https://developers.google.com/photos/overview/about) 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](https://developers.google.com/photos/overview/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:

1. **Upload media:** Use the [uploads endpoint](https://developers.google.com/photos/library/guides/upload-media)
   to securely upload photo or video bytes to Google Photos. This step
   generates an
   [`uploadToken`](https://developers.google.com/photos/library/reference/rest/v1/mediaItems/batchCreate#SimpleMediaItem.FIELDS.upload_token).

2. **Create media items:** Use the [`mediaItems.batchCreate`
   method](https://developers.google.com/photos/library/guides/upload-media#creating-media-item), providing
   the `uploadToken`, to create media items in the user's library.

3. **Create albums (optional):** Use the [`albums.create` method](https://developers.google.com/photos/library/guides/manage-albums#creating-new-album)
   to create albums within the user's library to organize the media items.

4. **Manage albums:**

   - Add media items (created by your app) to albums using [`albums.batchAddMediaItems`.](https://developers.google.com/photos/library/guides/manage-albums#adding-items-to-album)
   - Remove media items from albums using [`albums.batchRemoveMediaItems`](https://developers.google.com/photos/library/guides/manage-albums#removing-items-from-album).
   - Add enrichments to albums (like titles or locations) using [`albums.addEnrichment`.](https://developers.google.com/photos/library/guides/add-enrichments#intro-adding-enrichments-album)
   - Retrieve information about specific albums using [`albums.get`](https://developers.google.com/photos/library/guides/list#listing-albums).
   - List albums created by your app using [`albums.list`](https://developers.google.com/photos/library/guides/list#listing-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](https://developers.google.com/photos/library/reference/rest) to learn about all the available methods and parameters.
- Try out the samples: Check out our [sample](https://developers.google.com/photos/library/samples) to see the Library API in action and get inspiration for your integration.