iTunes Search API
Table of Contents
- Searching the iTunes Store
- Search Examples
- Lookup Examples
- Understanding Search Results
- Caching Architecture
The Search API allows you to place search fields in your website to search for content within the iTunes Store and Apple Books Store. You can search for a variety of content; including books, movies, podcasts, music, music videos, audiobooks, and TV shows. You can also call an ID-based lookup request to create mappings between your content library and the digital catalog. Developers may use promotional content in the API, including previews of songs, music videos, album art and App icons only to promote store content and not for entertainment purposes. Use of sound samples and other assets from the API must be proximate to a store badge. Terms and conditions apply.
The Affiliate Program allows you to earn a commission on qualifying revenue generated by clicks initiated from your website or app into the iTunes Store and Apple Books Store. For more information on the Affiliate Program, see http://www.apple.com/itunes/affiliates.
The fully-qualified URL must have the following format:
Where parameterkeyvalue can be one or more parameter key and value pairs indicating the details of your query.
To construct a parameter key and value pair, you must concatenate each parameter key with an equal sign (=) and a value string. For example:
. To create a string of parameter key and value pairs, you must concatenate each pair using an ampersand (&). For example:
Note: When creating search fields and scripts for your website, you should use dynamic script tags for your xmlhttp script call requests. For example:
The following table defines the parameter keys and values you can specify to search for content within the iTunes Store or Apple Books Store:
|term||The URL-encoded text string you want to search for. For example: jack+johnson.||Y||Any URL-encoded text string. Note: URL encoding replaces spaces with the plus (+) character and all characters except the following are encoded: letters, numbers, periods (.), dashes (-), underscores (_), and asterisks (*).|
|country||The two-letter country code for the store you want to search. The search uses the default store front for the specified country. For example: US. The default is US.||Y||See http://en.wikipedia.org/wiki/ ISO_3166-1_alpha-2 for a list of ISO Country Codes.|
|media||The media type you want to search for. For example: movie. The default is all.||N||movie, podcast, music, musicVideo, audiobook, shortFilm, tvShow, software, ebook, all|
|entity||The type of results you want returned, relative to the specified media type. For example: movieArtist for a movie media type search. The default is the track entity associated with the specified media type.||N||The following entities are available for each media type:
|attribute||The attribute you want to search for in the stores, relative to the specified media type. For example, if you want to search for an artist by name specify entity=allArtist&attribute=allArtistTerm. In this example, if you search for term=maroon, iTunes returns “Maroon 5” in the search results, instead of all artists who have ever recorded a song with the word “maroon” in the title.
The default is all attributes associated with the specified media type.
|N||The following attributes are available for each media type:
|limit||The number of search results you want the iTunes Store to return. For example: 25.The default is 50.||N||1 to 200|
|lang||The language, English or Japanese, you want to use when returning search results. Specify the language using the five-letter codename. For example: en_us.The default is en_us (English).||N||en_us, ja_jp|
|version||The search result key version you want to receive back from your search.The default is 2.||N||1, 2|
|explicit||A flag indicating whether or not you want to include explicit content in your search results.The default is Yes.||N||Yes, No|
- It is critical to encode your URLs correctly in order to be commissioned for affiliate links. Notes on affiliate encoding raw links can be found in the Advanced Affiliate Linking document.
- To improve response times, minimize the number of search results the Search API returns by specifying an appropriate value for the limit parameter key.
- The Search API is limited to approximately 20 calls per minute (subject to change). If you require heavier usage, we suggest you consider using our Enterprise Partner Feed (EPF). If you wish to access content on our EPF, please review our documentation page for more information.
- Large websites should set up caching logic for the search and lookup requests sent to the Search API. For an illustration, see Caching Architecture later in this document.
The following are examples of fully-qualified URLs for specific search requests:
- To search for all Jack Johnson audio and video content (movies, podcasts, music, music videos, audiobooks, short films, and tv shows), your URL would look like the following:
- To search for all Jack Johnson audio and video content and return only the first 25 items, your URL would look like the following:
- To search for only Jack Johnson music videos, your URL would look like the following:
- To search for all Jim Jones audio and video content and return only the results from the Canada iTunes Store, your URL would look like the following:
You can also create a lookup request to search for content in the stores based on iTunes IDs, UPCs/ EANs, and All Music Guide (AMG) IDs. ID-based lookups are faster and contain fewer false-positive results.
The following are examples of fully-qualified URLs for specific lookup requests:
- Look up Jack Johnson by iTunes artist ID:
- Look up Jack Johnson by AMG artist ID:
- Look up multiple artists by their AMG artist IDs:
- Look up all albums for Jack Johnson:
- Look up multiple artists by their AMG artist IDs and get each artist’s top 5 albums:
- Look up multiple artists by their AMG artist IDs and get each artist’s 5 most recent songs:
- Look up an album or video by its UPC:
- Look up an album by its UPC, including the tracks on that album:
- Look up an album by its AMG Album ID:
- Look up a Movie by AMG Video ID:
- Look up a book by its 13 digit ISBN:
- An ordered list of values, also known as an array. An array is an ordered collection of values, beginning with a left bracket ( [ ) and ending with a right bracket ( ] ). Values are separated by commas ( , ).
All JSON results are encoded as UTF-8. For more information on JSON, please see http://www.json.org.
The following example displays the JSON results for a song in the iTunes Store:
"collectionName":"Sing-a-Longs and Lullabies for the Film Curious George",
"collectionCensoredName":"Sing-a-Longs and Lullabies for the Film Curious George",
The following table defines the JSON result keys and values:
|Result Key||Description||Returned||Return Values and Examples|
|wrapperType||The name of the object returned by the search request.||Y||track, collection, artistFor example: track.|
|*explicitness||The Recording Industry Association of America (RIAA) parental advisory for the content returned by the search request.For more information, see
|Y||explicit (explicit lyrics, possibly explicit album cover), cleaned (explicit lyrics “bleeped out”), notExplicit (no explicit lyrics)For example: “trackExplicitness”:”notExplicit”.|
|kind||The kind of content returned by the search request.||Y||book, album, coached-audio, feature-movie, interactive- booklet, music-video, pdf podcast, podcast-episode, software-package, song, tv- episode, artistFor example: song.|
|trackName||The name of the track, song, video, TV episode, and so on returned by the search request.||Y||For example: “Banana Pancakes”.|
|artistName||The name of the artist returned by the search request.||Y||For example: Jack Johnson.|
|collectionName||The name of the album, TV season, audiobook, and so on returned by the search request.||Y||For example: “In Between Dreams”.|
|*censoredName||The name of the album, TV season, audiobook, and so on returned by the search request, with objectionable words *’d out.Note: Artist names are never censored.||Y||For example: “S**t Happens”.|
|artworkUrl100, artworkUrl60||A URL for the artwork associated with the returned media type, sized to 100×100 pixels or 60×60 pixels.||Only returned when artwork is available||For example: “http:// a1.itunes.apple.com/jp/r10/Music/ y2005/m06/d03/h05/ s05.oazjtxkw.100×100-75.jpg”.|
|*viewURL||A URL for the content associated with the returned media type. You can click the URL to view the content in the iTunes Store.||Y||For example: “http:// itunes.apple.com/WebObjects/ MZStore.woa/wa/viewAlbum? i=68615807&id=68615813&s=1434 62”.|
|previewUrl||A URL referencing the 30-second preview file for the content associated with the returned media type. .||Only returned when media type is track||For example: “http:// a392.itunes.apple.com/jp/r10/ Music/y2005/m06/d03/h05/s05.zdzqlufu.p.m4p”.|
|trackTimeMillis||The returned track’s time in milliseconds.||Only returned when media type is track|
Developers may use certain promotional content as may be provided by Apple, including previews of songs and music videos, and album art, for the purposes of promoting the subject of the Promo Content; provided such Promo Content: (i) is placed only on pages that promote the content on which the Promo Content is based; (ii) is proximate to a “Download on iTunes” or “Download on App Store” badge (as approved by Apple) that acts as a link directly to pages within iTunes where consumers can purchase the promoted content; (iii) includes attribution indicating the Promo Content was “provided courtesy of iTunes” if such Promo Content includes song or music video previews; (iv) is streamed only, and not downloaded, saved, cached, or synchronized with video, if such Promo Content includes song or music video previews; (v) is not used for independent entertainment value apart from its promotional purpose; and (vi) is not used to promote any other goods or services. Developer acknowledges that Apple provides the Promo Content “as is,” and disclaims any and all representations or warranties, including, but not limited to, non-infringement. Developer shall forward any claims received in connection with the Promo Content to Apple immediately upon receipt, and will remove any Promo Content immediately upon request from Apple.
This agreement and your use of Promo Content are governed by California law.