kutt - v4.0.0
    Preparing search index...

    Class DomainAPI

    Provides Kutt v2 custom domain operations using this instance's configuration.

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

    import { DomainAPI } from "kutt";

    const domains = new DomainAPI().setAPIKey("YOUR_API_KEY");
    const domain = await domains.createV2({ address: "go.example.com" });

    Hierarchy (View Summary)

    Index
    • Creates a custom domain using this instance's configuration.

      Parameters

      • domain: TNewDomainV2

        The custom domain address and optional homepage URL.

      Returns Promise<TDomainV2>

      The domain, with createdAt and updatedAt converted to Date objects.

      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 domain = await kutt.domains().createV2({
      address: "go.example.com",
      homepage: "https://example.com",
      });
    • 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.

    • Deletes a custom domain using this instance's configuration.

      Parameters

      • domainId: string

        The domain's unique ID.

      Returns Promise<string>

      The deletion message returned by the API.

      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 message = await kutt.domains().removeV2("497f6eca-6276-4993-bfeb-53cbbbba6f08");
    • 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);