The SDK is currently in active development. For more details, see the U301 Postman docs.

Official U301 SDK to create branded short links, manage links, and access analytics. Built for Bun and Node with first-class TypeScript support.

Currently, we only provide a TypeScript SDK for Node.js and Bun. For other environments, you can use the REST API directly. Run in Postman

Install TypeScript SDK

npm install u301

The TypeScript SDK is still in development. We value your feedbacks.

Quick Start

quick-start.ts
import { U301 } from 'u301';

const apiKey = '<YOUR_API_KEY>';
const workspaceId = '<YOUR_WORKSPACE_ID>';

const u301 = new U301({
  apiKey,
  workspaceId,
});
const link = await u301.links.create({
  url: 'https://example.com',
  domain: 'u301.co',
  slug: 'launch',
});

Analytics

analytics.ts
import { U301 } from 'u301';
const apiKey = 'YOUR_API_KEY';
const workspaceId = 'YOUR_WORKSPACE_ID';

const u301 = new U301({
  apiKey,
  workspaceId,
});
const report = await u301.analytics.getClicks({
    range: '1m',
    granularity: 'day',
    timezone: 'Europe/London'
})

Last updated on