You are viewing the legacy documentation for the Google Photos Library API.
Manage media items
Stay organized with collections
Save and categorize content based on your preferences.
In addition to accessing media
items after you upload them, you can
also change their descriptions.
Required authorization scope
To change the descriptions of media items after their creation, use the
photoslibrary.edit.appcreateddata
scope.
To change a media item's description, make a
media items update call
with the identifier of the media item, and include the new description in the
request.
To change a media item's description, your app must have uploaded the media
item, and the currently authenticated user must be the owner. Descriptions can
be no more than 1,000 characters in length.
REST
Here's a PATCH request header to update a media item description:
PATCH https://photoslibrary.googleapis.com/v1/mediaItems/media-item-id?updateMask=description
This request determines what properties are being updated by including a
field mask, indicated by the updateMask
parameter in the URL.
Include the new description in the body of the request:
{
"description": "new-media-item-description"
}
If successful, the response returns the updated media item:
{
"id": "media-item-id",
"description": "new-media-item-description",
"productUrl": "media-item-product-url",
"baseUrl": "media-items-in-album",
"mimeType": "mime-type-of-media",
"mediaMetadata": {
...
},
"contributorInfo": {
...
},
"fileName": "item-filename"
}
Java
try {
// Update the description of the media item.
// The new description must not be null.
MediaItem updatedItem = photosLibraryClient.updateMediaItemDescription(mediaItem, "new-media-item-description");
} catch (ApiException e) {
// Handle error
}
PHP
try {
// ID of the media item to update.
$mediaItemId = "MEDIA_ITEM_ID";
// New description of the media item.
$newDescription = "new-media-item-description";
// Update the description of the media item identified.
$mediaItem = $photosLibraryClient->updateMediaItemDescription($mediaItemId, $newDescription);
} catch (\Google\ApiCore\ApiException $e) {
// Handle error
}
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-02-21 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-21 UTC."],[[["You can update descriptions of media items uploaded by your app using the `photoslibrary.edit.appcreateddata` scope."],["To update a description, send a PATCH request to the media item's endpoint with the `updateMask` parameter set to `description` and the new description in the request body."],["The authenticated user must be the owner of the media item to modify its description, and descriptions are limited to 1,000 characters."],["Successful updates return the entire updated media item resource, including the new description."],["Code samples for Java and PHP demonstrate how to programmatically update media item descriptions."]]],["Media item descriptions can be modified after upload using the `photoslibrary.edit.appcreateddata` scope. This is done via a `mediaItems update call` (PATCH request) that includes the media item's ID and the new description in the request body. The authenticated user must be the owner and have uploaded the item. Descriptions can have a maximum of 1,000 characters. A field mask in the URL determines properties to be updated. Sample code snippets in REST, Java, and PHP are provided.\n"]]