# Apple Music Search (`apple_music.search`)

Search songs, albums or artists in the Apple Music catalogue: names, release date, duration, genre, artwork and a 30-second preview URL.

- **Route:** `POST /v1/run/apple_music.search`
- **Price:** $0.00085 per request ($0.85 per 1,000) · `cost_usd` on every response
- **Source:** Apple iTunes Search API + App Store RSS (`apple`) · failover: no
- **Measured latency:** p50 57 ms · p95 57 ms · p99 57 ms (1 calls, 30d)
- **Heavy response:** no

## Input

| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| `query` | string | yes |  | Search words |
| `type` | string | no | "song" | What to search |
| `country` | string | no | "us" | Two-letter country code of the store |
| `limit` | integer | no | 25 | Results to return |

## Output (`output` in the run envelope)

| Field | Meaning |
|---|---|
| `results` | track, artist, album, genre, released_at, duration_ms, preview_url, artwork, url. |
| `count` | Results returned. |

## Example

```bash
curl -s -X POST https://getallapis.com/v1/run/apple_music.search \
  -H "Authorization: Bearer $GETALLAPIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"daft punk get lucky","type":"song","limit":5}'
```

```python
from getallapis_client import Client
client = Client()  # reads GETALLAPIS_API_KEY
result = client.run('apple_music.search', {'query': 'daft punk get lucky', 'type': 'song', 'limit': 5})
print(result['cost_usd'], result['output'])
```

```bash
getallapis run apple_music.search '{"query":"daft punk get lucky","type":"song","limit":5}'
```

Quote first (free, validates input): `POST /v1/quote/apple_music.search` with the same body.
