Skip to content

How to retrieve project usage data via API?

2repliesLast updated: Nov 13, 2026

I'm looking for an API endoint to retrieve usage data for a project, but I can't seem to find anything here: https://www.sanity.io/docs/projects-api Does it actually exists, and if not, is it something that is coming anytime soon?
AI Update

No, there's no API endpoint that returns a project's usage totals (API requests, bandwidth and so on). The documented way to see usage is the Usage tab in sanity.io/manage. To get usage data into your own tooling (Grafana, BigQuery and similar), use request logs: raw per-request data you can add up yourself.

What the Projects API covers

The Projects API has endpoints for projects, CORS origins, datasets (including copy), tokens, users, features, permissions and tags. None of them return usage or quota figures.

The Activity Log API (GET https://api.sanity.io/v2021-02-01/activity) doesn't fill this gap either. It returns management events such as invites, role changes and plan changes. It has no usage metrics, and it can't retrieve content activity.

Viewing usage in the dashboard

Getting usage data out: request logs

Request logs record each API request with fields such as domain, endpoint, dataset, request tags, status, duration and response size. You can add these up into your own usage metrics.

Self-serve export (all self-serve plans):

For example, to sum bandwidth (in MB) per asset URL on the CDN:

gunzip --stdout request-logs.ndjson.gz \
  | jq -r 'select(.attributes.sanity.domain == "cdn")
           | select(any(.attributes.sanity.tags[]?; startswith("sanity.studio")) | not)
           | "\(.body.responseSize)\t\(.body.url)"' \
  | awk -F'\t' '{bytes[$2] += $1} END {for (url in bytes) printf "%.1f\t%s\n", bytes[url]/1000/1000, url}' \
  | sort -rn | head -10

Continuous delivery to Google Cloud Storage (paid feature on some Enterprise plans; contact sales):

Add request tags to your client requests so you can break usage down by app or feature.

Other options

Check the docs above for changes, since a usage endpoint isn't documented today.

Show original thread
2 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions