OptionalcacheOptional cache backend for GET responses on the underlying client.
Implement the SoundCloudCache interface to plug in any backend
(in-memory, Redis, etc.).
OptionalcacheSet Cache-Control headers on GET responses, keyed by route prefix.
Use "default" as a fallback for unmatched prefixes.
OptionalcacheDefault TTL in milliseconds for cached GET responses (used with cache).
SoundCloud OAuth client ID from your app registration.
SoundCloud OAuth client secret from your app registration.
OptionalcorsCORS configuration. When set, Access-Control-Allow-Origin and
Access-Control-Allow-Methods headers are added to responses.
Optionalmethods?: string[]Allowed HTTP methods (default: inherited from your route exports).
Optionalorigin?: string | string[]Allowed origin(s). Pass a string or array of strings.
OptionalcsrfWhen true, POST/DELETE mutation routes (like, repost, follow) require a matching
Origin header. If cors.origin is also set, the Origin must match an allowed origin.
Helps prevent CSRF on action endpoints. Default: false.
OptionaldedupeDeduplicate concurrent identical GET requests on the underlying client (concurrent callers share one promise and receive the same object reference).
OptionalfetchCustom fetch implementation forwarded to the underlying SoundCloudClient.
Useful for Workers/Bun/Deno portability or test injection.
Optionalinit: RequestInitOptionalgetCustom token provider for public (non-auth) routes. When set, this function is called instead of the default client-credentials flow. Useful when your app stores OAuth tokens externally (e.g. Redis, database).
A valid SoundCloud access token string.
OptionalmaxMaximum number of retries on 429 (rate limit) and 5xx (server error) responses.
OptionalonPassed through to the underlying SoundCloud API calls for per-request telemetry. Fires for each individual SoundCloud API request (including retries).
OptionalonCalled before each retry attempt on the underlying client with structured retry info (attempt, delay, reason, status, url).
OptionalonCalled after every API route is handled with route-level telemetry. Use for logging, metrics, or observability on the Next.js side.
OptionalredirectOAuth redirect URI — required if using authentication features (login/callback).
OptionalretryBase delay in milliseconds for exponential backoff between retries.
OptionalroutesSelective route exposure. Use allowlist to only expose specific route prefixes,
or denylist to block specific ones. Unlisted routes return 403 when allowlist is set.
Optionalallowlist?: string[]Only expose these route prefixes (e.g. ["tracks", "search"]).
Optionaldenylist?: string[]Block these route prefixes (e.g. ["me", "likes"]).
Configuration for initializing server-side SoundCloud API route handlers.
Example
See
createSoundCloudRoutes for usage