feat: add 20 research API endpoints

Merged
SI
6mo ago
+6333-11

Summary

  • 20 flat routes under /api/research/ backed by Chartmetric, matching the Recoup API query-param pattern
  • Provider-agnostic: no Chartmetric branding, obj wrapper stripped from responses
  • Name-based lookups: ?artist=Drake resolves internally, no provider IDs exposed
  • Shared infrastructure: proxyToChartmetric, resolveArtist, handleArtistResearch
  • 17 tests passing (token exchange: 4, proxy: 6, artist resolution: 7)

Endpoints

Search, Lookup, Profile, Metrics (14 platforms), Audience, Cities, Similar, URLs, Instagram Posts, Playlists, Albums, Tracks, Career, Insights, Track, Playlist, Curator, Discover, Genres, Festivals

Deferred

  • Web search (POST /api/research/web) and Deep research (POST /api/research/deep) — separate PR
  • UUID → Chartmetric ID resolution (returns error with message for now)
  • Response normalization beyond obj stripping (field renames per OpenAPI schema)

Docs spec

https://github.com/recoupable/docs/pull/85

Test plan

  • 17 unit tests passing
  • Add CHARTMETRIC_REFRESH_TOKEN to Vercel env and test live endpoints
  • Verify credit deduction works on deployment preview

Made with Cursor

Summary by CodeRabbit

  • New Features
    • Many new research endpoints for artist analytics (search, profile, albums, tracks, playlists, cities, metrics, genres, festivals, discover, similar, insights, curator, audience, Instagram posts, lookup, URLs, career, charts, milestones, radio, rank, venues).
    • New POST research flows: deep research, people search, web search, enrich, extract.
    • Credit-based usage introduced for several research actions.
    • New content template: "album-record-store".
    • Added people-search and web-extraction integrations for richer results.