API Documentation

Step 1: Get Your API Key

To start using the API, you need to generate an API key.

  1. Click here to get your own API key.
  2. Follow the instructions on the page to generate your unique API key.
  3. Store this API key securely, as you will need it for every request.

Step 2: Making a POST Request

Endpoint:

https://song.speakinsongs.com/api/v1/songs

Required Headers

x-api-key: <add-api-key-here>

Request Body (Example)

{
  "words": ["hello", "world"]
}

NOTE 1: The words array CANNOT be empty. Must contain ONLY strings.

NOTE 2: All punctuation is stripped from strings to provide the best matching results.

Example Request

Using curl:

curl -X POST https://song.speakinsongs.com/api/v1/songs \ 
     -H "Content-Type: application/json" \ 
     -H "x-api-key: <add-api-key-here>" \
     -d '{"words": ["hello", "world"]}'

API Response

The API returns an array of objects, where each object provides detailed information about a matched song. Below is the structure of the response:

  • input: The word you provided as input.
  • song_name: The title of the matched song.
  • spotify_song_id: The unique identifier for the song on Spotify.
  • spotify_song_urls: An object containing URLs for the song on Spotify, e.g.
    • spotify: The direct spotify link to the song.
  • artists: An array of objects, each representing an artist associated with the song. Each artist object contains:
    • name: The artist's name.
    • id: The artist's unique Spotify ID.
    • href: The API link to the artist.
    • uri: The Spotify URI for the artist.
    • external_urls: Links to the artist's profile.
  • images: An array of objects, each representing a song-related image. Each image object includes:
    • url: The URL of the image.
    • height: Height of the image.
    • width: Width of the image.
  • popularity: A score supplied by Spotify that represents the popularity of the song.

NOTE: If a word cannot be matched to a song then the object will be returned with NULL values

Example Response

{
  "songs": [
    {
      "input": "hello",
      "song_name": "Hello",
      "spotify_song_id": "1Yk0cQdMLx5RzzFTYwmuld",
      "spotify_song_urls": {
        "spotify": "https://open.spotify.com/track/1Yk0cQdMLx5RzzFTYwmuld"
      },
      "artists": [
        {
          "name": "Adele",
          "id": "4dpARuHxo51G3z768sgnrY",
          "uri": "spotify:artist:4dpARuHxo51G3z768sgnrY",
          "href": "https://api.spotify.com/v1/artists/4dpARuHxo51G3z768sgnrY",
          "external_urls": {
            "spotify": "https://open.spotify.com/artist/4dpARuHxo51G3z768sgnrY"
          }
        }
      ],
      "images": [
        {
          "height": 640,
          "width": 640,
          "url": "https://i.scdn.co/image/ab67616d0000b2737b9888dc365b8f957c63df14"
        },
        {
          "height": 300,
          "width": 300,
          "url": "https://i.scdn.co/image/ab67616d00001e027b9888dc365b8f957c63df14"
        },
        {
          "height": 64,
          "width": 64,
          "url": "https://i.scdn.co/image/ab67616d000048517b9888dc365b8f957c63df14"
        }
      ],
      "popularity": 73
    },
    {
      "input": "world",
      "song_name": "world",
      "spotify_song_id": "4hFZF8l3pJfFOtXs7K0nUJ",
      "spotify_song_urls": {
        "spotify": "https://open.spotify.com/track/4hFZF8l3pJfFOtXs7K0nUJ"
      },
      "artists": [
        {
          "name": "Zeph",
          "id": "502gYHkFCtLzBIcU4ctPLd",
          "uri": "spotify:artist:502gYHkFCtLzBIcU4ctPLd",
          "href": "https://api.spotify.com/v1/artists/502gYHkFCtLzBIcU4ctPLd",
          "external_urls": {
            "spotify": "https://open.spotify.com/artist/502gYHkFCtLzBIcU4ctPLd"
          }
        }
      ],
      "images": [
        {
          "height": 640,
          "width": 640,
          "url": "https://i.scdn.co/image/ab67616d0000b2735ec850e5d828e40f03f4588c"
        },
        {
          "height": 300,
          "width": 300,
          "url": "https://i.scdn.co/image/ab67616d00001e025ec850e5d828e40f03f4588c"
        },
        {
          "height": 64,
          "width": 64,
          "url": "https://i.scdn.co/image/ab67616d000048515ec850e5d828e40f03f4588c"
        }
      ],
      "popularity": 43
    }
  ]
}

Additional Notes

The images array may contain multiple sizes of the same image, useful for responsive design. Use the spotify_song_urls and artists.external_urls fields to link directly to Spotify resources.