soundcloud-api-ts-next
    Preparing search index...

    Function getTrack

    • Fetch a single SoundCloud track by ID.

      Uses client credentials (public endpoint — no user token required). Wrap with next/cache options for ISR / on-demand revalidation.

      Parameters

      • id: string | number

        Track ID (number or string).

      • config: ServerHelperConfig

        SoundCloud client credentials.

      • OptionalcacheOptions: CacheOptions

        Optional next/cache caching options.

      Returns Promise<SoundCloudTrack>

      // 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} />;
      }