{
  "openapi": "3.0.1",
  "info": {
    "title": "Spotify Playlist Intelligence",
    "description": "Analyze public Spotify playlists — followers, track mix, artist concentration, playcount distribution, duplicates, duration stats. HTTP-only, cookieless, MCP-ready.",
    "version": "0.1",
    "x-build-id": "A0pooZZLhakHf78rX"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/khadinakbar~analyze-spotify-playlist/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-khadinakbar-analyze-spotify-playlist",
        "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/khadinakbar~analyze-spotify-playlist/runs": {
      "post": {
        "operationId": "runs-sync-khadinakbar-analyze-spotify-playlist",
        "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/khadinakbar~analyze-spotify-playlist/run-sync": {
      "post": {
        "operationId": "run-sync-khadinakbar-analyze-spotify-playlist",
        "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",
        "required": [
          "playlistUrls"
        ],
        "properties": {
          "playlistUrls": {
            "title": "Spotify playlist URLs, URIs, or IDs",
            "type": "array",
            "description": "Public Spotify playlists to analyze. Accepts full URLs (https://open.spotify.com/playlist/37i9dQZF1DX0XUsuxWHRQd), URIs (spotify:playlist:37i9dQZF1DX0XUsuxWHRQd), or bare 22-character playlist IDs. Artist, album, track, show, and episode URLs are rejected — use spotify-all-in-one-scraper for those. Duplicates are merged; maxPlaylists caps how many unique playlists are billed.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          "maxTracks": {
            "title": "Max tracks per playlist",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "How many playlist tracks to fetch and include in analytics (and optionally the tracklist). Partner API paginates in pages of 100. Higher values add run time but not extra PPE — billing is per playlist analyzed, not per track. Hard cap 1000.",
            "default": 100
          },
          "includeTracklist": {
            "title": "Include tracklist",
            "type": "boolean",
            "description": "When true (default), each report includes the sampled tracks array (name, artists, playcount, duration, explicit flag). Set false for compact agent rows with analytics only.",
            "default": true
          },
          "includeAnalytics": {
            "title": "Include derived analytics",
            "type": "boolean",
            "description": "When true (default), each report includes the analytics object: unique artists, HHI concentration, duplicate count, duration stats, playcount percentiles, release-year histogram, and editorial heuristic.",
            "default": true
          },
          "enrichArtistGenres": {
            "title": "Enrich top-artist genres",
            "type": "boolean",
            "description": "When true, fetches public genre tags for up to 8 top artists via the Partner API and attaches genreMix to analytics. Adds extra HTTP calls and run time. Default false. Ignored when the embed fallback is used (no playcount/genre path).",
            "default": false
          },
          "previousSnapshots": {
            "title": "Previous follower snapshots",
            "type": "array",
            "description": "Optional JSON array of earlier follower counts for delta calculation. Each item: { \"playlistId\": \"22-char-id\", \"followers\": number }. When a playlist ID matches, the report includes followersDelta = current followers minus the snapshot value.",
            "items": {
              "type": "object",
              "properties": {
                "playlistId": {
                  "type": "string",
                  "title": "Playlist ID",
                  "description": "22-character Spotify playlist ID matching a playlist in playlistUrls."
                },
                "followers": {
                  "type": "number",
                  "title": "Followers",
                  "description": "Earlier public follower count for that playlist."
                }
              },
              "required": [
                "playlistId",
                "followers"
              ]
            }
          },
          "maxPlaylists": {
            "title": "Max playlists per run",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Hard cap on unique playlists processed and billed (playlist-analyzed events) in one run. Default 50; prefill 5 keeps quality tests cheap.",
            "default": 50
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Proxy for all Spotify HTTP requests. Spotify blocks datacenter IPs at its edge, so Apify Residential is strongly recommended and enabled by default. Leave as-is unless you have a specific reason to change it.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}