# Service Metrics Data API

This topic covers how to programmatically retrieve [usage metrics](https://help.sonatype.com/en/usage-metrics.html "Usage Metrics") from the API. This API is not currently available in the Swagger documentation that displays within the Nexus Repository user interface.

The `nexus:metrics:read` privilege is required to use this API.

For versions prior to 3.81, query the `/service/metrics/data` endpoint. Starting with version 3.81 and later, this changes to the `/service/rest/metrics/data` endpoint for the fields specified in the table below.

| Metric\* | JSON Path | Notes |
| --- | --- | --- |
| Total Components | `gauges."nexus.analytics.component_total_count".value` | Shows current total |
| Max Components (30 days) | `max(gauges."nexus.analytics.component_total_count".value)` | Track `component_total_count` over 30 days to get a peak value |
| Requests per Day | `gauges."nexus.analytics.content_request_count".value.day` | Shows current daily total |

\* "Metric" in this instance refers to the corresponding metric available in the user interface via the [Usage Center](https://help.sonatype.com/en/usage-center.html "Usage Center"). For maximum data parity with the [user interface metrics information](https://help.sonatype.com/en/usage-metrics.html "Usage Metrics"), you will want to retrieve this data before midnight (based on server time) each day.

## Search results

No results found
