Appearance
Search
Under /v1. Guest-safe: every read works without a token; signed-in searches add history and a boost for followed creators. Postgres FTS (simple config, prefix on the last word) plus pg_trgm for typos, over search's own search_documents, fed by SearchApi.upsertDocument from other modules' events. Chats are end-to-end encrypted and never indexed.
Types: recording release profile playlist muzcast_show episode live_stream product dj_set. Filters (all optional): types=a,b, genre, mood, yearFrom, yearTo, explicit=false (hide explicit), country (results from that country). The viewer's country (CDN header or settings) boosts, never filters.
| Method | Path | Auth | Query / body | Response |
|---|---|---|---|---|
| GET | /search | guest | q, filters, perType (1–20, default 5) | { query, topHit, groups: [{ type, items: Result[], hasMore }] } |
| GET | /search/types/:type | guest | q, filters, cursor, limit | Result[] page |
| GET | /search/suggest | guest | q, types?, limit (≤15) | { suggestions: (Result & { isPrefixMatch })[], recentQueries: string[] } |
| GET | /search/trending | guest | country?, limit | { query, rank, searchers }[] (falls back to global) |
| POST | /search/clicks | guest | { type, refId, q? } | ok 202 |
| GET | /me/search/history | user | page | { id, query, lastSearchedAt }[] |
| DELETE | /me/search/history/:id | user | ok | |
| DELETE | /me/search/history | user | ok (also clears recent results) | |
| GET | /me/search/recent-results | user | { id, type, refId, clickedAt }[] | |
| DELETE | /me/search/recent-results/:id | user | ok | |
| GET | /staff/search/zero-results | staff reports:read | page | { query, sample, occurrences, lastSeenAt, lastCountryCode }[] |
Result: type, refId, title, subtitle, imageAssetId, creatorProfileId, isExplicit, isVerified, releaseYear, score.
Suggestions: one or two characters use an index-only title prefix scan by popularity; longer input uses the full scorer. Shared results are cached in Valkey per prefix, type set and country for 60 s; the personal boost is applied after the cache. Rate limits: search 120/min, suggest 600/min per actor and IP.
Errors: SEARCH_QUERY_INVALID, VALIDATION_FAILED, PAGINATION_CURSOR_INVALID, RATE_LIMITED, NOT_FOUND (click on an unknown result).
Jobs: search.logged (analytics queue: query log, zero-result rollup, history), search.trending-recompute every 10 min, search.maintenance daily (log partitions, 180-day retention).
Profile hits
Results carry imageUrl (signed) and, on profile hits, profileType. refId is the profile ID: start a chat with POST /messaging/conversations/direct { profileId }.