This document provides an overview of the Google Drive Activity API.
The Drive Activity API lets you query for recent events. You can fetch a
detailed history of all activities, including granular information about each
event. This is useful for tasks like audits as you can retrieve precise
activities that include the ActionDetail
, Actor
, and Target
information.
The Drive Activity API consists of the
DriveActivity
resource, which represents
changes made to objects within a user's Google Drive, and the
activity.query
method, which lets you retrieve
information about those changes.
Request
Your app requests a user's activity data using the activity.query
method. You can request activity either for a specific
Drive item or for everything contained under a
Drive folder. For a given request, you can choose to restrict the
response by using a filter such as time range
or action type, and you can choose to have the activity consolidated in the response. For more information,
see Make requests in the Google Drive Activity API.
Response
The response contains a list of activities matching the given parameters, where
a DriveActivity
resource represents each
activity:
A DriveActivity
resource is a collection of
Action
objects, each of which is self-contained
like an event. An Action
includes an ActionDetail
(such as Create
or Edit
), an Actor
(such as User
or Administrator
), a Target
(such as DriveItem
or Drive
), and either a
Timestamp
or TimeRange
.
A DriveActivity
resource also contains summary information, such as every
Actor
and Target
from all the actions, a unified Timestamp
or TimeRange
,
and either the most important or representative ActionDetail
of the Action
.
For more information, see the Drive Activity API data model.
Activity history visibility
Some activity on Drive might not be reported when you use the Drive Activity API. Whether the API reports a given change to an object depends on whether the change, or information about the change, is visible to the authenticated user in your app.
Visibility is based on the permissions set for the object. There are several scenarios when files and folders are shared in Drive:
If an author shares a document, the activity history for the document is visible to both the creator and the users with whom it was shared.
If a document was shared with a user and then made private, the user can see all activity history from the period when they had access, but not after permissions were restricted.
If a document was never shared with a user, the user can't see any activity history.
Related topics
- To get the most out of the Drive Activity API, first integrate your app with the Google Drive API
- To learn about developing with Google Workspace APIs, including creating a project or handling authentication and authorization, refer to Develop on Google Workspace.
- To learn about activities, see the API reference.