> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rewind.rest/llms.txt
> Use this file to discover all available pages before exploring further.

# Year in review

> Returns year-in-review listening data. Optionally pass ?month=N to scope to a single month.



## OpenAPI

````yaml get /v1/listening/year/{year}
openapi: 3.1.0
info:
  title: Rewind API
  version: 1.0.0
  description: >-
    Personal data aggregation API. Syncs and serves data from Last.fm, Apple
    Music, Strava, Plex, Letterboxd, Discogs, Trakt, Instapaper, Google
    Calendar, and Gmail.


    ## Domains


    | Domain | Source | Description |

    |--------|--------|-------------|

    | **Listening** | Last.fm, Apple Music | Scrobbles, top
    artists/albums/tracks, streaks, stats |

    | **Running** | Strava | Activities, splits, gear, personal records, year
    summaries |

    | **Watching** | Plex, Letterboxd | Movies, TV shows, watch history,
    ratings, reviews |

    | **Collecting** | Discogs, Trakt | Vinyl/CD collection, physical media,
    wantlist |

    | **Reading** | Instapaper | Articles, highlights, reading progress, word
    count |

    | **Attending** | Google Calendar, Gmail | Live events, tickets, sports
    games, concerts, venues |


    ## Authentication


    All endpoints require a Bearer token. There are two key types:


    - **Read keys** (`rw_live_...`) — access all GET endpoints

    - **Admin keys** (`rw_admin_...`) — access all endpoints including sync
    triggers and data management


    Pass your key in the Authorization header: `Authorization: Bearer
    rw_live_...`


    ## Pagination


    List endpoints return paginated responses:


    ```json

    {
      "data": [...],
      "pagination": { "page": 1, "limit": 20, "total": 150, "total_pages": 8 }
    }

    ```


    The activity feed uses cursor-based pagination instead.


    ## Quick Start


    ```bash

    # Check the API is up

    curl https://api.rewind.rest/v1/health


    # Fetch recent scrobbles (requires read key)

    curl -H "Authorization: Bearer rw_live_..." \
      https://api.rewind.rest/v1/listening/recent

    # Fetch running stats

    curl -H "Authorization: Bearer rw_live_..." \
      https://api.rewind.rest/v1/running/stats
    ```


    ## Errors


    All errors follow the same envelope:


    ```json

    { "error": "Not found", "status": 404 }

    ```


    Common status codes: 400 (bad request), 401 (unauthorized), 404 (not found),
    500 (server error).
  contact:
    url: https://github.com/pdugan20/rewind
servers:
  - url: https://api.rewind.rest
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Listening
    description: Last.fm scrobbles, top charts, streaks, and stats.
  - name: Running
    description: Strava activities, splits, gear, records, and year summaries.
  - name: Watching
    description: >-
      Movies, TV shows, watch history, ratings, and reviews from Plex and
      Letterboxd.
  - name: Collecting
    description: Vinyl/CD collection from Discogs and physical media from Trakt.
  - name: Reading
    description: Articles, highlights, and reading stats from Instapaper.
  - name: Attending
    description: >-
      Live events you bought tickets for — sports games, concerts, theater.
      Sourced from Google Calendar and ticket-vendor email.
  - name: Feed
    description: Cross-domain activity feed with cursor-based pagination.
  - name: Search
    description: Full-text search across all domains.
  - name: Images
    description: Image proxy with on-the-fly transforms via Cloudflare Images.
  - name: System
    description: Health checks and sync status.
  - name: Admin
    description: >-
      API key management, sync triggers, and data administration. Requires admin
      key.
  - name: Webhooks
    description: Inbound webhook receivers for Strava and Plex. No auth required.
paths:
  /v1/listening/year/{year}:
    get:
      tags:
        - Listening
      summary: Year in review
      description: >-
        Returns year-in-review listening data. Optionally pass ?month=N to scope
        to a single month.
      operationId: getListeningYearInReview
      parameters:
        - schema:
            type: string
            example: '2024'
          required: true
          name: year
          in: path
        - schema:
            type: integer
            minimum: 1
            maximum: 12
            example: 3
            description: Optional month (1-12) to scope results to a single month
          required: false
          description: Optional month (1-12) to scope results to a single month
          name: month
          in: query
        - schema:
            type:
              - boolean
              - 'null'
            description: >-
              When true, attach a `sparkline` object to each item in
              `top_artists`, `top_albums`, and `top_tracks`. Without `month`,
              returns 12 monthly buckets for the year. With `month`, returns
              daily buckets within that month (28-31 points).
            example: false
          required: false
          description: >-
            When true, attach a `sparkline` object to each item in
            `top_artists`, `top_albums`, and `top_tracks`. Without `month`,
            returns 12 monthly buckets for the year. With `month`, returns daily
            buckets within that month (28-31 points).
          name: include_sparklines
          in: query
      responses:
        '200':
          description: Year in review data
          content:
            application/json:
              schema:
                type: object
                properties:
                  year:
                    type: number
                  month:
                    type: number
                  total_scrobbles:
                    type: number
                  unique_artists:
                    type: number
                  unique_albums:
                    type: number
                  unique_tracks:
                    type: number
                  top_artists:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: number
                        name:
                          type: string
                        scrobbles:
                          type: number
                        apple_music_url:
                          type:
                            - string
                            - 'null'
                        image: {}
                        sparkline:
                          type: object
                          properties:
                            granularity:
                              type: string
                              enum:
                                - day
                                - week
                                - month
                                - year
                            points:
                              type: array
                              items:
                                type: number
                          required:
                            - granularity
                            - points
                      required:
                        - id
                        - name
                        - scrobbles
                        - apple_music_url
                  top_albums:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: number
                        name:
                          type: string
                        artist:
                          type: string
                        scrobbles:
                          type: number
                        apple_music_url:
                          type:
                            - string
                            - 'null'
                        image: {}
                        sparkline:
                          type: object
                          properties:
                            granularity:
                              type: string
                              enum:
                                - day
                                - week
                                - month
                                - year
                            points:
                              type: array
                              items:
                                type: number
                          required:
                            - granularity
                            - points
                      required:
                        - id
                        - name
                        - artist
                        - scrobbles
                        - apple_music_url
                  top_tracks:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: number
                        name:
                          type: string
                        artist:
                          type: string
                        scrobbles:
                          type: number
                        apple_music_url:
                          type:
                            - string
                            - 'null'
                        preview_url:
                          type:
                            - string
                            - 'null'
                        sparkline:
                          type: object
                          properties:
                            granularity:
                              type: string
                              enum:
                                - day
                                - week
                                - month
                                - year
                            points:
                              type: array
                              items:
                                type: number
                          required:
                            - granularity
                            - points
                      required:
                        - id
                        - name
                        - artist
                        - scrobbles
                        - apple_music_url
                        - preview_url
                  monthly:
                    type: array
                    items:
                      type: object
                      properties:
                        month:
                          type: string
                        scrobbles:
                          type: number
                        unique_artists:
                          type: number
                        unique_albums:
                          type: number
                      required:
                        - month
                        - scrobbles
                        - unique_artists
                        - unique_albums
                required:
                  - year
                  - total_scrobbles
                  - unique_artists
                  - unique_albums
                  - unique_tracks
                  - top_artists
                  - top_albums
                  - top_tracks
                  - monthly
              example:
                year: 2025
                total_scrobbles: 8500
                unique_artists: 420
                unique_albums: 890
                unique_tracks: 3200
                top_artists:
                  - id: 92
                    name: Taylor Swift
                    scrobbles: 350
                    apple_music_url: >-
                      https://music.apple.com/us/artist/taylor-swift/159260351?uo=4
                    image: null
                  - id: 189
                    name: Nirvana
                    scrobbles: 280
                    apple_music_url: https://music.apple.com/us/artist/nirvana/112018?uo=4
                    image: null
                top_albums:
                  - id: 20
                    name: GUTS
                    artist: Olivia Rodrigo
                    scrobbles: 120
                    apple_music_url: null
                    image: null
                  - id: 300
                    name: MTV Unplugged in New York
                    artist: Nirvana
                    scrobbles: 95
                    apple_music_url: null
                    image: null
                top_tracks:
                  - id: 2001
                    name: Espresso
                    artist: Sabrina Carpenter
                    scrobbles: 68
                    apple_music_url: null
                    preview_url: null
                  - id: 1001
                    name: bad idea right?
                    artist: Olivia Rodrigo
                    scrobbles: 55
                    apple_music_url: null
                    preview_url: null
                monthly:
                  - month: 2025-01
                    scrobbles: 720
                    unique_artists: 85
                    unique_albums: 140
                  - month: 2025-02
                    scrobbles: 680
                    unique_artists: 78
                    unique_albums: 125
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          example: Not found
        status:
          type: integer
          example: 404
      required:
        - error
        - status
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key. Read keys (rw_live_...) access GET endpoints. Admin keys
        (rw_admin_...) access all endpoints.

````