kutt - v4.0.0
    Preparing search index...

    Class HealthAPI

    Provides Kutt v2 health checks using this instance's configuration.

    By default, the configuration is copied from KUTT_CONFIG when the instance is created.

    import { HealthAPI } from "kutt";

    const health = new HealthAPI();
    const isHealthy = await health.checkV2();

    Hierarchy (View Summary)

    Index
    • Checks the health of the Kutt v2 API using this instance's configuration.

      Returns Promise<boolean>

      true after a successful health request.

      HTTPError If the API returns an unsuccessful HTTP response.

      If the request fails, times out, or the response cannot be decoded.

      import { Kutt } from "kutt";

      const kutt = new Kutt();
      const isHealthy = await kutt.health().checkV2();
    • Gets the API key sent in the X-API-KEY request header.

      Returns string

      The configured API key, or an empty string when no key is set.

    • Gets the API base URL used to resolve endpoint paths such as v2/links.

      Returns string

      The configured API base URL.

    • Sets the API key sent in the X-API-KEY request header.

      Parameters

      • apiKey: string

        API key to send. An empty string omits the header.

      • Optionalseal: boolean

        Whether to prevent further changes to this setting. Defaults to false.

      Returns this

      This instance for chained configuration calls.

      If the API key setting is already sealed.

      import { Kutt } from "kutt";

      const kutt = new Kutt().setAPIKey("YOUR_API_KEY");
    • Sets the API base URL used to resolve endpoint paths such as v2/links.

      Parameters

      • baseURL: string

        API root URL, such as https://kutt.to/api/.

      • Optionalseal: boolean

        Whether to prevent further changes to this setting. Defaults to false.

      Returns this

      This instance for chained configuration calls.

      If the base URL setting is already sealed.

      import { Kutt } from "kutt";

      const kutt = new Kutt().setBaseURL("https://kutt.example.com/api/", true);
    • Sets the request timeout in milliseconds.

      Parameters

      • timeout: number

        Timeout passed to AbortSignal.timeout when a request starts.

      • Optionalseal: boolean

        Whether to prevent further changes to this setting. Defaults to false.

      Returns this

      This instance for chained configuration calls.

      If the timeout setting is already sealed.

      import { Kutt } from "kutt";

      const kutt = new Kutt().setTimeout(10_000);