# Spotify 单曲详情 API (spotify.track)

- Canonical page: [https://everyinfra.com/spotify-api/track](https://everyinfra.com/spotify-api/track?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "spotify", "action": "track", "params": {...}}
- Price: $0.001389 per call ($1.39 per 1,000 requests); failed calls and empty results are not charged
- Returns: single object
- Mode: sync; add "mode": "async" for slow tasks

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=spotify&action=track

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | artist / track / album / playlist 使用对应的 open.spotify.com 链接，也支持在 url 中传 spotify:类型:ID 或裸 ID；目标种类由 action 决定，不要跨类型混用。旧 profile 仅直接接收完整链接，读取专辑/单曲播放资料，不是用户个人档案。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| name | 名称。用于账号/商品/商家类能力，指该对象本身的名字。 |
| artists | 参与艺人列表。 |
| album_name | 专辑名称。 |
| duration_ms | 时长，**单位毫秒**（不是秒，除以 1000 才是秒）。 |
| play_count | 播放次数。 |
| track_number | 该曲在专辑中的序号。 |
| disc_number | platform-native meaning |
| is_explicit | 是否含限制级内容。 |
| release_date | 发行日期。 |
| preview_url | 30 秒试听片段链接，可能为 null。 |
| image_url | 图片链接。多图能力可能返回 image_urls 数组。 |
| added_at | platform-native meaning |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |
| album_id | 专辑 ID。 |
| album_type | 专辑类型（album/single/compilation）。 |
| label | 唱片公司。 |
| content_rating | 内容分级。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "spotify",
  "action": "track",
  "params": {
    "url": "https://open.spotify.com/track/0BeoYJ8te2AtohPr7I3SZD"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "spotify",
        "action": "track",
        "params": {
            "url": "https://open.spotify.com/track/0BeoYJ8te2AtohPr7I3SZD",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-09-26T08:56:04Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "spotify",
  "action": "track",
  "results": {
    "id": "0BeoYJ8te2AtohPr7I3SZD",
    "url": "https://open.spotify.com/track/0BeoYJ8te2AtohPr7I3SZD",
    "name": "Almost Real",
    "artists": [
      "Anarekli"
    ],
    "album_name": "Almost Real",
    "duration_ms": 163926,
    "play_count": 6671478,
    "track_number": 1,
    "is_explicit": false,
    "release_date": "2026-04-10T00:00:00Z",
    "preview_url": "https://p.scdn.co/mp3-preview/d04815deef2e2f3d5f6daba6cd63ebe4081802f4",
    "image_url": "https://i.scdn.co/image/ab67616d0000b273eab6ddcdb5e835d8c962265d",
    "platform": "spotify",
    "album_id": "5nFzrSca3XC5kHbq2gyRiz",
    "album_type": "SINGLE",
    "content_rating": "NONE"
  },
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=spotify
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
