Track ID (number or string).
SoundCloud client credentials.
OptionalcacheOptions: CacheOptionsOptional next/cache caching options.
// app/tracks/[id]/page.tsx
import { getTrack, scCacheKeys } from "soundcloud-api-ts-next/server";
export default async function TrackPage({ params }: { params: { id: string } }) {
const track = await getTrack(params.id, {
clientId: process.env.SC_CLIENT_ID!,
clientSecret: process.env.SC_CLIENT_SECRET!,
}, { revalidate: 3600, tags: scCacheKeys.track(params.id) });
return <TrackView track={track} />;
}
Fetch a single SoundCloud track by ID.
Uses client credentials (public endpoint — no user token required). Wrap with
next/cacheoptions for ISR / on-demand revalidation.