> ## Documentation Index
> Fetch the complete documentation index at: https://www.anything.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Spotify

> Access music, playlists, and user data

Spotify API provides access to millions of songs, playlists, and user listening data.

<Warning>Spotify API requires a Spotify premium account</Warning>

## Overview

<CardGroup cols={2}>
  <Card title="Create Account" icon="user">
    Sign up for a Spotify Developer account
  </Card>

  <Card title="Get API Key" icon="key">
    Generate your Spotify API credentials
  </Card>

  <Card title="Copy into Anything" icon="plug">
    Add your API keys to Anything's secrets
  </Card>
</CardGroup>

## Account Creation

<Steps>
  <Step title="Visit Spotify Developer Portal">
    Go to [developer.spotify.com](https://developer.spotify.com/) and click "Dashboard"

    <img src="https://mintcdn.com/create/KG4vmDcLA3klmcBl/images/spotify/homepage.png?fit=max&auto=format&n=KG4vmDcLA3klmcBl&q=85&s=2ed7c65fddb8a9de2463f3fee086f5f9" style={{ borderRadius: '0.5rem' }} width="2702" height="1458" data-path="images/spotify/homepage.png" />
  </Step>

  <Step title="Sign up">
    * Log in with your Spotify account

    <img src="https://mintcdn.com/create/KG4vmDcLA3klmcBl/images/spotify/signup.png?fit=max&auto=format&n=KG4vmDcLA3klmcBl&q=85&s=f62cb7d25f092afd78a6a1d213d8c530" style={{ borderRadius: '0.5rem' }} width="1524" height="1416" data-path="images/spotify/signup.png" />
  </Step>

  <Step title="Create an App">
    * Click "Create App" in the dashboard

    <img src="https://mintcdn.com/create/KG4vmDcLA3klmcBl/images/spotify/dashboard.png?fit=max&auto=format&n=KG4vmDcLA3klmcBl&q=85&s=01a7ee4d718fa2be8ebac7bc47961d66" style={{ borderRadius: '0.5rem' }} width="2700" height="1080" data-path="images/spotify/dashboard.png" />
  </Step>

  <Step title="Add Details">
    * Fill in app name and description
    * The redirect uri will be your create project live site url + /api/callback

    <img src="https://mintcdn.com/create/KG4vmDcLA3klmcBl/images/spotify/createapp.png?fit=max&auto=format&n=KG4vmDcLA3klmcBl&q=85&s=1dd2874186cb1d5c7c90bf8eeceaaa1d" style={{ borderRadius: '0.5rem' }} width="1478" height="1140" data-path="images/spotify/createapp.png" />
  </Step>
</Steps>

## Generate API Keys

<Steps>
  <Step title="Access Credentials">
    1. Go to your app settings
    2. Find your Client ID and Client Secret

    <img src="https://mintcdn.com/create/KG4vmDcLA3klmcBl/images/spotify/apigen.png?fit=max&auto=format&n=KG4vmDcLA3klmcBl&q=85&s=b711808803ab3165cff954c6ef2f26fc" style={{ borderRadius: '0.5rem' }} width="2698" height="1066" data-path="images/spotify/apigen.png" />

    <Warning>
      Keep your Client Secret secure and never share it
    </Warning>
  </Step>

  <Step title="Configure OAuth">
    <Warning> This step is only relevant if you use the Spotify User Info </Warning>

    1. Be sure your project is published
    2. Ensure there is a callback path in your page and functions setting

    <img src="https://mintcdn.com/create/KG4vmDcLA3klmcBl/images/spotify/settings.png?fit=max&auto=format&n=KG4vmDcLA3klmcBl&q=85&s=f5075dfd063450abb72d44f7a3aa0756" style={{ borderRadius: '0.5rem' }} width="742" height="850" data-path="images/spotify/settings.png" />
  </Step>
</Steps>

## Add to Anything project

<Steps>
  <Step title="Add the integration">
    1. In your Anything project, type `/` in the chat
    2. Select "Spotify" from the menu
  </Step>

  <Step title="Add your API keys">
    1. Paste your Client ID into the "SPOTIFY\_CLIENT\_ID" field
    2. Paste your Client Secret into the "SPOTIFY\_CLIENT\_SECRET" field

    <Tip>
      Need new credentials? Generate them in your Spotify Developer dashboard.
    </Tip>
  </Step>

  <Step title="Start using">
    You can now use prompts with the integration to access music data.

    Example prompts:

    * `Get user's playlists using /Spotify`
    * `Search for songs with /Spotify`
    * `Create a music player using /Spotify`

    <Warning>
      The API limits how often your app can fetch data. If your app loads the same data often, ask the agent to save it locally so it doesn't re-fetch every time.
    </Warning>

    Example prompt for optimization:

    ```
    When using /Spotify, save the track data so my app doesn't have to fetch it again
    ```
  </Step>
</Steps>

<Tip>
  Your Spotify integration is ready! Use `/Spotify` in chat to access music data.
</Tip>
