Source: https://dinakar-rewind.docs.pageloop.ai/api-reference/listening/getlisteningtrends

# Listening trends

GET `https://api.rewind.rest/v1/listening/trends`

Returns monthly trend data for a given metric.

## Authorization

#### Authorization (header, string, required)

API key. Read keys (rw\_live\_...) access GET endpoints. Admin keys (rw\_admin\_...) access all endpoints.

## Query Parameters

#### metric (query, enum (string)) — allowed: scrobbles, artists, albums, tracks

#### from (query, string)

#### to (query, string)

## Response

#### 200

Trend data

#### metric (string, required)

#### data (array of object, required)

#### properties

#### period (string, required)

#### value (number, required)

#### 400

Bad request

#### error (string, required)

#### status (integer, required)

#### 401

Unauthorized

#### error (string, required)

#### status (integer, required)

#### Request

```bash cURL
curl -X GET 'https://api.rewind.rest/v1/listening/trends' \
  -H 'Authorization: Bearer <token>'
```

```javascript JavaScript
const res = await fetch('https://api.rewind.rest/v1/listening/trends', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <token>',
  },
});
const data = await res.json();
```

```python Python
import requests

res = requests.get(
    'https://api.rewind.rest/v1/listening/trends',
    headers={'Authorization': 'Bearer <token>'}
)
data = res.json()
```

#### Response

```json 200
{
  "metric": "string",
  "data": [
    {
      "period": "string",
      "value": 0
    }
  ]
}
```

```json 400
{
  "error": "Not found",
  "status": 404
}
```

```json 401
{
  "error": "Not found",
  "status": 404
}
```
