kutt - v4.0.0
    Preparing search index...

    Class UserAPI

    Provides Kutt v2 user information using this instance's configuration.

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

    import { UserAPI } from "kutt";

    const users = new UserAPI().setAPIKey("YOUR_API_KEY");
    const user = await users.infoV2();

    Hierarchy (View Summary)

    Index
    • 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.

    • Gets the authenticated user's information using this instance's configuration.

      Returns Promise<TUserV2>

      The user's API key, email, and domains with normalized dates.

      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().setAPIKey("YOUR_API_KEY");
      const user = await kutt.users().infoV2();
    • 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);