Skip to main content
The Tusky TypeScript SDK (@tusky-io/ts-sdk) gives you full programmatic access to the Tusky platform — create environments, upload files, manage members, and configure aggregators from any JavaScript or TypeScript application.

Prerequisites

Installation

npm install @tusky-io/ts-sdk

Import the SDK

The SDK ships with separate entry points for server and browser environments.
import { Tusky } from "@tusky-io/ts-sdk";
The browser entry point excludes Node-specific dependencies (such as fs and path) so your bundler does not pull in unnecessary polyfills.

Initialize the Client

The fastest way to get started is with an API key. You can generate one from the Tusky dashboard.
const tusky = new Tusky({ apiKey: "your-api-key" });
For browser applications you can authenticate with a connected Sui wallet instead. See Authentication for all supported methods.

Quick Example

The following snippet creates an environment and uploads a file in just a few lines:
import { Tusky } from "@tusky-io/ts-sdk";

const tusky = new Tusky({ apiKey: "your-api-key" });

// Create a new environment
const environment = await tusky.environment.create("My First Environment", {
  encrypted: true,
});

console.log("Environment created:", environment.id);

// Upload a file to the environment
const file = await tusky.file.upload(environment.id, "./hello.txt", {
  name: "hello.txt",
});

console.log("File uploaded:", file.id);

// Retrieve the file content
const content = await tusky.file.arrayBuffer(file.id);
console.log("Downloaded", content.byteLength, "bytes");
1

Install the SDK

Run npm install @tusky-io/ts-sdk in your project directory.
2

Generate an API key

Open the Tusky dashboard, navigate to Settings → API Keys, and create a new key.
3

Initialize Tusky

Import and instantiate the client with your API key.
4

Create an environment and upload

Use tusky.environment.create() and tusky.file.upload() to store your first file on Walrus.

Configuration Options

The Tusky constructor accepts an options object:
OptionTypeDescription
apiKeystringAPI key for server-side authentication.
walletWalletAdapter | KeypairSui wallet adapter (browser) or keypair (server).
baseUrlstringOverride the API base URL (defaults to https://api.tusky.io).
aggregatorUrlstringCustom aggregator URL for downloads. Use any Walrus aggregator — Tusky’s, a public one, or your own. Enables decryption without Tusky.

What’s Next