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`](https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/activity/driveactivity) resource, which represents
changes made to objects within a user's Google Drive, and the
[`activity.query`](https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/activity/query) method, which lets you retrieve
information about those changes.

## Request

Your app requests a user's activity data using the [`activity.query`](https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/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](https://developers.google.com/workspace/drive/activity/v2/requests#filters) such as time range
or action type, and you can choose to have the activity [consolidated](https://developers.google.com/workspace/drive/activity/v2/requests#consolidation) in the response. For more information,
see [Make requests in the Google Drive Activity API](https://developers.google.com/workspace/drive/activity/v2/requests).

## Response

The response contains a list of activities matching the given parameters, where
a [`DriveActivity`](https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/activity/driveactivity) resource represents each
activity:
![Explanation of the Drive Activity API response body message.](https://developers.google.com/static/workspace/drive/activity/v2/images/driveactivity.svg) **Figure 1.** Explanation of the Drive Activity API response body message.

A `DriveActivity` resource is a collection of
[`Action`](https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/activity/action) objects, each of which is self-contained
like an *event* . An `Action` includes an [`ActionDetail`](https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/activity/actiondetail) (such as `Create` or `Edit`), an [`Actor`](https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/activity/actor) (such as `User` or `Administrator`), a [`Target`](https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/activity/target) (such as `DriveItem` or `Drive`), and either a
[`Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp)
or [`TimeRange`](https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/activity/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](https://developers.google.com/workspace/drive/activity/v2/datamodel).

## 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](https://developers.google.com/workspace/drive/api/guides/about-sdk)
- To learn about developing with Google Workspace APIs, including creating a project or handling authentication and authorization, refer to [Develop on
  Google Workspace](https://developers.google.com/workspace/guides/getstarted-overview).
- To learn about activities, see the [API reference](https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/activity).