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-10-19T13:55:46.115Z",
    "totalReturned": 2,
    "results": [
      {
        "platform": "spotify",
        "type": "track",
        "uri": "spotify:track:6OtfwrzhIaIg6gmnzgPlu1",
        "url": "https://open.spotify.com/track/6OtfwrzhIaIg6gmnzgPlu1",
        "name": "Lodi Dodi",
        "artists": [
          {
            "id": "7hJcb9fa4alzcOq3EaNPoG",
            "uri": "spotify:artist:7hJcb9fa4alzcOq3EaNPoG",
            "name": "Snoop Dogg",
            "url": "https://open.spotify.com/artist/7hJcb9fa4alzcOq3EaNPoG"
          }
        ],
        "album": {
          "id": "5IFOummNcGXY3qCBWRchqP",
          "uri": "spotify:album:5IFOummNcGXY3qCBWRchqP",
          "name": "Doggystyle",
          "url": "https://open.spotify.com/album/5IFOummNcGXY3qCBWRchqP"
        },
        "durationMs": 301386,
        "durationFormatted": "5:01",
        "image": "https://i.scdn.co/image/ab67616d0000b273733af86f8dea9692a3f59d29",
        "id": "6OtfwrzhIaIg6gmnzgPlu1",
        "contentRating": "EXPLICIT",
        "explicit": true
      },
      {
        "platform": "spotify",
        "type": "track",
        "uri": "spotify:track:7zGzS7L6LnI5qQqMm8wTPB",
        "url": "https://open.spotify.com/track/7zGzS7L6LnI5qQqMm8wTPB",
        "name": "New Look - Wii U Mii Maker Lofi Mix",
        "artists": [
          {
            "id": "3IPogHnZAaq9yaTX08k8I5",
            "uri": "spotify:artist:3IPogHnZAaq9yaTX08k8I5",
            "name": "Secret Potion",
            "url": "https://open.spotify.com/artist/3IPogHnZAaq9yaTX08k8I5"
          },
          {
            "id": "1P81mHjNBsPI4Hu6ES6e8H",
            "uri": "spotify:artist:1P81mHjNBsPI4Hu6ES6e8H",
            "name": "Lofi Beats To Chill Study Sleep",
            "url": "https://open.spotify.com/artist/1P81mHjNBsPI4Hu6ES6e8H"
          }
        ],
        "album": {
          "id": "32SJ8laWwAeRR56q7Q1Kpx",
          "uri": "spotify:album:32SJ8laWwAeRR56q7Q1Kpx",
          "name": "Frutiger Aero Remixes",
          "url": "https://open.spotify.com/album/32SJ8laWwAeRR56q7Q1Kpx"
        },
        "durationMs": 162897,
        "durationFormatted": "2:42",
        "image": "https://i.scdn.co/image/ab67616d0000b27365bc1eef471caed82cd5c3d9",
        "id": "7zGzS7L6LnI5qQqMm8wTPB",
        "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 fallback-path shapes differ — see FAQ.
cachebooleanNoSet true to serve from the 24h response cache (0 credits on hit). Default false — always fetch fresh.

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. 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 access, 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). The fallback path uses a flat object (albumName, isExplicit). Envelope source is pathfinder on the primary path and omitted on the fallback path — 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. The fallback path 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. 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