Get started with the Picker API

The Picker API provides a secure way for your users to select photos and videos from their Google Photos library and share them with your application.

Before you start

The Picker API flow

Here is an overview of the how the Picker API works:

  1. Check for OAuth token: Before starting the Picker API flow, check for a valid OAuth 2.0 access token for the user. If there is no token, initiate the OAuth 2.0 authorization flow to obtain one.

  2. Create a session: Initiate the process by making a call to the Picker API to create a new session. This call will return a unique pickerUri.

  3. Direct users to the Google Photos app: Provide the pickerUri to your users (either as a clickable link or a QR code). This URL will securely open their Google Photos app.

  4. User selects media items: Within the Google Photos app, users can browse their library and select the photos and videos they want to share with your app.

  5. Poll the session: Your app should periodically poll the session to check the status. You're looking for the mediaItemsSet property to return true, indicating the user has finished their selection.

  6. List selected media items: Once mediaItemsSet returns true, you can use the list method to get details about the selected media items.

  7. Retrieve and use media items: Now you have access to the selected media items. You can fetch their content using the baseUrl and utilize them within your application.

Next steps

  • Review the reference docs: Explore the detailed Picker API reference documentation to learn about all the available methods and parameters.
  • Try out the samples: Check out our sample to see the Picker API in action and get inspiration for your integration.