{
  "openapi": "3.0.1",
  "info": {
    "title": "Spotify Streaming Stats: Artist, Track, Playlist and Chart Data",
    "description": "Spotify streaming stats plus Apple Music, YouTube, TikTok, Shazam, Deezer and Beatport data for artists, tracks and labels: streams, followers, monthly listeners, playlists, charts, history, catalog and audience, through the Songstats API. Bring your own key.",
    "version": "0.1",
    "x-build-id": "2g8gGi7HjAA6E9XQn"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/nabeelbaghoor~spotify-streaming-stats-music-analytics/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-nabeelbaghoor-spotify-streaming-stats-music-analytics",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/nabeelbaghoor~spotify-streaming-stats-music-analytics/runs": {
      "post": {
        "operationId": "runs-sync-nabeelbaghoor-spotify-streaming-stats-music-analytics",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/nabeelbaghoor~spotify-streaming-stats-music-analytics/run-sync": {
      "post": {
        "operationId": "run-sync-nabeelbaghoor-spotify-streaming-stats-music-analytics",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "mode": {
            "title": "What to read",
            "enum": [
              "stats",
              "historicStats",
              "info",
              "search",
              "catalog",
              "topTracks",
              "topPlaylists",
              "audience",
              "activities",
              "sources",
              "definitions",
              "status"
            ],
            "type": "string",
            "description": "Each mode calls one documented read endpoint of the Songstats Enterprise API. Catalog, top tracks, top playlists and audience are documented for artists, labels and collaborators only.",
            "default": "stats"
          },
          "apiKey": {
            "title": "Songstats Enterprise API key",
            "type": "string",
            "description": "Your own Songstats Enterprise API key, issued by Songstats after it approves your use case (api@songstats.com). Sent in the apikey header, never in a URL. Leave empty to use the DATA_API_KEY secret."
          },
          "entityType": {
            "title": "Entity type",
            "enum": [
              "artist",
              "track",
              "label",
              "collaborator"
            ],
            "type": "string",
            "description": "Every mode except sources, definitions and status. Collaborators are the credited writers, producers and composers Songstats tracks through TIDAL credits.",
            "default": "artist"
          },
          "idType": {
            "title": "Identifier type",
            "enum": [
              "songstats",
              "spotify",
              "apple_music",
              "isrc",
              "beatport",
              "tidal"
            ],
            "type": "string",
            "description": "Every lookup mode. What the identifiers below are. Songstats, Spotify and Apple Music links, and bare ISRCs on track lookups, are recognised whatever is set here.",
            "default": "songstats"
          },
          "identifiers": {
            "title": "Identifiers or links",
            "type": "array",
            "description": "Every lookup mode. One identifier or link per line, such as a Songstats ID (pod5zlug), a Spotify artist link, an Apple Music ID or an ISRC (GBAYE2100626). Each identifier is one lookup.",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search names",
            "type": "array",
            "description": "Search. One artist, track, label or collaborator name per line. Each name returns the matching Songstats IDs to use in the other modes.",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "title": "Sources",
            "type": "array",
            "description": "Current and historic stats, activities, audience and top lists. Source ids such as spotify, apple_music, youtube, tiktok, deezer, amazon, shazam, beatport, tracklist, soundcloud, tidal or instagram (the supported sources mode lists them). Leave empty for all sources.",
            "items": {
              "type": "string"
            }
          },
          "startDate": {
            "title": "Start date",
            "type": "string",
            "description": "Historic stats. First day as YYYY-MM-DD. Songstats collects history for a resource from the day it was first added to its database; playlist and chart history goes further back."
          },
          "endDate": {
            "title": "End date",
            "type": "string",
            "description": "Historic stats. Last day as YYYY-MM-DD."
          },
          "withAggregates": {
            "title": "Include aggregates",
            "type": "boolean",
            "description": "Historic stats. Adds the data points Songstats aggregates, such as playlists_current, playlist_reach_current and charts_current, with playlist and chart breakdowns for tracks (with_aggregates).",
            "default": false
          },
          "trackDetails": {
            "title": "Track detail lists",
            "type": "array",
            "description": "Current stats of tracks: add these lists to each source row (with_links, with_playlists, with_charts, with_videos). Catalog: links adds each track's source links.",
            "items": {
              "type": "string",
              "enum": [
                "links",
                "playlists",
                "charts",
                "videos"
              ],
              "enumTitles": [
                "Source links",
                "Playlists the track is in",
                "Charts the track is in",
                "Videos using the track"
              ]
            }
          },
          "onlyCurrent": {
            "title": "Only current playlists and charts",
            "type": "boolean",
            "description": "Current stats of tracks. Only list the playlists and charts the track is in now (only_current).",
            "default": false
          },
          "sort": {
            "title": "Detail list order",
            "enum": [
              "greatest",
              "latest"
            ],
            "type": "string",
            "description": "Current stats of tracks. How the playlist, chart and video lists are ordered (sort).",
            "default": "greatest"
          },
          "metric": {
            "title": "Top tracks metric",
            "type": "string",
            "description": "Top tracks. The metric to rank by, such as playlists (the documented example), streams_total, playlist_reach_current, charts_total or shazams_total. The metric definitions mode lists every rank type.",
            "default": "playlists"
          },
          "scope": {
            "title": "Top list time scope",
            "type": "string",
            "description": "Top tracks and top playlists. The time scope of the ranking; total is the documented example.",
            "default": "total"
          },
          "onlyEditorial": {
            "title": "Editorial only",
            "type": "boolean",
            "description": "Top playlists: only editorial playlists (only_editorial). Activities: only editorial activities (editorial).",
            "default": false
          },
          "activityTier": {
            "title": "Activity tier",
            "minimum": 1,
            "maximum": 4,
            "type": "integer",
            "description": "Activities. Tier 4 returns every activity; tier 1 returns only the most significant ones (tier).",
            "default": 4
          },
          "recentOnly": {
            "title": "Recent tracks only",
            "type": "boolean",
            "description": "Activities of artists, labels and collaborators. Only activities for tracks released in the past 3 months (recent).",
            "default": false
          },
          "perLookupLimit": {
            "title": "Results per request",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "The limit sent with each request: the page size for search, catalog and activities (later pages are read with offset), the length of each top list, and of track detail lists.",
            "default": 20
          },
          "maxResults": {
            "title": "Maximum rows",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "The run stops after this many rows.",
            "default": 1000
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}