Elixir client for the Apple Music Feed API.
Access Apple Music's editorial content including:
- Curated playlists and charts
- Editorial stories and featured content
- Genre-specific recommendations
- New releases and top charts
Quick Start
AppleMusicFeed.get_charts(storefront: "us", types: ["songs", "playlists"])
AppleMusicFeed.get_featured_playlists(storefront: "us")
AppleMusicFeed.get_new_releases(storefront: "us")Configuration
config :apple_music_feed,
team_id: System.get_env("APPLE_TEAM_ID"),
key_id: System.get_env("MUSIC_KEY_ID"),
private_key: System.get_env("MUSIC_PRIVATE_KEY"),
base_url: "https://api.music.apple.com",
storefront: "us"Every function also accepts per-call opts that override the application config.
Summary
Functions
Get Apple Music charts for a storefront.
Get editorial mixes/curated stations for a storefront.
Get featured playlists by their IDs.
Get all available genres.
Get new releases albums by their IDs.
Get a specific playlist by ID.
Get tracks from a specific playlist.
Get Apple Music recommendations for a storefront.
Get top songs by their IDs or use get_charts/1 for chart listings.
Return a cached Apple Music Feed access token (after JWT generation).
Types
Functions
Get Apple Music charts for a storefront.
Parameters
opts::storefront- Storefront code (e.g., "us", "gb", "jp"):types- Chart types to retrieve ("songs", "albums", "playlists", "music-videos"):genre- Optional genre ID for genre-specific charts:limit- Maximum results per type (1-100)
Examples
AppleMusicFeed.get_charts(types: ["songs", "albums"])
AppleMusicFeed.get_charts(storefront: "gb", types: ["playlists"], limit: 20)
Get editorial mixes/curated stations for a storefront.
Parameters
opts::storefront- Storefront code:limit- Maximum results (1-100, default 10)
Examples
AppleMusicFeed.get_editorial_mixes()
AppleMusicFeed.get_editorial_mixes(storefront: "us", limit: 20)
Get featured playlists by their IDs.
Apple Music doesn't have a "list all playlists" endpoint. Instead, you fetch specific curated playlists by their IDs. Common featured playlists include "Today's Hits", "New Music Daily", etc.
Parameters
playlist_ids- List of playlist IDs to fetch (required)opts::storefront- Storefront code (default from config or "us"):limit- Maximum results (1-100, default 10)
Examples
# Fetch specific curated playlists
AppleMusicFeed.get_featured_playlists(["pl.5ee8333dbe944d9f9f9c49b8de10d6c5"])
AppleMusicFeed.get_featured_playlists(["pl.5ee8333dbe944d9f9f9c49b8de10d6c5", "pl.3b23b71f436f40cf86503603a0f89312"])
Get all available genres.
Parameters
opts::storefront- Storefront code
Examples
AppleMusicFeed.get_genres()
Get new releases albums by their IDs.
Apple Music doesn't have a "list all new releases" endpoint. Instead, you fetch specific albums by their IDs. Use charts to discover new music.
Parameters
album_ids- List of album IDs to fetch (required)opts::storefront- Storefront code (default from config or "us")
Examples
AppleMusicFeed.get_new_releases(["310730204", "1587056230"])
Get a specific playlist by ID.
Parameters
id- Playlist IDopts::storefront- Storefront code
Examples
AppleMusicFeed.get_playlist("pl.123456789")
Get tracks from a specific playlist.
Parameters
id- Playlist IDopts::storefront- Storefront code:limit- Maximum results (1-100):offset- Pagination offset
Examples
AppleMusicFeed.get_playlist_tracks("pl.123456789")
Get Apple Music recommendations for a storefront.
Parameters
opts::storefront- Storefront code:limit- Maximum results (1-100, default 10):user_token- User token for personalized recommendations (optional)
Examples
AppleMusicFeed.get_recommendations()
AppleMusicFeed.get_recommendations(storefront: "us", limit: 25)
Get top songs by their IDs or use get_charts/1 for chart listings.
Apple Music doesn't have a "list all songs" endpoint. To get top songs, either fetch specific songs by ID or use the charts endpoint.
Parameters
song_ids- List of song IDs to fetch (required)opts::storefront- Storefront code (default from config or "us")
Examples
AppleMusicFeed.get_top_songs(["900083885", "1586110551"])See Also
`get_charts/1` - For chart-based song discovery
Return a cached Apple Music Feed access token (after JWT generation).