canonical: https://jentic.com/apis/sanity.io/sanity-activity-log

# Sanity Activity Log API

The Sanity Activity Log API returns the audit trail of activity events across Sanity organizations, projects, and users, newest first by timestamp. Events can be filtered by actor, target user, project, organization, action name such as organization.name.edit, and a start and end time window. The same filters drive a CSV export, which sorts its headers alphabetically and spreads event metadata into dynamic metadata columns. Results only include activity that the token's user is allowed to see.

## For AI agents

Read and export Sanity activity events filtered by actor, user, project, organization, action, and time window, as JSON pages or a CSV file.

## Scope

Does not edit content, manage project members, or restore datasets. Use for reading and exporting Sanity activity events only.

## Capabilities

- Retrieve recent Sanity activity events in reverse chronological order with getActivityLogEvents
- Filter events by actorId, userId, projectId, organizationId, or one or more action names
- Bound an audit query to a time window with startTime and endTime
- Page through matching events with limit and offset, capped at 100 events per JSON page
- Export matching activity events as a CSV file with exportActivityLogEventsCsv, up to 50000 rows per export

## Use cases

### AI agent audit assistant

A developer asks their agent who changed something in a Sanity organization. Through Jentic the agent searches for 'get Sanity activity log events', loads the getActivityLogEvents operation with its filter parameters, and calls it with the right actorId, projectId, or action values while the Sanity token is injected at call time. The answer comes straight from the audit trail rather than from guesswork.

Example prompt: Call GET `/v2021-02-01/activity` with organizationId set to the team's organization, action=organization.name.edit, and a startTime seven days ago, then summarise who made each change

### Compliance evidence export

Security reviews often ask for a record of who did what in the content platform. The Activity Log API exports matching events as a CSV with alphabetically sorted headers and metadata keys as their own columns, defaulting to 10000 rows and capped at 50000, so a reviewer gets a spreadsheet-ready file for a set time window.

Example prompt: Call GET `/v2021-02-01/activity/export/csv` with projectId for the production project, startTime 2026-10-01T00:00:00Z, endTime 2026-10-31T23:59:59Z, and limit 50000, and save the returned file

### Per-user activity review

When someone leaves a team, it helps to see what they touched. Filtering activity events by actorId shows the actions that user performed, and filtering by userId shows events that targeted them, such as membership changes, each with timestamps, project, and dataset context.

Example prompt: Call GET `/v2021-02-01/activity` with actorId set to the departing user's ID and limit 100, then page with offset until no more events return

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/v2021-02-01/activity` | Get activity log events as JSON |
| GET | `/v2021-02-01/activity/export/csv` | Export activity log events as CSV |

## Key resources

- **Activity events** — Audit records with actor, action, timestamp, target user, project, organization, and dataset fields
- **CSV export** — The same filtered events as a downloadable CSV with metadata columns

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 72 / 100
- **Maturity:** AI-Aware
- **Dimensions:**
  - Foundational Compliance: 90 / 100
  - Developer Experience & Jentic Compatibility: 83 / 100
  - AI-Readiness & Agent Experience: 57 / 100
  - Agent Usability: 94 / 100
  - Security: 60 / 100
  - AI Discoverability: 63 / 100
- **View full report:** https://jentic.com/apis/sanity.io/sanity-activity-log/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring the Sanity Activity Log API by hand means sending a bearer token, encoding repeatable array query parameters like action and projectId, and handling 401s when a filter names a project the token cannot see. Through Jentic you install once, import it from the API Directory, store the token once, and your agent calls it.
- **Permission scoping:** Both operations are reads and the project and organization filters travel as query parameters, not in the URL path, so a rule bounds which of the two operations your agent may call rather than which project it reads. The token's own access decides which events come back.
- **Credential handling:** Your Sanity API token 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 'get Sanity activity log events' or 'export Sanity audit log', and Jentic returns the matching operation with its filter parameters so the agent builds the query without reading the reference docs.

## Related APIs

- **Sanity HTTP API** — Query and mutate the Sanity documents the activity events refer to
- **Sanity Backups API** — List and download dataset backups
- **Contentful** — Headless CMS with its own management API

## FAQ

### What authentication does the Sanity Activity Log API use?

Per its OpenAPI spec, the Sanity Activity Log API uses a bearer token: a Sanity API token sent as Authorization: Bearer followed by the token. Results only include activity the token's user can access, and filtering by a project or organization the token cannot access returns 401. Through Jentic the token is stored by your own instance and attached at call time.

### Can I filter Sanity activity events by project or organization?

Yes. Both operations accept projectId and organizationId query parameters, and each can be repeated. On its own, organizationId matches only organization-level events, so filter by projectId to see activity inside a project, or omit both to get all activity the token can access.

### How many events can I get from one Sanity Activity Log request?

The JSON endpoint returns 10 events by default and caps limit at 100, with offset for paging. The CSV export defaults to 10000 events and caps limit at 50000.

### What are the rate limits for the Sanity Activity Log API?

The OpenAPI spec does not specify rate limits. Check the Sanity documentation at https://www.sanity.io/docs for current API limits for your plan.

### Is there a Sanity Activity Log MCP server?

You don't need an MCP server to give your agent the Sanity Activity Log API. Jentic connects it directly from the API Directory: import it, store your Sanity token once, and your agent discovers the activity operations on demand instead of loading a server's tool list into its context.

### How do I find out who changed something in Sanity through Jentic?

Search Jentic for 'get Sanity activity log events', load the getActivityLogEvents operation, and execute GET `/v2021-02-01/activity` with filters such as action, projectId, and startTime. To run it on your own infrastructure, install Jentic One from its GitHub repo.

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

Yes. Write a rule that allows the JSON events read but not the CSV export, and the agent can answer audit questions in small pages while bulk exports stay with you. Every call it makes is logged.
