Spotify · Guide

How to run a Spotify search

TL;DR
To run a Spotify search, sign up for a free Captapi key, then send one GET request to /v1/spotify/search with your input. You get clean JSON back in seconds for 2 credits per call — no OAuth, scraping or platform SDKs. Search Spotify — canonical spotify: URIs, explicit, fetchedAt (flat 2 credits).

How to run a Spotify search (step by step)

  1. 1

    Get a free API key

    Create a free Captapi account (100 credits, no card) and generate an API key from the dashboard.

  2. 2

    Call the Spotify Search API

    Send an authenticated GET request to /v1/spotify/search with your input. No OAuth, no scraping setup.

  3. 3

    Read the JSON response

    Parse the clean JSON response. Pass cache=true for a free 24h cache hit; default is always fresh.

Code example

curl "https://api.captapi.com/v1/spotify/search?q=lofi%20beats" \
  -H "Authorization: Bearer capt_live_..."
# or: -H "x-api-key: capt_live_..."

What the response looks like

{
  "success": true,
  "data": {
    "platform": "spotify",
    "query": "lofi beats",
    "type": "tracks",
    "fetchedAt": "2026-08-07T10:56:53.985Z",
    "source": "pathfinder",
    "totalReturned": 5,
    "results": [
      {
        "platform": "spotify",
        "type": "track",
        "uri": "spotify:track:1xqpCUhTXEG3Zj7E6VEyj4",
        "url": "https://open.spotify.com/track/1xqpCUhTXEG3Zj7E6VEyj4",
        "name": "Lodi Dodi",
        "artists": [
          {
            "id": "7hJcb9fa4alzcOq3EaNPoG",
            "uri": "spotify:artist:7hJcb9fa4alzcOq3EaNPoG",
            "name": "Snoop Dogg",
            "url": "https://open.spotify.com/artist/7hJcb9fa4alzcOq3EaNPoG"
          }
        ],
        "album": {
          "id": "0iXJO2ZAfKzNDYa6E4EFfl",
          "uri": "spotify:album:0iXJO2ZAfKzNDYa6E4EFfl",
          "name": "Death Row Greatest Hits",
          "url": "https://open.spotify.com/album/0iXJO2ZAfKzNDYa6E4EFfl"
        },
        "durationMs": 264480,
        "durationFormatted": "4:24",
        "image": "https://i.scdn.co/image/ab67616d0000b2739322ff440b23b5717ddd8c9b",
        "id": "1xqpCUhTXEG3Zj7E6VEyj4",
        "contentRating": "EXPLICIT",
        "explicit": true
      },
      {
        "platform": "spotify",
        "type": "track",
        "uri": "spotify:track:5SFVfPQNHzrsVjO2YmOl7u",
        "url": "https://open.spotify.com/track/5SFVfPQNHzrsVjO2YmOl7u",
        "name": "Lofi Beats",
        "artists": [
          {
            "id": "0uXJZ5oJisbrkihiMUDiya",
            "uri": "spotify:artist:0uXJZ5oJisbrkihiMUDiya",
            "name": "Productivity Booster Music",
            "url": "https://open.spotify.com/artist/0uXJZ5oJisbrkihiMUDiya"
          }
        ],
        "album": {
          "id": "7D6QtZp3B4UAjd9J8hzjS2",
          "uri": "spotify:album:7D6QtZp3B4UAjd9J8hzjS2",
          "name": "All-Day Flow: Lo-Fi Beats for Creative Work",
          "url": "https://open.spotify.com/album/7D6QtZp3B4UAjd9J8hzjS2"
        },
        "durationMs": 158000,
        "durationFormatted": "2:38",
        "image": "https://i.scdn.co/image/ab67616d0000b27356f94cadfab4bf5902a8f30c",
        "id": "5SFVfPQNHzrsVjO2YmOl7u",
        "contentRating": "NONE",
        "explicit": false
      }
    ]
  }
}

Billing metadata (credits charged, cache hit/miss) is returned in the X-Captapi-Credits and X-Captapi-Cache response headers.

Request parameters

NameTypeRequiredDescription
qstring YesSearch term (min 2 chars).
typestringNoResult kind: tracks (default), albums, artists, podcasts, or episodes.
limitintegerNoMax items to return (default 20, max 50). Flat 2 credits per call.
rawbooleanNoInclude per-result upstream payload as results[].raw. Default false. Pathfinder GraphQL vs Apify scraper shapes differ — see FAQ.
cachebooleanNoSet true to serve from the 24h response cache (0 credits on hit). Default false — always fetch fresh. Envelope includes cached + cachedAt on hits.

Frequently asked questions

What does the Spotify Search API do?

The Spotify Search API lets you search and return matching results from a public Spotify query using one GET request to /v1/spotify/search. It returns clean JSON — no OAuth or infrastructure setup required.

How many credits does the Spotify Search API cost?

Each successful call costs 2 credits. Pass cache=true to serve from the 24h cache (0 credits on hit); default is always fresh. Hits include cached + cachedAt. Selected profile endpoints also accept cacheMaxAge=1d|3d|7d|14d|30d. Failed or empty results are never charged.

Do I need a Spotify API key or OAuth?

No. A single Captapi key works across every platform Captapi supports — YouTube, TikTok, Instagram, Facebook, Twitter/X, Reddit, Threads, Bluesky, Pinterest, LinkedIn, Rumble, Spotify, Kwai, and more. We handle proxies, rate limits, retries, and authentication for you.

Why does results[].uri look different from older scrapes?

uri is always a canonical Spotify URI (spotify:track:… / album:… / artist:…). Bare IDs are expanded. Chain them into /spotify/track, /album, or /artist without guessing prefixes.

Is search raw the same as artist/track/album raw?

Not always. The primary path is Pathfinder GraphQL (same family as details). Apify fallthrough uses a flat scraper object (albumName, isExplicit). Envelope source is pathfinder or apify — do not write one raw parser for both. Prefer normalized fields; pass raw=true only when needed.

How fresh are results?

Envelope fetchedAt is when this request completed. It is not copied onto results[] (no per-row scrapedAt). There is no cursor — max 50 results per call.

Why is playCount missing on search results?

Pathfinder search hydrate does not expose stream counts. Absence is not zero — chain results[].uri into /spotify/track or read playCount from /spotify/album tracks[].

Why is playable missing on search results?

decorateContextTracks (Pathfinder search hydrate) omits playability. Absence is not false — chain results[].uri into /spotify/track, which returns playable when Spotify exposes it.

Is billing per result or flat?

Flat 2 credits on the native Pathfinder path. Apify fallthrough scales per result (~1.15×). The limit param does not mean "billed per result" on the primary path.

Is the Spotify Search API suitable for production use?

Yes. It is a stable REST endpoint with predictable JSON and automatic retries. Pass cache=true to serve from the 24h cache (0 credits on hit); default is always fresh. Hits include cached + cachedAt. Selected profile endpoints also accept cacheMaxAge=1d|3d|7d|14d|30d. Use it for analytics, monitoring, and content automation.

Ready to run a Spotify search?

Start free with 100 credits — no credit card required.

Get your free API key