// @appneurox/sdk
TypeScript SDK
The @appneurox/sdk client for the v1 platform API: app.<module>.<resource>.<method>(), credentials, idempotency, revisions, errors and pagination.
- 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
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.
| OS module | SDK modules |
|---|---|
| identity-os | identity, authentication, user, profile, verification, tenant, organization |
| policy-os / security-os | access, policy, security, apiKey, risk |
| license-os / billing-os | entitlement, subscription, metering, invoice, wallet, tax, payout, refund |
| config-os / secret-os / audit-os | config, featureflag, environment, secret, audit |
| event-os | event, webhook, queue |
| notification-os / communication-os | notification, messaging, chat, calling |
| file-os / media-os / document-os / search-os | storage, media, document, signature, search |
| scheduling-os / model-os | scheduling, job, model |
Options
| Option | Applies to | Meaning |
|---|---|---|
| idempotencyKey | writes | Defaults to a new UUID per call. Pass your own key to retry the same write. |
| revision | writes | Sent as If-Match. Updates fail with 409 REVISION_CONFLICT without the current revision. |
| onResponse | all | Receives { status, revision, requestId, headers }. |
| tenantId | all | Global operators select a tenant; a tenant credential may only repeat its own. |
| query, headers, signal, timeoutMs | all | Extra query parameters, headers, cancellation and a per-call timeout (default 20 s). |
Errors, retries and redirects
- Every failure throws
PlatformErrorwith status, code, requestId and body. Check codes withisPlatformError(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.