TypeScript SDK

The official TypeScript SDK for NEXUS — fully typed, ergonomic, and designed for server-side and edge runtimes.

@nexus/sdkpackages/sdk-typescript

Part of the NEXUS monorepo. Install from the workspace or publish to your private registry.

Installation

# Part of the NEXUS monorepo
packages/sdk-typescript/

# Import in your project
import { NexusClient, NexusError } from "@nexus/sdk";

Key Classes

The SDK exports two primary classes:

NexusClient

The main entry point. Handles authentication, request lifecycle, and provides access to all resource namespaces (records, posts, campaigns, etc.).

NexusError

Typed error class thrown on API failures. Includes HTTP status, error code, and message for structured error handling.

Creating a Client

import { NexusClient } from "@nexus/sdk";

const client = new NexusClient({
  apiBaseUrl: "https://api.nexusrelate.com",
  headers: () => ({
    authorization: `Bearer ${process.env.NEXUS_API_TOKEN}`,
  }),
});

Working with Records

// List records with filtering
const records = await client.records.list({
  object_slug: "contact",
  limit: 25,
});

// Create a record
const record = await client.records.create({
  object_slug: "contact",
  attributes: {
    name: "Acme Corp",
    industry: "Technology",
    stage: "prospect",
    website: "https://acme.com",
  },
});

Creating Posts

// Create a premium article
const post = await client.posts.create({
  post_type: "article",
  title: "Q4 Investor Update",
  content_text: "We closed our Series A...",
  content_lexical: {},
  status: "published",
  is_premium: true,
});

Type Safety

All SDK methods return fully typed responses generated from the OpenAPI specification. TypeScript will catch schema mismatches at compile time — no runtime surprises.

← Back to home
© 2026 NEXUS · Relationship Intelligence Platform