Categories We Write About

Fetch lyrics from music APIs

To fetch lyrics from music APIs, you can use several popular services that provide song lyrics and related metadata. Here’s a guide to get you started, including some commonly used APIs:


1. Genius API

Website: https://genius.com

Features:

  • Lyrics (partial access via API, full lyrics must be scraped from song pages)

  • Artist, album, and track data

  • Requires user authentication via OAuth

How to Use:

Example (Python):

python
import requests base_url = "https://api.genius.com" headers = {'Authorization': 'Bearer YOUR_GENIUS_ACCESS_TOKEN'} search_url = base_url + "/search" params = {'q': 'Bohemian Rhapsody'} response = requests.get(search_url, params=params, headers=headers) data = response.json() song_path = data['response']['hits'][0]['result']['path'] print("https://genius.com" + song_path)

Note: You’ll need to scrape lyrics from the Genius webpage as the API doesn’t return full lyrics due to licensing.


2. Lyrics.ovh

Website: https://lyricsovh.docs.apiary.io/

Features:

  • Free and open API

  • No authentication required

  • Lyrics only, basic data

How to Use:

  • Simple GET request: https://api.lyrics.ovh/v1/artist/title

Example (Python):

python
import requests artist = "Coldplay" title = "Yellow" url = f"https://api.lyrics.ovh/v1/{artist}/{title}" response = requests.get(url) data = response.json() print(data['lyrics'])

3. Musixmatch API

Website: https://developer.musixmatch.com/

Features:

  • Large lyrics database

  • Language detection, subtitle sync

  • Licensed lyrics API (some features require paid plans)

How to Use:

  • Sign up and get API key

  • Endpoints include track search, lyrics retrieval

Example (Python):

python
import requests api_key = "YOUR_MUSIXMATCH_API_KEY" url = "https://api.musixmatch.com/ws/1.1/matcher.lyrics.get" params = { 'q_track': 'Blinding Lights', 'q_artist': 'The Weeknd', 'apikey': api_key } response = requests.get(url, params=params) data = response.json() lyrics = data['message']['body']['lyrics']['lyrics_body'] print(lyrics)

4. AudD API

Website: https://audd.io

Features:

  • Recognizes music and fetches lyrics

  • Can work with file uploads, YouTube links, and streaming services

  • Paid plans for advanced use

How to Use:

  • Register for an API key

  • Use /findLyrics/ or /recognize/ endpoints

Example (Python):

python
import requests api_token = "YOUR_AUDD_API_TOKEN" url = "https://api.audd.io/findLyrics/" params = { 'q': 'Adele Hello', 'api_token': api_token } response = requests.get(url, params=params) print(response.json())

Key Considerations:

  • Copyright: Always ensure you have proper rights to display lyrics on your platform.

  • Rate limits: Most APIs have usage limits for free plans.

  • Accuracy: Some APIs only return partial lyrics or summaries.

  • Scraping: For full lyrics (especially from Genius), web scraping may be necessary, but it could violate terms of service.


If you’re building a commercial or public-facing website, Musixmatch and AudD offer the most legitimate licensing options. For hobby or limited-use projects, Lyrics.ovh and Genius (with scraping) are practical free choices.

Share This Page:

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories We Write About