Skip to content

// @appneurox/sdk

TypeScript SDK

The @appneurox/sdk client for the v1 platform API: app.<module>.<resource>.<method>(), credentials, idempotency, revisions, errors and pagination.

At a glance
  • Generated from the v1 contract
  • Server-side only
  • No runtime dependencies

Install

@appneurox/sdk 0.1.0 is private during early access and is not on npm yet. Early-access teams get repository access with their credentials. It ships as TypeScript source with no runtime dependencies: add it to transpilePackages in Next.js, or run it directly under Wrangler or tsx. Node 22.18 or later.

Create a client

server.ts
import { AppNeuroX, staticCredentials } from "@appneurox/sdk";

// Server-side only: a Worker, route handler or Node service.
const app = new AppNeuroX({
  credentials: staticCredentials(env.PLATFORM_ACCESS_TOKEN, env.PLATFORM_TENANT_ID),
});

Use the SDK on the server only (Workers, Next.js route handlers, Node). Access tokens must never reach a browser.

Shape: app.<module>.<resource>.<method>()

Modules are the platform's route prefixes. Collections are resources with list, get, create, update, replace and delete; record actions such as invoices.finalize(id) and sub-resources such as wallets.getBalance(id) sit on the resource. Arguments are path parameters in order, then the query or JSON body, then options.

Which SDK modules implement each OS module
OS moduleSDK modules
identity-osidentity, authentication, user, profile, verification, tenant, organization
policy-os / security-osaccess, policy, security, apiKey, risk
license-os / billing-osentitlement, subscription, metering, invoice, wallet, tax, payout, refund
config-os / secret-os / audit-osconfig, featureflag, environment, secret, audit
event-osevent, webhook, queue
notification-os / communication-osnotification, messaging, chat, calling
file-os / media-os / document-os / search-osstorage, media, document, signature, search
scheduling-os / model-osscheduling, job, model

Options

OptionApplies toMeaning
idempotencyKeywritesDefaults to a new UUID per call. Pass your own key to retry the same write.
revisionwritesSent as If-Match. Updates fail with 409 REVISION_CONFLICT without the current revision.
onResponseallReceives { status, revision, requestId, headers }.
tenantIdallGlobal operators select a tenant; a tenant credential may only repeat its own.
query, headers, signal, timeoutMsallExtra query parameters, headers, cancellation and a per-call timeout (default 20 s).

Errors, retries and redirects

  • Every failure throws PlatformError with status, code, requestId and body. Check codes with isPlatformError(error, "REVISION_CONFLICT").
  • GET and HEAD retry twice on network errors, 502, 504, and 503 with Retry-After. Writes never retry automatically; retry yourself with the same idempotencyKey.
  • Redirects are refused (PLATFORM_REDIRECT_REJECTED) so a token is never forwarded to another host.

Credentials for a product connection

A product holds one service credential per connected organization. rotatingCredentials refreshes the access token a minute before it expires, shares one refresh across concurrent requests, and moves the connection to reconcile_required instead of retrying a refresh that may already have reached the platform. Store credentials sealed with sealCredentials (AES-256-GCM). Workers on D1 can use d1Connection instead of writing a store.

Ready to start?

Build on shared modules instead of rebuilding them.

Start with the quickstart, or tell us about your product and we will map it to platform modules.