Authentication

nXus uses API keys passed via the Authorization request header as Bearer tokens to authenticate all requests.

Every request to the nXus API must include your API key in the Authorization header as a Bearer token. Keys are scoped to an organization and optionally to a specific environment (development or production).

index.ts
123456789101112131415161718
import { NxusClient, NxusApiError } from 'nxus-qbd';


const apiKey = process.env.NXUS_API_KEY;
if (!apiKey) throw new Error("Set NXUS_API_KEY");
const nxus = new NxusClient({ apiKey });

try {
  const result = await nxus.vendors.list({
  "limit": 50
}, { connectionId: "YOUR_CONNECTION_ID" });
  console.log(result.data);
} catch (err) {
  if (!(err instanceof NxusApiError)) throw err;
  console.error(err.userMessage);
  console.error({ code: err.code, status: err.status, requestId: err.requestId });
  if (err.isValidationError) console.error(err.validationErrors);
}

Security Best Practice

Keep your keys secret. Never expose API keys in client-side JavaScript, public repos, or logs. Rotate any key you believe has been compromised immediately from the dashboard.

Key Types

NameTypeDescription
Testsk_test_...Use with QuickBooks sample files only. Available on the free tier.
Livesk_live_...Use with real company files. Requires a production plan.

Managing API Keys

Create, view, revoke, and rotate keys from the dashboard under Settings -> API Keys.

API-key management is no longer part of the public API reference. Those operations are handled by the authenticated dashboard and our internal platform client instead of public API requests.

Key Expiry

Keys can be configured with an optional expiry date. After expiry, requests return a 401 Unauthorized response. Plan ahead and rotate before expiry using the rotate endpoint or the dashboard.

Error Responses

Error handling

Precise errors with clear recovery paths

nXus error responses are designed for both developers and operators: machine-readable enough for apps to handle automatically, and human-readable enough to explain what to do next.

Consistent structure

Applications can inspect the same predictable error shape instead of special-casing every endpoint.

Clear human messaging

User-facing text stays understandable for operators while still preserving the technical context developers need.

Actionable next steps

The most common failures map cleanly to concrete fixes like rotating a key, reopening QuickBooks, or correcting a payload.

error.json
1234567891011
{
  "error": {
    "code": "API_KEY_INVALID",
    "type": "AUTHENTICATION_ERROR_TYPE",
    "message": "The provided API key is invalid or has been revoked.",
    "userFacingMessage": "Your API key is no longer valid. Create or rotate a key and try again.",
    "httpStatusCode": 401,
    "integrationCode": null,
    "requestId": "req_abc123"
  }
}
HTTP 401

Authentication failed

The API key is missing, invalid, expired, or revoked.

Recommended fix: Confirm the Bearer token, verify the environment, and rotate the key if needed.

Retry guidance: Retry only after updating credentials.

View full error docs

Handling Strategy

The SDK normalizes supported HTTP error responses into NxusApiError (TypeScript/Python) or NxusApiException (.NET). Use its userMessage, user_message, or UserMessage for operator-visible UI, and log the request ID for diagnosis. Raw HTTP responses use error.userFacingMessage or problem details instead.