Skip to main content

Anchor Connector for Podcast Data

Project description

Anchor Connector

Docs

OpenPodcast Banner

This is a simple library for connecting to the unofficial Spotify for Creators (formerly Anchor) API. It can be used to export analytics data from your podcast dashboard at https://podcasters.spotify.com.

API Notes

The API is undocumented, unofficial, and subject to change at any time. This library reverse-engineers the requests made by the Spotify for Creators web dashboard.

Base URL

As of early 2026, the active base URL is:

https://podcasters.spotify.com/pod/api/proxy/v3

Previous base URLs that are now defunct:

URL Status
https://api-v5.anchor.fm/v3 ❌ Dead (returns 401 for all requests)
https://creators.spotify.com/pod/api/proxy/v3 ✅ Still works as an alias

Station and Episode IDs

The API previously used string-prefixed identifiers in URL path segments:

  • webStationId:<hex-id> for station-level endpoints
  • webEpisodeId:<alphanumeric-id> for episode-level endpoints

These are now replaced by plain numeric IDs throughout all analytics endpoints. The webStationId you have from your credentials is still useful as a bootstrap — the episodePage endpoint still accepts it and returns the numeric stationId in its response. This library handles the conversion automatically: you only need to supply your webStationId and the numeric ID is resolved and cached on the first API call.

Episode responses now also include spotifyEpisodeUri (e.g. spotify:episode:4pvCXSIxpZLPaLlJ4KWiBa) and spotifyShowUri fields, but the analytics endpoints use the plain numeric episodeId.

GraphQL

The library previously used a GraphQL endpoint (https://creators-graph.spotify.com/v2/graph-pq) to fetch the full episode list. This endpoint is no longer available (returns 401). The same data is now fetched via the REST episodePage endpoint, which is paginated and returns all fields needed (including episodeId, spotifyEpisodeUri, title, etc.). The base_graphql_url parameter and ANCHOR_BASE_GRAPHQL_URL environment variable have been removed from the connector accordingly.

Supported Endpoints

Station-level

  • podcast_episode — full episode list (wraps episodes)
  • episodes — paginated episode iterator
  • total_plays
  • total_plays_by_episode
  • unique_listeners
  • audience_size
  • plays
  • plays_by_age_range
  • plays_by_app
  • plays_by_device
  • plays_by_episode
  • plays_by_gender
  • plays_by_geo
  • plays_by_geo_city
  • impressions

Episode-level

All episode-level endpoints take a numeric episodeId (available as episode["episodeId"] from episodes()).

  • episode_plays
  • episode_performance
  • episode_aggregated_performance
  • episode_metadata (overview endpoint)

See __main__.py for a full working example of every endpoint.

Credentials

Before you can use the library, you must extract your Anchor/Spotify for Creators credentials from the dashboard; they are not exposed through your account settings.

You can use our web-extension to capture them automatically, or take a look at the code to see how to do it manually.

Credential Where to find it
ANCHOR_BASE_URL Use https://podcasters.spotify.com/pod/api/proxy/v3
ANCHOR_WEBSTATION_ID The short hex ID in your podcast URL, e.g. fb37d7a4
ANCHOR_PW_S Value of the anchorpw_s cookie on podcasters.spotify.com

The anchorpw_s cookie expires periodically — if you start getting 401 errors, you need to grab a fresh value from your browser's DevTools (Application → Cookies → podcasters.spotify.com).

Installation

pip install anchorconnector

Usage

from anchorconnector import AnchorConnector
from datetime import datetime, timedelta

connector = AnchorConnector(
    base_url="https://podcasters.spotify.com/pod/api/proxy/v3",
    webstation_id=WEBSTATION_ID,
    anchorpw_s=ANCHOR_PW_S,
)

end = datetime.now()
start = end - timedelta(days=30)

# Station-level analytics
total_plays = connector.total_plays()
plays_by_geo = connector.plays_by_geo()
plays = connector.plays(start, end)
plays_by_age_range = connector.plays_by_age_range(start, end)
plays_by_app = connector.plays_by_app(start, end)
plays_by_device = connector.plays_by_device(start, end)
plays_by_episode = connector.plays_by_episode(start, end)
plays_by_gender = connector.plays_by_gender(start, end)

# Iterate over all episodes and fetch per-episode analytics
for episode in connector.episodes():
    episode_id = episode["episodeId"]  # numeric ID, required by analytics endpoints

    print(episode["title"])
    print(episode["spotifyEpisodeUri"])  # e.g. "spotify:episode:4pvCX..."

    plays        = connector.episode_plays(episode_id, start, end)
    performance  = connector.episode_performance(episode_id)
    aggregated   = connector.episode_aggregated_performance(episode_id)
    metadata     = connector.episode_metadata(episode_id)

Development

We use Pipenv for virtualenv and dev dependency management. With Pipenv installed:

  1. Install your locally checked out code in development mode, including its dependencies, and all dev dependencies into a virtual environment:
pipenv sync --dev
  1. Create an environment file and fill in the required values:
cp .env.sample .env
  1. Run the script in the virtual environment, which will automatically load your .env:
pipenv run anchorconnector

To add a new dependency for use during the development of this library:

pipenv install --dev $package

To add a new dependency necessary for the correct operation of this library, add the package to the install_requires section of ./setup.py, then:

pipenv install

To publish the package:

make publish

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anchorconnector-0.6.3.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anchorconnector-0.6.3-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file anchorconnector-0.6.3.tar.gz.

File metadata

  • Download URL: anchorconnector-0.6.3.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for anchorconnector-0.6.3.tar.gz
Algorithm Hash digest
SHA256 0744a5c433ddf8b826ebe06d84dab567a9749ac5e5d611c2ef7db302097a8cd0
MD5 414225856afa71c332a871a12388305e
BLAKE2b-256 a21fde4943eb9ab17fedc44a4fc59e7275b2faa9aa8d964c782b7d169043a22a

See more details on using hashes here.

File details

Details for the file anchorconnector-0.6.3-py3-none-any.whl.

File metadata

File hashes

Hashes for anchorconnector-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3bfab9c966f117148fceeba92b0d2798ef41eec315d57c5d85da708880f299a6
MD5 65f4af1ec5e24a356f1097ee955cefc1
BLAKE2b-256 815986cc41ff64d1b1b283607f243466c05c899d9cf679c0558d2f80989e8c23

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page