Node.js & browser (TypeScript) client for Kutt url shortener.
Requires Node.js >=22. This package uses ECMAScript modules (ESM).
pnpm add kutt
or
npm i kutt
Create a client and shorten a URL:
import { Kutt } from "kutt";
const kutt = new Kutt().setAPIKey("YOUR_API_KEY");
const link = await kutt.links().createV2({
target: "https://example.com/article",
customURL: "article",
expireIn: "2 days",
});
console.log(link.link);
const page = await kutt.links().listV2({ limit: 10 });
console.log(page.data);
You can also call endpoints directly:
import { listKuttLinksV2 } from "kutt";
const page = await listKuttLinksV2({
limit: 10,
apiKey: "YOUR_API_KEY",
});
Set defaults before creating clients, including when using a self-hosted Kutt server:
import { KUTT_CONFIG, Kutt } from "kutt";
KUTT_CONFIG
.setBaseURL("https://kutt.example.com/api/")
.setAPIKey("YOUR_API_KEY");
const kutt = new Kutt();
const isHealthy = await kutt.health().checkV2();
Clients copy the defaults when constructed. Each API group copies its client's configuration when created.
See the full API documentation for all endpoints, configuration options, response types, and error handling.
We use SemVer for versioning. For the versions available, see the releases on this repository.
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details