soundcloud-api-ts - v1.9.0
    Preparing search index...

    Function scFetch

    • Make a request to the SoundCloud API using native fetch.

      Handles JSON serialization, OAuth headers, automatic retries on 429/5xx, and optional automatic token refresh on 401. For 302 redirects, returns the Location header value. For 204 responses, returns undefined.

      Type Parameters

      • T

      Parameters

      • options: RequestOptions

        Request configuration (path, method, token, body)

      • OptionalrefreshCtx: AutoRefreshContext

        Optional auto-refresh context for transparent token renewal

      Returns Promise<T>

      Parsed JSON response, redirect URL, or undefined for empty responses

      When the API returns a non-retryable error status

      import { scFetch } from 'soundcloud-api-ts';

      const track = await scFetch<SoundCloudTrack>({
      path: '/tracks/123456',
      method: 'GET',
      token: 'your-access-token',
      });