kutt - v4.0.0
    Preparing search index...

    Function createKuttLinkV2

    • Creates a short link using the Kutt v2 API, or reuses an existing link when requested.

      Parameters

      • link: TNewLinkV2

        The destination URL and optional short-link settings.

      • options: TAPIOptions = {}

        Per-request base URL, API key, and timeout in milliseconds. Omitted settings use KUTT_CONFIG.

      Returns Promise<TLinkV2>

      The created or reused link, 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 { createKuttLinkV2 } from "kutt";

      const link = await createKuttLinkV2(
      { target: "https://example.com/article", customURL: "article", expireIn: "2 days" },
      { apiKey: "YOUR_API_KEY" },
      );
      console.log(link.link);