# Spotify Public Catalog & Metadata Scraper (`datascraperes/spotify-public-catalog-scraper`) Actor

Extract public Spotify tracks, artists, albums, playlists, shows and episodes from URLs or URIs. Get structured metadata, artwork, preview links and public source objects, with separate collection-item records and clear coverage limits. No Spotify login or API key required.

- **URL**: https://apify.com/datascraperes/spotify-public-catalog-scraper.md
- **Developed by:** [DataScraperES](https://apify.com/datascraperes) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.75 / 1,000 spotify catalog results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

Extract structured metadata from public Spotify tracks, artists, albums, playlists, shows, and episodes. **You receive stable normalized records, explicit completeness signals, and the complete public source object by default**, so downstream workflows can use reliable columns without losing fields Spotify adds or changes.

### What this Actor does

The Actor accepts public Spotify URLs, Spotify URIs, and `type:id` values, then reads the public embed and oEmbed surfaces. It produces one `entity` Dataset record for every successful source, optional `item` records for visible collection rows, and structured `error` records when a source cannot be completed.

The normalized output includes identity, titles, dates, durations, availability, explicit-content and media flags, artists, authors, ratings, preview references, artwork with dimensions, visual identity colors, playlist attributes, oEmbed presentation data, collection counts, stable record keys, payload hashes, raw field paths, and explicit completeness/resolution reasons. Every run returns the most complete supported output, including presentation metadata and the public source objects in `rawEntity` and `rawItem`.

### Use cases

- Build a structured catalog from Spotify links stored in a spreadsheet or content database.
- Export visible artist, album, or playlist track rows with positions, previews, ratings, and parent identity.
- Enrich music and podcast references with IDs, artwork, playability, release dates, and presentation metadata.
- Keep a forward-compatible source snapshot for monitoring changes in Spotify's public catalog pages.

### How to use

1. Open the Actor in Apify Console.
2. Add one or more public Spotify URLs, Spotify URIs, or `type:id` values to `sources`.
3. Select whether to include collection items and set their limit. Complete output is automatic.
4. Click **Start** and open the Dataset when the run finishes.

### Input

The smallest useful request is a single public track URL. The complete contract below contains every public input property. The representative output uses the same source, collection setting, and item limit; presentation data, source objects, error reporting, and continued processing use their automatic defaults.

```json
{
  "sources": [
    "https://open.spotify.com/track/11dFghVXANMlKmJXsNCbNl"
  ],
  "includeItems": true,
  "maxItemsPerSource": 3
}
```

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `sources` | array of strings | required | One to 100 public Spotify URLs, Spotify URIs, or `type:id` values for tracks, artists, albums, playlists, shows, or episodes. Equivalent references are deduplicated before collection. |
| `includeItems` | boolean | `true` | Adds one `item` record for each visible collection row. |
| `maxItemsPerSource` | integer, from one to five hundred | `100` | Maximum item records emitted for one collection source. The Actor does not invent rows beyond the public embed window. |

### Output

Results are written to the default Dataset. The default key-value store also contains `SUMMARY`, and contains `ERRORS` when one or more sources could not be completed. Successful Dataset rows remain available when another source fails, while the final run status makes the incomplete collection visible to automation.

Each row has a `recordType` of `entity`, `item`, or `error`:

| Group | Fields |
| --- | --- |
| Identity and lineage | `schemaVersion`, `outputMode`, `recordKey`, `itemKey`, `sourceIndex`, `sourceStatus`, `sourceUrl`, `inputSource`, `requestedEntityType`, `requestedEntityUri`, `resolvedEntityUri`, `resolutionReason`, `entityType`, `entityId`, `entityUri`, `name`, `title`, `subtitle`, `relatedEntityUri` |
| Availability | `isPlayable`, `playabilityReason`, `isExplicit`, `isNineteenPlus`, `hasVideo`, `isMusicVideo`, `isPreRelease`, `isAudiobook`, `isTrailer`, `format` |
| Media and presentation | `audioPreview`, `videoPreview`, `videoThumbnailImage`, `imageUrls`, `images`, `coverArt`, `relatedEntityCoverArt`, `visualIdentity`, `oembed` |
| Relationships and ratings | `artists`, `authors`, `contentRatings`, `contentRatingLabels`, `attributes` |
| Collection accounting | `itemsVisible`, `itemsAvailable`, `itemsReturned`, `itemsEmitted`, `itemsOmitted`, `itemLimit`, `itemCount`, `isPartial`, `partialReason`, `completenessStatus` |
| Forward compatibility | `rawFieldPresence`, `rawFieldPaths`, `payloadHash`, `rawEntity` for entity rows, and `rawItem` for item rows |
| Item context | `parentEntityType`, `parentEntityId`, `parentEntityUri`, `position`, `itemUid`, and the `item*` aliases |
| Failed sources | `errorCode`, `errorMessage`, `errorStatusCode`, `errorRetryable`, plus the requested source identity |

`itemsAvailable` and `itemsReturned` describe rows present in the source payload. `itemsEmitted` describes Dataset item rows after `includeItems` and `maxItemsPerSource` are applied. `itemsOmitted` is the difference. `itemCount` remains available as a compatibility alias for the source-payload count.

`recordKey` is stable for the same source and item identity, and `payloadHash` is a deterministic fingerprint of the public source object. `rawFieldPaths` lists nested paths observed in that object even when raw payload storage is disabled. `sourceStatus` distinguishes successful, partial, and failed sources; `completenessStatus` explains whether a record is complete, bounded by the public window, capped by input, resolved to a featured episode, unknown, or failed. Failed sources produce error rows accompanied by the detailed `ERRORS` record.

This is the complete entity item from the successful single-track run above:

```json
{
  "recordType": "entity",
  "schemaVersion": 2,
  "outputMode": "full",
  "recordKey": "track:11dFghVXANMlKmJXsNCbNl:entity",
  "itemKey": null,
  "sourceUrl": "https://open.spotify.com/track/11dFghVXANMlKmJXsNCbNl",
  "inputSource": "https://open.spotify.com/track/11dFghVXANMlKmJXsNCbNl",
  "sourceSurface": "spotify_embed",
  "sourceIndex": 1,
  "sourceStatus": "success",
  "retrievedAt": "2026-09-26T10:31:18.45247Z",
  "requestedEntityType": "track",
  "requestedEntityUri": "spotify:track:11dFghVXANMlKmJXsNCbNl",
  "resolvedEntityUri": "spotify:track:11dFghVXANMlKmJXsNCbNl",
  "resolutionReason": null,
  "entityType": "track",
  "entityId": "11dFghVXANMlKmJXsNCbNl",
  "entityUri": "spotify:track:11dFghVXANMlKmJXsNCbNl",
  "name": "Cut To The Feeling",
  "title": "Cut To The Feeling",
  "subtitle": null,
  "releaseDate": "2017-05-26T00:00:00Z",
  "durationMs": 207959,
  "isPlayable": true,
  "playabilityReason": "PLAYABLE",
  "isExplicit": false,
  "isNineteenPlus": false,
  "hasVideo": false,
  "isMusicVideo": false,
  "isPreRelease": null,
  "isAudiobook": null,
  "isTrailer": null,
  "format": null,
  "relatedEntityUri": "spotify:artist:6sFIWsNpZYqfjUpaCgueju",
  "artists": [
    {
      "name": "Carly Rae Jepsen",
      "uri": "spotify:artist:6sFIWsNpZYqfjUpaCgueju",
      "id": "6sFIWsNpZYqfjUpaCgueju"
    }
  ],
  "authors": null,
  "contentRatings": {
    "labels": []
  },
  "contentRatingLabels": [],
  "audioPreview": {
    "url": "https://p.scdn.co/mp3-preview/c011f4a360ae0ec93b366b5f328a17b2c5ae118d"
  },
  "videoPreview": null,
  "videoThumbnailImage": [],
  "imageUrls": [
    "https://image-cdn-fa.spotifycdn.com/image/ab67616d00001e027359994525d219f64872d3b1",
    "https://image-cdn-fa.spotifycdn.com/image/ab67616d000048517359994525d219f64872d3b1",
    "https://image-cdn-fa.spotifycdn.com/image/ab67616d0000b2737359994525d219f64872d3b1"
  ],
  "images": [
    {
      "url": "https://image-cdn-fa.spotifycdn.com/image/ab67616d00001e027359994525d219f64872d3b1",
      "width": 300,
      "height": 300,
      "role": "visualIdentity"
    },
    {
      "url": "https://image-cdn-fa.spotifycdn.com/image/ab67616d000048517359994525d219f64872d3b1",
      "width": 64,
      "height": 64,
      "role": "visualIdentity"
    },
    {
      "url": "https://image-cdn-fa.spotifycdn.com/image/ab67616d0000b2737359994525d219f64872d3b1",
      "width": 640,
      "height": 640,
      "role": "visualIdentity"
    }
  ],
  "coverArt": [],
  "relatedEntityCoverArt": [],
  "visualIdentity": {
    "backgroundBase": {
      "alpha": 255,
      "blue": 99,
      "green": 91,
      "red": 0
    },
    "backgroundTintedBase": {
      "alpha": 255,
      "blue": 63,
      "green": 56,
      "red": 0
    },
    "textBase": {
      "alpha": 255,
      "blue": 255,
      "green": 255,
      "red": 255
    },
    "textBrightAccent": {
      "alpha": 255,
      "blue": 255,
      "green": 255,
      "red": 255
    },
    "textSubdued": {
      "alpha": 255,
      "blue": 226,
      "green": 218,
      "red": 138
    },
    "image": [
      {
        "url": "https://image-cdn-fa.spotifycdn.com/image/ab67616d00001e027359994525d219f64872d3b1",
        "width": 300,
        "height": 300
      },
      {
        "url": "https://image-cdn-fa.spotifycdn.com/image/ab67616d000048517359994525d219f64872d3b1",
        "width": 64,
        "height": 64
      },
      {
        "url": "https://image-cdn-fa.spotifycdn.com/image/ab67616d0000b2737359994525d219f64872d3b1",
        "width": 640,
        "height": 640
      }
    ]
  },
  "attributes": [],
  "oembed": {
    "html": "<iframe style=\"border-radius: 12px\" width=\"100%\" height=\"152\" title=\"Spotify Embed: Cut To The Feeling\" frameborder=\"0\" allowfullscreen allow=\"autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture\" loading=\"lazy\" src=\"https://open.spotify.com/embed/track/11dFghVXANMlKmJXsNCbNl?utm_source=oembed\"></iframe>",
    "iframe_url": "https://open.spotify.com/embed/track/11dFghVXANMlKmJXsNCbNl?utm_source=oembed",
    "width": 456,
    "height": 152,
    "version": "1.0",
    "provider_name": "Spotify",
    "provider_url": "https://spotify.com",
    "type": "rich",
    "title": "Cut To The Feeling",
    "thumbnail_url": "https://image-cdn-fa.spotifycdn.com/image/ab67616d00001e027359994525d219f64872d3b1",
    "thumbnail_width": 300,
    "thumbnail_height": 300
  },
  "rawFieldPresence": [
    "artists",
    "audioPreview",
    "contentRatings",
    "duration",
    "hasVideo",
    "id",
    "isExplicit",
    "isMusicVideo",
    "isNineteenPlus",
    "isPlayable",
    "name",
    "playabilityReason",
    "relatedEntityUri",
    "releaseDate",
    "title",
    "type",
    "uri",
    "videoPreview",
    "videoThumbnailImage",
    "visualIdentity"
  ],
  "rawFieldPaths": [
    "artists",
    "artists[]",
    "artists[].name",
    "artists[].uri",
    "audioPreview",
    "audioPreview.url",
    "contentRatings",
    "contentRatings.labels",
    "contentRatings.labels[]",
    "duration",
    "hasVideo",
    "id",
    "isExplicit",
    "isMusicVideo",
    "isNineteenPlus",
    "isPlayable",
    "name",
    "playabilityReason",
    "relatedEntityUri",
    "releaseDate",
    "releaseDate.isoString",
    "title",
    "type",
    "uri",
    "videoPreview",
    "videoThumbnailImage",
    "visualIdentity",
    "visualIdentity.backgroundBase",
    "visualIdentity.backgroundBase.alpha",
    "visualIdentity.backgroundBase.blue",
    "visualIdentity.backgroundBase.green",
    "visualIdentity.backgroundBase.red",
    "visualIdentity.backgroundTintedBase",
    "visualIdentity.backgroundTintedBase.alpha",
    "visualIdentity.backgroundTintedBase.blue",
    "visualIdentity.backgroundTintedBase.green",
    "visualIdentity.backgroundTintedBase.red",
    "visualIdentity.image",
    "visualIdentity.image[]",
    "visualIdentity.image[].maxHeight",
    "visualIdentity.image[].maxWidth",
    "visualIdentity.image[].url",
    "visualIdentity.textBase",
    "visualIdentity.textBase.alpha",
    "visualIdentity.textBase.blue",
    "visualIdentity.textBase.green",
    "visualIdentity.textBase.red",
    "visualIdentity.textBrightAccent",
    "visualIdentity.textBrightAccent.alpha",
    "visualIdentity.textBrightAccent.blue",
    "visualIdentity.textBrightAccent.green",
    "visualIdentity.textBrightAccent.red",
    "visualIdentity.textSubdued",
    "visualIdentity.textSubdued.alpha",
    "visualIdentity.textSubdued.blue",
    "visualIdentity.textSubdued.green",
    "visualIdentity.textSubdued.red"
  ],
  "payloadHash": "c5af8c0d8f9a26a0f2e85512147f793bf95ec0fd0755bb5c3d02c35d02689910",
  "rawEntity": {
    "type": "track",
    "name": "Cut To The Feeling",
    "uri": "spotify:track:11dFghVXANMlKmJXsNCbNl",
    "id": "11dFghVXANMlKmJXsNCbNl",
    "title": "Cut To The Feeling",
    "artists": [
      {
        "name": "Carly Rae Jepsen",
        "uri": "spotify:artist:6sFIWsNpZYqfjUpaCgueju"
      }
    ],
    "releaseDate": {
      "isoString": "2017-05-26T00:00:00Z"
    },
    "duration": 207959,
    "isPlayable": true,
    "playabilityReason": "PLAYABLE",
    "isExplicit": false,
    "isNineteenPlus": false,
    "contentRatings": {
      "labels": []
    },
    "audioPreview": {
      "url": "https://p.scdn.co/mp3-preview/c011f4a360ae0ec93b366b5f328a17b2c5ae118d"
    },
    "isMusicVideo": false,
    "hasVideo": false,
    "videoPreview": null,
    "videoThumbnailImage": null,
    "relatedEntityUri": "spotify:artist:6sFIWsNpZYqfjUpaCgueju",
    "visualIdentity": {
      "backgroundBase": {
        "alpha": 255,
        "blue": 99,
        "green": 91,
        "red": 0
      },
      "backgroundTintedBase": {
        "alpha": 255,
        "blue": 63,
        "green": 56,
        "red": 0
      },
      "textBase": {
        "alpha": 255,
        "blue": 255,
        "green": 255,
        "red": 255
      },
      "textBrightAccent": {
        "alpha": 255,
        "blue": 255,
        "green": 255,
        "red": 255
      },
      "textSubdued": {
        "alpha": 255,
        "blue": 226,
        "green": 218,
        "red": 138
      },
      "image": [
        {
          "url": "https://image-cdn-fa.spotifycdn.com/image/ab67616d00001e027359994525d219f64872d3b1",
          "maxHeight": 300,
          "maxWidth": 300
        },
        {
          "url": "https://image-cdn-fa.spotifycdn.com/image/ab67616d000048517359994525d219f64872d3b1",
          "maxHeight": 64,
          "maxWidth": 64
        },
        {
          "url": "https://image-cdn-fa.spotifycdn.com/image/ab67616d0000b2737359994525d219f64872d3b1",
          "maxHeight": 640,
          "maxWidth": 640
        }
      ]
    }
  },
  "itemsVisible": 0,
  "itemsAvailable": 0,
  "itemsReturned": 0,
  "itemCount": 0,
  "itemsEmitted": 0,
  "itemsOmitted": 0,
  "itemLimit": 3,
  "isPartial": false,
  "partialReason": null,
  "completenessStatus": "complete",
  "errorCode": null,
  "errorMessage": null,
  "errorStatusCode": null,
  "errorRetryable": null
}
```

Collection item rows repeat the common normalized fields and add the parent identity, observed position, item UID, item-level media and rating fields, and `rawItem`. A collection can be marked partial because the public surface exposes a bounded window, the configured cap omitted rows, or a show URL resolved to a featured episode rather than a full show listing.

### Pricing

This Actor uses pay-per-event pricing. You are charged for each result successfully delivered to the default Dataset. The price is calculated per Dataset item; the per-1,000 figures below are equivalent examples, not a 1,000-item minimum. A run that produces no Dataset results does not create a result charge. Apify platform and storage usage charges may also apply, while reading the Dataset or the `SUMMARY` and `ERRORS` records does not create another result charge.

| Apify plan | Price per result (USD) | Equivalent per 1,000 results |
|---|---:|---:|
| FREE | $0.001 | $1.00 |
| BRONZE | $0.0009 | $0.90 |
| SILVER | $0.0008 | $0.80 |
| GOLD | $0.00075 | $0.75 |
| PLATINUM | $0.00075 | $0.75 |
| DIAMOND | $0.00075 | $0.75 |

The active Apify pricing configuration determines the plan-specific rate. A delivered result is one item in the default Dataset: an `entity`, `item`, or structured `error` record written for a source that could not be completed. The `SUMMARY` and `ERRORS` key-value records are diagnostics, not Dataset results, and do not create separate charges.

### Related Actors

| Actor | Best for |
|---|---|
| [YouTube Channel Videos Scraper | Shorts & Streams](https://apify.com/datascraperes/youtube-channel-scraper) | Build a comparable public video catalogue from known YouTube channels, including positions, thumbnails, URLs, and available public metrics. |
| [YouTube Keyword Video Search Results Scraper](https://apify.com/datascraperes/youtube-keyword-search-scraper) | Discover public music or podcast-related video results by keyword before enriching selected URLs elsewhere. |
| [Twitch VOD & Clip Metadata Extractor](https://apify.com/datascraperes/twitch-video-metadata) | Add metadata-only records for known public Twitch VODs and clips in a broader media catalogue. |

### Limits and data quality

If saved records cannot be verified during recovery, the summary leaves their counts unknown instead of reporting zero.

When the spending limit is reached, `SUMMARY.status` is `limited` and `limitReason` is `spending_limit`. Delivered results remain available. The Actor can stop below the spending ceiling, so inspect the summary before treating a collection as complete.

- The Actor reads public Spotify embed and oEmbed surfaces. It does not require a Spotify account or a user API key.
- Every run includes the complete supported metadata, presentation information, and public source objects. Output records identify this detail level as `outputMode: "full"`.
- Artist, album, and playlist pages can expose a bounded collection window rather than a confirmed complete catalogue. The Dataset reports this with `isPartial`, `partialReason`, and the item counters.
- `maxItemsPerSource` limits emitted item rows; it does not request rows that are not visible in the public source surface.
- A show URL can resolve to a featured episode. That episode remains useful metadata, but it is not presented as a complete show catalogue.
- Source fields are nullable when Spotify does not expose them. `rawFieldPresence` and `rawFieldPaths` show which fields were present, and `payloadHash` helps compare the same source across runs.
- Preview and artwork links are references supplied by Spotify and can change or expire. The Actor returns metadata and references; it does not download or redistribute audio, video, or image files.
- The public source can change between runs. If a source cannot be completed, successful rows remain in the Dataset, an `error` row records the failed source, and the run status plus `ERRORS` record identify the incomplete collection.

### Frequently asked questions

#### Which input forms are accepted?

Use `https://open.spotify.com/{type}/{id}` links, Spotify URIs such as `spotify:track:{id}`, or `type:id` values. The supported types are `track`, `artist`, `album`, `playlist`, `show`, and `episode`.

#### Does it return complete playlists or artist catalogues?

It returns every row exposed by the public embed up to `maxItemsPerSource`. Spotify may expose only a bounded window, so collection records keep `isPartial` and explicit counters instead of claiming a complete total.

#### What is included in the raw payload?

`rawEntity` is the complete public entity object used to build an entity row. `rawItem` is the complete public collection object used to build an item row. Both are included automatically.

#### Does it download previews or media?

No. When Spotify exposes preview metadata, the Actor returns the public reference in `audioPreview` or `videoPreview`; it does not download, transform, or store media files.

#### What happens if one source fails?

The Actor automatically attempts the remaining sources, keeps successful Dataset rows, writes an `error` row and `ERRORS` for persistent failures, and finishes with a failed run status so incomplete results are not mistaken for a complete collection.

The Actor makes additional attempts when a temporary source failure occurs. A source that becomes available during those attempts produces its normal records. Persistent source failures remain visible in the final run status and error records. A successful run covers the public data available within the selected input limits; collection completeness is still described by `isPartial` and `completenessStatus`.

When restarting with the same input and retained storage, the Actor checks already delivered records and preserves them. A restart can recover records whose earlier delivery was interrupted. If delivery remains uncertain or the stored data is incompatible, the run stays incomplete rather than duplicating records or claiming success. Use a fresh run to change the input or collect a new catalog snapshot.

If saving results cannot be confirmed, the run fails and the affected records are retained in `PENDING_DATASET` when storage is available. Compare those records with the Dataset using `recordKey` before importing them. `SUMMARY` reports sources left unprocessed and records whose delivery could not be confirmed. If requested oEmbed metadata remains unavailable, the run reports failure and the summary counts the missing enrichment, while valid catalog records remain available.

### Responsible use

Use this Actor only with public Spotify catalog pages and for purposes you are entitled to pursue. You are responsible for complying with Spotify's terms, applicable copyright and privacy requirements, and local law. Public visibility does not itself grant permission to republish media or personal information.

### Support

For an unexpected result, open an issue in the Actor's **Issues** tab with a small reproducible public input, the affected entity type, and the run ID. Do not include credentials, cookies, or private access data.

Public integration examples: [Spotify catalog integration examples on GitHub](https://github.com/datacrawler-edu/spotify-public-catalog-scraper-python).

# Actor input Schema

## `sources` (type: `array`):

Public track, artist, album, playlist, show, or episode URLs, Spotify URIs, or type:ID values. Duplicate sources are removed before requests.

## `includeItems` (type: `boolean`):

Return separate results for the tracks or episodes visible in public artist, album, playlist, and show pages.

## `maxItemsPerSource` (type: `integer`):

Limit the number of visible tracks or episodes returned for each collection. Spotify may expose fewer items than the selected limit.

## Actor input object example

```json
{
  "sources": [
    "https://open.spotify.com/track/11dFghVXANMlKmJXsNCbNl",
    "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M"
  ],
  "includeItems": true,
  "maxItemsPerSource": 100
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `errors` (type: `string`):

No description

## `pendingDataset` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "sources": [
        "https://open.spotify.com/track/11dFghVXANMlKmJXsNCbNl",
        "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M"
    ],
    "includeItems": true,
    "maxItemsPerSource": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("datascraperes/spotify-public-catalog-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "sources": [
        "https://open.spotify.com/track/11dFghVXANMlKmJXsNCbNl",
        "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M",
    ],
    "includeItems": True,
    "maxItemsPerSource": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("datascraperes/spotify-public-catalog-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "sources": [
    "https://open.spotify.com/track/11dFghVXANMlKmJXsNCbNl",
    "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M"
  ],
  "includeItems": true,
  "maxItemsPerSource": 100
}' |
apify call datascraperes/spotify-public-catalog-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datascraperes/spotify-public-catalog-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/TrghhIzYsKjFbwN7F/builds/onuRqatXB7edY0565/openapi.json
