Install

npm install dub

Options

The SDK constructor accepts an options object with the following properties:

token
string
required

The API token for the Dub.co API. You can create your token from the Dub.co dashboard.

workspaceId
string
required

The id of the workspace you want to interact with. Learn how to get your Workspace ID on Dub?

projectSlug
string

The slug of the project you want to interact with. projectSlug is deprecated, use workspaceId instead.

Usage

import { Dub } from "dub";

const dub = new Dub({
  token: "DUB_API_KEY",
  workspaceId: "ws_clugls3...",
});

await dub.links.create({
  url: "https://google/com",
});