canonical: https://jentic.com/apis/googleapis.com/driveactivity

# Google Drive Activity API

The Drive Activity API returns a historical view of edits, comments, moves, renames, permission changes, and other actions taken on Google Drive files and shared drives. A single query endpoint accepts a target item or ancestor folder, an optional time range, and a filter expression, and returns grouped or ungrouped activity records with actor, action, and target details. It is the canonical interface for building audit, timeline, and collaboration insight features on top of Drive content.

## For AI agents

Query who did what to which Google Drive files and folders, including edits, comments, permission changes, and moves, over any time window.

## Scope

Does not read, write, or share Drive files, and does not return user login or device events - use for querying historical Drive item activity only.

## Capabilities

- Query activity for a specific Drive file or folder over a chosen time window
- Filter activity by action type (edit, comment, permission change, move, rename, delete)
- Group consecutive activities by actor and action to show condensed timelines
- Retrieve actor details for each action (user, system event, anonymous, or impersonation)
- Page through long activity histories using pageToken and pageSize
- Query activity at the shared drive or ancestor folder level for organisation-wide audits

## Use cases

### File-Level Audit Trails

Compliance and security teams use Drive Activity to build audit trails for sensitive documents - contracts, financial models, board materials - showing who edited, viewed (where logged), commented, or changed permissions, and when. The query endpoint accepts an itemName plus filter and returns each action with actor, target, and timestamp. Setting up per-file or per-folder audit dashboards typically takes hours.

Example prompt: POST /v2/activity:query with itemName='items/{fileId}' and filter='detail.action_detail_case:(EDIT PERMISSION_CHANGE)' and return each action's actor and timestamp.

### Shared Drive Activity Dashboards

Operations teams managing dozens of shared drives surface activity dashboards showing the most active drives, top contributors, and recent permission changes. The API supports queries at the shared-drive root via ancestorName, and grouped results condense long edit sessions into manageable rows. Building a daily-refresh dashboard takes a day rather than a multi-week custom integration.

Example prompt: Query activity:query with ancestorName='items/{sharedDriveId}' and consolidationStrategy.legacy={} for the past 7 days and return the top 10 actors by action count.

### Insider Risk and Data Loss Detection

Security teams flag suspicious activity such as bulk downloads, unusual permission grants to external users, or mass moves of sensitive folders. Drive Activity surfaces every PERMISSION_CHANGE and MOVE action with target and actor, which feeds into SIEM or DLP rules. Combined with directory data the API helps spot insider risk patterns within hours of an event.

Example prompt: Query activity:query with filter='detail.action_detail_case:PERMISSION_CHANGE' over the last hour and alert when any actions add a recipient outside the organisation domain.

### Agent-Built Document Status Briefings via Jentic

An AI agent that summarises a workspace for a manager calls Drive Activity through Jentic to answer questions like 'what changed on the launch plan since Friday?' or 'who has been editing the OKRs doc?'. The agent does not need to learn the activity filter grammar; Jentic returns the right operation and schema for each question.

Example prompt: Search Jentic for 'who edited a Drive file', load the POST /v2/activity:query schema, execute with the file's itemName and a 7-day window, and summarise the actors and actions.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /v2/activity:query | Query activity records for a Drive item, folder, or shared drive over a time window with optional filter and grouping |

## Key resources

- **Activity** — Single query endpoint that returns edits, comments, permission changes, moves, and other actions on Drive items

## Why Jentic

- **Setup:** Wiring the Drive Activity API by hand means standing up Google OAuth2 with the right scopes, targeting driveactivity.googleapis.com, and building the activity query bodies yourself for historical item activity. Through Jentic you install once, import the Drive Activity API from the API Directory, store the OAuth credential once, and your agent calls it.
- **Permission scoping:** This API takes the item or ancestor filter in the request body for its single activity query, so scope by operations: limit the agent to the operation it needs, querying Drive activity, and it can do nothing more. You choose the operations it may call, so it only reads the activity you allow.
- **Credential handling:** Your Google OAuth credential for Drive Activity is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'query historical Drive item activity', and Jentic returns the matching Drive Activity operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Google Drive API** — Reads file metadata, content, and permissions referenced by activity records
- **Drive Labels API** — Manages labels and classifications applied to Drive items
- **Admin SDK Directory API** — Resolves user IDs returned by Drive Activity to directory profiles

## FAQ

### What authentication does the Drive Activity API use?

Drive Activity uses Google OAuth 2.0 with the drive.activity or drive.activity.readonly scope. The token must be issued for a user that has access to the queried Drive items. Through Jentic the OAuth credentials are stored in the encrypted vault and the agent receives only scoped Bearer tokens.

### Can I get a per-user activity feed with the Drive Activity API?

Indirectly. The API queries activity for items, not for users, so you build a per-user feed by querying activity on the user's relevant items (or an ancestor folder) and filtering the results by actor.user.knownUser.personName client-side. The actor field on each action identifies who performed it.

### What are the rate limits for the Drive Activity API?

Default per-project quota is 1,000 query requests per 100 seconds and 100 per user per 100 seconds. Heavy audit workloads should paginate via pageToken rather than issuing parallel queries against the same item.

### How do I query activity for a folder through Jentic?

Search Jentic for 'query Drive activity', load the schema for POST /v2/activity:query, and execute with ancestorName set to 'items/{folderId}' and an optional filter like 'time >= "2026-06-01T00:00:00Z"'. Jentic returns the activity list ready to summarise.

### Can the Drive Activity API show file views?

Only when view-tracking is enabled and the activity is exposed through this API; raw view events are not consistently emitted. For auditable view tracking on Workspace, the Admin SDK Reports API (admin.googleapis.com) is the more reliable source for login and access-level events.

### Is the Drive Activity API free?

Yes. The API itself is free; there is no per-call charge. It is gated by the per-project and per-user quotas listed above and requires Drive read access to the items being queried.

### Can I limit what my agent is allowed to do with the Google Drive Activity API?

Yes. Because you run Jentic One yourself, your own rules decide which operations and credentials the agent may use, and this API exposes a single operation, the activity query at POST /v2/activity:query. You can restrict the agent to just that read-only query so it can retrieve historical activity for the items or ancestor folders you allow and do nothing else. The Google OAuth credential you store is injected only at execution time and never reaches the agent's prompt or logs, so the agent reads the activity you permit and no more.
