Wocha Docs

TypeScript SDK

Server-side Management API client for Node.js and TypeScript.

The @wocha/sdk package is the TypeScript client for the Wocha Customer (Management) API. Use it in backend services, scripts, and serverless functions.

Installation

pnpm add @wocha/sdk
Or scaffold with the CLI
npx @wocha/cli init --framework nextjs

Quick start

import { WochaClient } from "@wocha/sdk";
 
const wocha = new WochaClient({
  tenant: "acme",
  apiKey: process.env.WOCHA_API_KEY!,
});
 
const { data: users } = await wocha.users.list({ page_size: 25 });
console.log(users);

Configuration

Use tenant for Wocha Cloud — the SDK resolves the API base URL automatically:

new WochaClient({ tenant: "acme", apiKey: "..." });
// → https://acme.api.wocha.ai/v1

Use baseUrl for self-hosted deployments:

new WochaClient({
  baseUrl: "https://your-domain.com/v1",
  apiKey: "...",
});

Pass a management API key (wocha_mgmt_...) or an OAuth 2.0 access token with the required scopes.

Try it

Loading playground…

Resources

The client exposes typed resources including:

  • users — create, list, update, delete identities; sendRecovery({ send: false }) returns a hosted set-password link
  • organisations — org membership, hierarchy, and invite() by email
  • applications — OAuth client management
  • webhooks — register endpoints and event subscriptions
  • connections — social and enterprise SSO
  • permissions — SpiceDB relationship checks

Organisation invites

const invite = await wocha.organisations.invite("org_abc", {
  email: "alex@example.com",
  role: "member",
  return_to: "https://app.example.com/api/auth/login",
  send: false, // your product sends mail with invite.action_url
});

See Organisation invites.

Learn more

On this page