Spotify
GET /v1/spotify/search

Spotify Search API

Search Spotify — canonical spotify: URIs, explicit, fetchedAt (flat 2 credits).

2 credits per request
TL;DR
Search Spotify — canonical spotify: URIs, explicit, fetchedAt (flat 2 credits). The Spotify Search API (Spotify) is a single authenticated GET request to /v1/spotify/search that responds with clean JSON and costs 2 credits. Pass cache=true for a free 24h cache hit; default is always fresh. Start with 100 free credits — no credit card.

What is the Spotify Search API?

Pass q plus optional type=tracks|albums|artists|podcasts|episodes (default tracks) and limit (max 50, no cursor). Primary path is web-player Pathfinder GraphQL (same family as /spotify/artist|track|album); Apify scraper is fallthrough only — do not assume one raw schema across both (GraphQL __typename vs flat albumName/isExplicit). Envelope: query, type, fetchedAt, source (pathfinder|apify), results[]. Each result ships a canonical Spotify URI (spotify:track:… not a bare id), url, name, artists (structured on Pathfinder track/album hits), durationMs/durationFormatted, explicit, contentRating, and image. Request freshness is envelope fetchedAt only — not copied onto every row. Pathfinder search (decorateContextTracks) does not expose playCount or playable (absence ≠ false/zero); chain uri into /spotify/track for those. Flat 2 credits on native Pathfinder; Apify fallthrough scales per result. Pass raw=true for per-result upstream payloads (omitted by default; searchTerm is not repeated inside raw).

What you get

  • Ranked, structured result list
  • Title, URL, author, and thumbnail per result when available
  • Engagement metrics where the platform exposes them
  • Configurable result limit

Platform limits

Honest ceilings from the upstream platform surface — not Captapi bugs. Unexpected truncation here is usually the platform, not us.

  • playCount is not on search.results[] — Pathfinder search hydrate omits stream counts; use /spotify/track or /spotify/album tracks[].
  • playable is not on search.results[] — decorateContextTracks omits playability; use /spotify/track.
  • fetchedAt is envelope-only — results[] do not carry scrapedAt.

Try it

Open in Playground

Fill in the parameters below and copy a ready-to-run request, or open the live Playground to run it against your account (no API key paste).

Parameters

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

Edit the parameters and the code updates instantly. Switch languages and hit copy.

Example response

{
  "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 is returned in response headers: X-Captapi-Credits (credits charged), X-Captapi-Cache (hit or miss), and X-Captapi-Source. Failed requests (4xx/5xx) are never charged. See the full list of error codes in the error reference.

Response structure

A successful call returns success, cached, creditsUsed, and a data object with the following fields:

Top-level fields

  • platformAlways "spotify" on this endpoint.
  • queryEcho of the q parameter.
  • typeContent type of the item.
  • fetchedAtWhen this search request completed (envelope only — not duplicated on results[]).
  • sourceUpstream used for this response: "pathfinder" (GraphQL) or "apify" (scraper fallthrough).
  • totalReturnedNumber of items returned in this response.

Results

Each item in results contains:

  • platformAlways "spotify" on this endpoint.
  • typeContent type of the item.
  • uriCanonical Spotify URI (spotify:track:… / album:… / artist:… / show:… / episode:…) — never a bare id.
  • urlCanonical URL of the item.
  • nameResult title (track, album, artist, or show name). Not a profile displayName alias.
  • artistsOn Pathfinder track/album hits: [{id, uri, name, url}]. Apify fallthrough may still ship name strings.
  • albumAlbum the track belongs to.
  • durationMsLength in milliseconds.
  • durationFormattedHuman duration (m:ss) when known.
  • imageImage URL.
  • idStable platform ID for the item.
  • contentRatingPathfinder contentRating.label when present on the search hydrate (NONE | EXPLICIT | NINETEEN_PLUS | UNKNOWN).
  • explicitWhether the item is marked explicit (from contentRating or Apify isExplicit).

Parameters

NameTypeRequiredDescription
qstringYesSearch 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.

Authentication: send your key as Authorization: Bearer capt_live_.... A typical call costs 2 credits. Pass cache=true for a free 24h cache hit; default is always fresh.

Using an AI agent? This endpoint is the MCP tool spotify_search via @captapi/mcp. Set it up →

How it works

  1. 1. Sign up — get 100 free credits, no card required.
  2. 2. Create a key from your dashboard.
  3. 3. Send one request to /v1/spotify/search and parse the JSON response.

Use cases

Discovery → details

Search then chain canonical result URIs into /spotify/track, /album, or /artist.

Freshness-aware ingest

Use envelope fetchedAt to know when results were pulled (no cursor beyond limit 50).

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.

More Spotify APIs

Ready to use the Spotify Search API?

Sign up, grab your key, and make your first call in 60 seconds.