Seawatts Logo

Seawatts

  • Home
  • Features
  • FAQ
  • Docs
  • GitHub
Create Webhook URLSign In
OverviewREST APISDKCLIMCP serverAPI reference

SDK

Use the typed TypeScript client.

Use the client

The SDK is a typed client for the same operations. Method names match the operation names, inputs are checked as you type, and results are typed too.

Create a client
import { createSdk } from '@seawatts/sdk/client';

const sdk = createSdk({
  apiKey: process.env.SEAWATTS_API_KEY,
  baseUrl: 'https://your-app.example.com',
});

const org = await sdk.org.current();
await sdk.org.updateName({ name: 'acme' });

Handle errors

A failed call throws an SdkError. Its code is the same one the REST API returns, so you can branch on it; its message is safe to show.

Catch a refusal
import { SdkError } from '@seawatts/sdk/client';

try {
  await sdk.org.updateName({ name: 'Not Valid' });
} catch (error) {
  if (error instanceof SdkError && error.code === 'BAD_REQUEST') {
    console.log(error.message);
  }
}
Seawatts Logo

Seawatts

Production-ready monorepo template optimized for AI code generation. Build web, mobile, CLI, and extensions from a single codebase with end-to-end type safety.

  • Company
  • Privacy Policy
  • Terms of Service
  • Applications
  • Web App
  • Mobile App
  • CLI
  • Extensions
  • Resources
  • GitHub
  • Documentation
  • OSS Friends
GitHubStar