Apple Music track API
Title, artists, album, duration, ISRC, composer and the 30 second preview.
- Cost
- 1 credit
- Cached repeats
- 0 creditssend max_age_days, results kept 30 days
- Failed requests
- 0 credits
- Status
- Betashape may still gain fields
A track link on an album page ends in ?i=<song id>; that id is the song's.
You send one of url or id.
Request
Send your key in the x-api-key header.
curl -G "https://api.socialscrape.io/v1/apple-music/track" \
-H "x-api-key: $SOCIALSCRAPE_API_KEY" \
--data-urlencode 'id=1468058169'import os
import requests
params = {
"id": "1468058169",
}
res = requests.get(
"https://api.socialscrape.io/v1/apple-music/track",
headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
params=params,
timeout=60,
)
body = res.json()
if body["ok"]:
print(body["data"])
else:
print(body["error"]["code"], body["error"]["message"])const url = new URL("https://api.socialscrape.io/v1/apple-music/track");
url.search = new URLSearchParams({
id: "1468058169",
}).toString();
const res = await fetch(url, {
headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();
if (body.ok) {
console.log(body.data);
} else {
console.error(body.error.code, body.error.message);
}{
"nodes": [
{
"name": "SocialScrape Apple Music track",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
0,
0
],
"parameters": {
"method": "GET",
"url": "https://api.socialscrape.io/v1/apple-music/track",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "id",
"value": "1468058169"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
}
]
}
}
}
],
"connections": {}
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
url | url | one of | Apple Music song URL. |
id | string | one of | Apple Music song id. |
region | string | Two-letter country code (ISO 3166-1) for results that vary by country. Also accepted as country, geo. |
Every request also accepts trim, raw and max_age_days.
Response
Sample from a recorded response, shortened. Values are public data, not yours.
{
"ok": true,
"credits_charged": 1,
"credits_remaining": 4999,
"cached": false,
"cached_at": null,
"request_id": "req_d8c814d2f32115bfd96e3add",
"data": {
"object": "song",
"platform": "apple_music",
"id": "1468058169",
"url": "https://music.apple.com/us/album/i-forgot-that-you-existed/1468058165?i=1468058169",
"title": "I Forgot That You Existed",
"artists": [
"Taylor Swift"
],
"album": "Lover",
"duration_seconds": 170.651,
"cover_url": "https://is1-ssl.mzstatic.com/image/thumb/Music125/v4/49/3d/ab/493dab54-f920-9043-6181-80993b8116c9/19UMGIM53909.rgb.jpg/1200x1200bb.jpg",
"preview_url": "https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview221/v4/9c/e2/97/9ce2976a-b1c8-aa80-3e94-f4562cbad53e/mzaf_13898706762824220632.plus.aac.ep.m4a",
"released_at": "2019-08-23",
"isrc": "USUG11901471",
"explicit": false,
"is_original": null,
"stats": {
"plays": null,
"uses": null,
"likes": null
},
"extra": {
"album_artist": "Taylor Swift",
"album_id": "1468058165",
"album_url": "https://music.apple.com/us/album/lover/1468058165",
"artist_ids": [
"159260351"
],
"audio_locale": "en-US",
"audio_traits": [
"atmos",
"lossless",
"lossy-stereo"
]
}
},
"cursor": null,
"has_more": null
}Fields
One Song in data.
A field the platform does not give is null, never made up. Extra platform details are in extra.
| Field | Type | Always | Notes |
|---|---|---|---|
object | "song" | ||
platform | Platform | yes | |
id | string | yes | |
url | string or null | ||
title | string or null | ||
artists | string[] or null | ||
album | string or null | ||
duration_seconds | number or null | ||
cover_url | string or null | ||
preview_url | string or null | ||
released_at | string (ISO 8601 date) or null | ||
isrc | string or null | ||
explicit | boolean or null | ||
is_original | boolean or null | TikTok "original sound" |
Show the other 2 fields
| Field | Type | Always | Notes |
|---|---|---|---|
stats | SongStats | ||
extra | object or null |
Full field list in the reference for this endpoint and the data models. Errors are listed under Errors.
Questions
Which errors can it return?
invalid_params (do not retry), unsupported_url (do not retry), not_found (do not retry). Account and platform errors from the errors list can also happen. A failure always costs 0 credits.
Is there an SDK call for it?
The preview Python client has client.apple_music.track(...) and the TypeScript client client.appleMusic.track(). Both return the same envelope as the HTTP API. The packages are not published yet; plain HTTP works today in any language.
Can an AI agent call it?
Yes. The MCP server reaches every built endpoint, with the same prices.