# Spotify — Wrapped API

> **You are on:** `https://api.beta.paywithlocus.com/api` | [llms.txt](https://beta.paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Search millions of songs and artists in Spotify's catalog, then dive deep into any artist's complete discography, top tracks, fan statistics, and similar artists they're connected to. Perfect for discovering new music, researching artist backgrounds, or building personalized music recommendations.

**Category:** Music | **Website:** [spotify.com/](https://spotify.com/) | **Docs:** [parse.bot/marketplace/3b15ebb3-996f-488a-a861-671d27c8344b/spotify-com-api](https://parse.bot/marketplace/3b15ebb3-996f-488a-a861-671d27c8344b/spotify-com-api)

Pay-per-use API proxy for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.beta.paywithlocus.com/api/wrapped/credits/spotify/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## Endpoints

### Get artist

Retrieve comprehensive information about a Spotify artist by their ID. Returns biography, monthly listener count, follower count, world ranking, top tracks with play counts, discography (albums and singles), related artists, top listener cities, and external links.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `artist_id` | string | Yes | Spotify artist ID (alphanumeric, 22 characters, e.g. '06HL4z0CvFAxyc27GXpf02'). Obtainable from search results. |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/spotify/get-artist \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"artist_id":"<string>"}'
```

### Get artist releases

Retrieve upcoming and recent releases for a specific Spotify artist. Returns the artist's discography sorted by release date (newest first), each tagged with an `is_upcoming` boolean. When no upcoming releases exist, recent releases are returned. Falls back gracefully when filtering yields an empty set.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `artist_id` | string | Yes | Spotify artist ID (alphanumeric, 22 characters, e.g. '4dpARuHxo51G3z768sgnrY'). Obtainable from search results. |
| `limit` | integer | No | Maximum number of releases to return (1-50). |
| `only_upcoming` | boolean | No | When true, return only future releases (is_upcoming=true), excluding recent ones. |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/spotify/get-artist-releases \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"artist_id":"<string>","limit":"<integer>","only_upcoming":"<boolean>"}'
```

### Get upcoming releases

Discover upcoming and recent releases for a given record label or distributor. Searches Spotify's catalog using the label filter, identifies associated artists, and aggregates their upcoming or recently released music. Each release carries an `is_upcoming` boolean distinguishing true future releases from very recent ones. Falls back to the most recent releases when no upcoming ones exist.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `label_or_distributor` | string | Yes | Name of the record label or distributor (e.g. 'STMPD RCRDS', 'Interscope Records'). |
| `limit` | integer | No | Maximum number of releases to return (1-50). |
| `only_upcoming` | boolean | No | When true, return only future releases (is_upcoming=true), excluding recent ones. |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/spotify/get-upcoming-releases \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"label_or_distributor":"<string>","limit":"<integer>","only_upcoming":"<boolean>"}'
```

### Search

Full-text search across Spotify's music catalog. Returns tracks, artists, albums, playlists, and podcasts matching the query. Results can be filtered by content type and paginated via offset. Each result category returns up to `limit` items per request.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `limit` | integer | No | Maximum number of results per content type (1-50). |
| `offset` | integer | No | Offset for pagination within each content type. |
| `query` | string | Yes | Search query string (artist name, track title, album, etc.). |
| `type` | string | No | Filter results to a specific content type. Omitted or 'all' returns all types. |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/spotify/search \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"limit":"<integer>","offset":"<integer>","query":"<string>","type":"<string>"}'
```

## Next steps

- [All wrapped API providers](https://beta.paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://beta.paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://beta.paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://beta.paywithlocus.com/agent/index.md): every Locus agent page.