Skip to content
Docs navigation: Decision model / Authentication

Authentication

RightNow AIDecision modelAuthentication Updated

On this page

Send a workspace API key in the Authorization header with every decide request.

decide.ts
import { SystemZeroClient } from '@rightnowai/system-zero';

const client = new SystemZeroClient({
  apiKey: process.env.SYSTEM_ZERO_API_KEY,
  baseURL: "https://api.rightnowai.co/v1",
});
const reply = await client.decide({
  "model": "rightnow-decision",
  "state": "The blender I ordered arrived with a cracked jar.",
  "questions": {
    "damaged": {
      "type": "boolean",
      "instructions": "Did the item arrive damaged?"
    }
  }
});
console.log(JSON.stringify(reply, null, 2));
const models = await client.models.list();
console.log(models);

// Set SYSTEM_ZERO_API_KEY to your API key before running this example.
// Run this example on your server.
// SDK defaults: The default is 5 retries, also the maximum, with 150 seconds
// per attempt and a 60-second total retry budget. A single wait longer than 60
// seconds raises the last error.
// Use Retry-After-Ms, or Retry-After when milliseconds are absent. The wait is
// never shorter than a random backoff floor: a random fraction of 0.5 seconds
// doubled for each attempt, capped at 8 seconds.

For a successful request, read answers.damaged.

The key identifies its workspace.

The header

Header
Authorization: Bearer <your key>
Variable
SYSTEM_ZERO_API_KEY
key boundary
Text
Illustration of key handling.

Keep your key on your server. Calls belong to its workspace.

Call from your server over HTTPS. Calls from web pages are not accepted.

Plain HTTP returns 403 https_required.

See API reference for request fields and response headers.

Keys

Create and revoke keys under API keys in an active workspace. Copy the full key when it appears. The browser tab where you created it temporarily keeps it in memory for your first call. Reloading, leaving the console or signing out clears it.

There is no public workspace-selection header.

All roles can create keys and revoke their own keys. Owners and admins can revoke any key in the workspace. See Workspaces and keys.

Revocation

If a key is lost or exposed, revoke it and create a replacement. Update the apps that read it from SYSTEM_ZERO_API_KEY. Follow Leaked API keys for the replacement steps.

Refusals

StatusCodeAction
401Code: invalid_api_keyUse a valid RightNow decision model API key.
403Code: auth_errorReplace the revoked or blocked key.
403Code: account_suspendedContact support about workspace access.

Next: Send your first authenticated request with the Quickstart.