Google Drive maintains an automatic history of modifications, which can help users track file changes and content revisions. In the revision history, users can see what edits have been made and can revert to a specific version of a file with specific edits.
The following terms are relevant to the changes and revisions resources of the Google Drive API:
- Access Control List (ACL)
- The list of all permission resources associated with a file, folder, or shared drive.
- Change
- An alteration made to a file's content or metadata of a file or shared drive.
- User change log
- A record of all changes that a user made to every editable file in their My Drive, such as a Google Docs, Sheets, or a Slides. For members of a shared drive, the user change log also includes entries about shared drive membership, user access levels to items in that shared drive, and shared drive name changes.
- Shared drive change log
- A record of all changes to a shared drive, such as additions or removals of users, and all changes to items on that shared drive. A change to an item within a shared drive appears in both the user change log and shared drive change log.
- Change log entry
- A record of a change made to a file's content or metadata of a file or shared drive. A change log entry indicates the user who made the change, the timestamp, and an ID. There can only be one entry per file or shared drive in the change log at a time. Each time that file or shared drive changes, a new ID is created for that entry, and it replaces the previous entry.
- Revision
- A version of the file representing a change to the file's contents (not metadata). Each revision can be accessed using the Revision resource within the Drive API.
- Head revision
- The most current version of a file.
- Blob revision
A version of an unmodifiable binary file, such as an image, video, or PDF. If the blob revision is the only revision of the binary file, it cannot be deleted. A new blob can be uploaded as a new revision, which becomes the new head revision of that file.
Blob revisions can be set to "Keep Forever" meaning the revision cannot be automatically purged. Up to 200 revisions can be set to "Keep Forever." The head revision is never auto-purged.
Any revision, other than the head revision, that's not designated as "Keep Forever" is purgeable. Purgeable revisions are typically preserved for 30 days, but can be purged earlier if a file has 100 revisions that are not designated as "Keep Forever" and a new revision is uploaded.
The
keepForever
field of theRevisions
resource is used to set a revision to "Keep Forever." Additionally, you can callrevisions.delete
to delete a revision even when it's marked as "Keep Forever."- Revision History
A record of all revisions of a file in chronological order. A change to a Docs, Sheets, or Slides file gets a new revision. Each time the content changes, Drive creates a new revision history entry for that file. However, these editor file revisions may be merged together, so the API response might not show all changes to a file.
Watch this video to learn about how to manage revisions with the Google Drive API:
Next Steps
- To identify where the change you want to track is recorded, see Identify which change log to track.
- To set up change tracking for users and shared drives, see Track changes for users and shared drives.
- To publish, download, or query revisions, see Download and publish file revisions.
- To set up change notifications, see Push notifications.