Source: https://dinakar-rewind.docs.pageloop.ai/api-reference/admin/adminsynclistening

# Trigger Last.fm sync

POST `https://api.rewind.rest/v1/admin/sync/listening`

Manually trigger a Last.fm listening sync. Supports scrobbles, top\_lists, stats, full, and backfill sync types.

## Authorization

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

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

## Body

#### type (body, enum (string)) — allowed: scrobbles, top\_lists, stats, full, backfill, artist\_tags, artist\_bios, artist\_similar

## Response

#### 200

Sync completed successfully

#### status (enum (string), required) — allowed: completed

#### items\_synced (integer, required)

#### timestamp (string)

#### geocoded (integer)

Running only: activities reverse-geocoded in this call (bounded batch).

#### geocode\_remaining (integer)

Running only: activities with coordinates still awaiting geocoding. Call again to drain.

#### 400

Bad request

#### error (string, required)

#### status (integer, required)

#### 401

Unauthorized

#### error (string, required)

#### status (integer, required)

#### 500

Internal server error

#### error (string, required)

#### status (integer, required)

#### Request

```bash cURL
curl -X POST 'https://api.rewind.rest/v1/admin/sync/listening' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{"type": "scrobbles"}'
```

```javascript JavaScript
const res = await fetch('https://api.rewind.rest/v1/admin/sync/listening', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"type": "scrobbles"}),
});
const data = await res.json();
```

```python Python
import requests

res = requests.post(
    'https://api.rewind.rest/v1/admin/sync/listening',
    headers={'Authorization': 'Bearer <token>'},
    json={"type": "scrobbles"}
)
data = res.json()
```

#### Response

```json 200
{
  "status": "completed",
  "items_synced": 42,
  "timestamp": "date-time",
  "geocoded": 200,
  "geocode_remaining": 864
}
```

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

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

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