Help teams manage content creation and approval in a clear and structured way
Hygraph
Docs

#Usage metrics API reference

The Hygraph Management API gives you programmatic access to your project's usage and safeguard metrics. You can use this data to build external dashboards or set up alerting for your own monitoring stack. This data is also available in the Usage dashboard.

#Prerequisites

To query usage metrics, your Permanent Auth Token must include the Read observability data Management API permission. For more information, see Management API permissions.

#Query structure

On the Management API, the usage field exists on:

  • viewer.project: Project-level metrics.
  • viewer.project.environment: Environment-level metrics.
viewer {
project(id: $projectId) {
usage(end: $end, start: $start) {
# project-level metrics
}
environment(id: $environmentId) {
usage(end: $end, start: $start) {
# environment-level metrics
}
}
}
}

Replace $projectId and $environmentId with the IDs from your project settings. You can find the Project ID and environment ID in the project URL: https://app.hygraph.com/<projectId>/<environmentId>/.

#Arguments

ArgumentTypeDescription
endDateTime!End of the requested date range.
startDateTime!Start of the requested date range. The API only returns data within your plan’s retention window.

Retention depends on your plan:

  • Hobby plans: 30 days
  • Paid plans: 365 days

Requesting a start date earlier than your retention window does not return an error. The API clips the start to the earliest retained date and returns data from that point forward.

#Metrics

#Billing metrics

Billing metrics are summed across all environments at project level. These metrics reflect consumption against your plan limits.

FieldUnitsDescription
apiOperationsRequest count per dayExternal Content API requests, excluding Studio traffic. Aggregated for usage reporting.
assetTrafficBytes per dayAsset data transferred, counted toward asset bandwidth usage.

#Technical safeguard metrics

Technical safeguard metrics relate to the same limits as API limits. They exist on both project and environment usage. For interpreting these limits, environment usage is usually the best match, because limits apply per environment.

At project level (viewer.project { usage }):

  • maxRps*, maxConcurrency*, maxRequestSize*: For each day in the range, the maximum value observed across all environments. This is the largest per-environment value for that day, not a single merged peak across the whole project.
  • *OverLimit*: For each day in the range, the total count across all environments.

At environment level (viewer.project.environment { usage }):

  • maxRps*, maxConcurrency*, maxRequestSize*: For each day in the range, the maximum value observed for that environment only.
  • *OverLimit*: For each day in the range, the total count for that environment only.
FieldDescription
maxRpsQueriesPeak requests per second for queries.
maxRpsMutationsPeak requests per second for mutations.
maxConcurrencyQueriesPeak in-flight concurrent operations for queries.
maxConcurrencyMutationsPeak in-flight concurrent operations for mutations.
maxRequestSizeQueriesLargest GraphQL payload size observed for queries.
maxRequestSizeMutationsLargest GraphQL payload size observed for mutations.
rpsOverLimitQueriesRequests that exceeded the RPS limit for queries.
rpsOverLimitMutationsRequests that exceeded the RPS limit for mutations.
concurrencyOverLimitQueriesRequests that exceeded the concurrency limit for queries.
concurrencyOverLimitMutationsRequests that exceeded the concurrency limit for mutations.
requestSizeOverLimitQueriesRequests that exceeded the request size limit for queries.
requestSizeOverLimitMutationsRequests that exceeded the request size limit for mutations.

#Response

FieldTypeDescription
timestamps[DateTime!]!Start of each day in the date range.
values[Float!]!One value per day in the date range, in the same order.

Metrics update once per day and responses are cached for a short interval. Avoid polling more frequently than every few minutes. Data for the current day may be incomplete; use the previous day's data for reliable trend analysis.

#Example query

This query returns project-level billing metrics and environment-level safeguard metrics over a custom date range.