openapi: 3.0.3
info:
  title: LyricsFeast Charts API
  version: "1.0.0"
  description: |
    Free JSON feeds of the songs people read on LyricsFeast and of Apple Music's
    most played songs in seven countries. Every song links to its lyrics and to
    its line-by-line translations in English, Spanish, German, French, Italian,
    Portuguese, Russian and Japanese. No key, no sign-up. Static files, updated
    every hour, served with CORS enabled. The feeds hold titles, artists and
    links only, never lyrics.

    Please credit LyricsFeast (https://lyricsfeast.com/) with a link wherever
    you show the data. Apple Music feeds: credit Apple Music and link each song
    with apple_music_url.
  contact:
    name: LyricsFeast
    url: https://lyricsfeast.com/charts-api.html
    email: pablo@lyricsfeast.com
  x-logo:
    url: https://lyricsfeast.com/images/lyricsfeast-logo-500.png
externalDocs:
  description: Documentation
  url: https://lyricsfeast.com/charts-api.html
servers:
  - url: https://lyricsfeast.github.io/charts-api/v1
    description: GitHub Pages (any client)
  - url: https://lyricsfeast.com/charts/v1
    description: LyricsFeast (browsers only)
tags:
  - name: LyricsFeast
    description: Charts built from page views on LyricsFeast
  - name: Apple Music
    description: Apple Music's most played songs, with lyrics links
paths:
  /index.json:
    get:
      summary: List every feed
      operationId: listFeeds
      tags: [LyricsFeast]
      responses:
        "200":
          description: The feeds, with their URLs and song counts
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Index"
  /trending.json:
    get:
      summary: Trending lyrics, last 7 days
      description: The 30 most read songs on LyricsFeast in the last 7 days, all languages.
      operationId: getTrending
      tags: [LyricsFeast]
      responses:
        "200":
          description: The chart
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Chart"
  /top-month/{lang}.json:
    get:
      summary: Top lyrics this month on one language site
      description: The 50 most read songs of the last 30 days on one LyricsFeast language site. Each song has page_url, its page on that site.
      operationId: getTopMonth
      tags: [LyricsFeast]
      parameters:
        - name: lang
          in: path
          required: true
          schema:
            type: string
            enum: [en, es, de, fr, it, pt, ru, jp]
      responses:
        "200":
          description: The chart
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TopMonthChart"
        "404":
          description: No such language
  /apple-music/{country}.json:
    get:
      summary: Apple Music most played songs in a country
      description: Apple Music's 100 most played songs today in one country, with each song's lyrics and translations on LyricsFeast.
      operationId: getAppleMusicChart
      tags: [Apple Music]
      parameters:
        - name: country
          in: path
          required: true
          schema:
            type: string
            enum: [us, de, it, fr, es, mx, br]
      responses:
        "200":
          description: The chart
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AppleChart"
        "404":
          description: No such country
components:
  schemas:
    Index:
      type: object
      properties:
        name: { type: string, example: LyricsFeast Charts API }
        version: { type: integer, example: 1 }
        updated: { type: string, format: date-time }
        docs: { type: string, format: uri }
        attribution: { type: string }
        files:
          type: array
          items:
            type: object
            properties:
              url: { type: string, format: uri }
              title: { type: string }
              songs: { type: integer }
    ChartHead:
      type: object
      properties:
        title: { type: string }
        description: { type: string }
        updated: { type: string, format: date-time, description: When the file was written (UTC) }
        source: { type: string }
        attribution: { type: string }
        docs: { type: string, format: uri }
    Song:
      type: object
      required: [rank, title, artist, lyrics_url, pages]
      properties:
        rank: { type: integer, example: 1 }
        title: { type: string, example: "Choosin' Texas" }
        artist: { type: string, example: Ella Langley }
        original_language:
          type: string
          nullable: true
          description: The language the song is sung in (ISO 639-1, but jp for Japanese); null when there are no lyrics yet
          example: en
        lyrics_url:
          type: string
          format: uri
          description: The song's main page on LyricsFeast
          example: https://lyricsfeast.com/song-choosin-texas-lyrics-ella-langley.html
        pages:
          type: object
          description: The song's page on each language site that has it, keyed by language (en, es, de, fr, it, pt, ru, jp). The site of the song's own language shows the original lyrics; the others add a line-by-line translation.
          additionalProperties: { type: string, format: uri }
    Chart:
      allOf:
        - $ref: "#/components/schemas/ChartHead"
        - type: object
          properties:
            songs:
              type: array
              items: { $ref: "#/components/schemas/Song" }
    TopMonthChart:
      allOf:
        - $ref: "#/components/schemas/ChartHead"
        - type: object
          properties:
            language: { type: string, example: de }
            songs:
              type: array
              items:
                allOf:
                  - $ref: "#/components/schemas/Song"
                  - type: object
                    properties:
                      page_url: { type: string, format: uri, description: The song's page on this feed's language site }
    AppleChart:
      allOf:
        - $ref: "#/components/schemas/ChartHead"
        - type: object
          properties:
            country: { type: string, example: us }
            chart_date: { type: string, format: date }
            apple_notice: { type: string }
            songs:
              type: array
              items:
                allOf:
                  - $ref: "#/components/schemas/Song"
                  - type: object
                    properties:
                      explicit: { type: boolean }
                      apple_music_url: { type: string, format: uri, nullable: true }
