kutt - v4.0.0
    Preparing search index...

    Class Kutt

    Configurable client for the Kutt domains, health, links, and users APIs.

    Each API group copies the client's configuration when it is created. Later changes to the client affect API groups created after that change.

    import { Kutt } from "kutt";

    const kutt = new Kutt().setAPIKey("YOUR_API_KEY");
    const link = await kutt.links().createV2({ target: "https://example.com" });

    Hierarchy (View Summary)

    Index
    • Creates a client with a copy of KUTT_CONFIG, including sealed settings.

      Later changes to the global configuration do not affect this client.

      Returns Kutt

    • 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);