# Get requests per endpoint
URL: https://musicapi.com/docs/reference/usage-top-routes.md

`GET https://api.musicapi.com/public/analytics/top-routes`

Section: Billing and usage.
Product: MusicAPI Core and MusicAPI Managed Transfers.
Auth: Basic, DocsSession (any one of them). Use Basic with your Client ID and Client Secret from your server only.

Your most called endpoints in the range, with their error rate and average response time. Requires Client Secret authentication. Not billed.

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `startDate` | string | yes | The first day of the range (UTC), for example `2026-10-01`. The day counts. |
| `endDate` | string | yes | The last day of the range (UTC). The day counts, so `startDate` = `endDate` is one day. The range may hold at most 366 days, or 31 days for an `hourly` series. |
| `integrationType` | spotify \\| appleMusic \\| youtube \\| tidal \\| resso \\| boomplay \\| amazonMusic \\| deezer \\| pandora \\| soundCloud \\| youtubeMusic \\| napster \\| qobuz \\| qqMusic \\| yandexMusic \\| vkMusic \\| anghami \\| zvuk \\| gaana \\| jiosaavn \\| audiomack | no | Count only the requests for this music service. Leave it out for every service. |
| `limit` | number | no | The number of rows. Default: `20`. |

## Response 200

The most called endpoint first.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | object[] | yes |  |
| `data[].api_route` | string | yes | The endpoint, for example `playlists`. |
| `data[].api_type` | string | yes | The kind of call, for example `api` or `transfer`. |
| `data[].total_requests` | string | yes | Requests to this endpoint. A decimal string, so a large count stays exact. |
| `data[].error_count` | string | yes | Requests to this endpoint that failed. A decimal string, so a large count stays exact. |
| `data[].error_rate` | number | yes | `error_count` / `total_requests` in percent, two decimals. |
| `data[].avg_response_time_ms` | number | yes | The average response time in milliseconds. |

```json
{
  "data": [
    {
      "api_route": "string",
      "api_type": "string",
      "total_requests": "string",
      "error_count": "string",
      "error_rate": 0,
      "avg_response_time_ms": 0
    }
  ]
}
```

## Errors

- 400: A date is missing or not valid, `endDate` is before `startDate`, or the range is too long.
- 401: The request has no credentials.
- 403: The request does not use Client Secret authentication.
- 429: Your account sent more calls this minute than its rate limit allows.

## Example

```bash
curl https://api.musicapi.com/public/analytics/top-routes \
  -u "$MUSICAPI_CLIENT_ID:$MUSICAPI_CLIENT_SECRET"
```
