Commands Reference
Global Flags
Authenticate once with
nexspace login (see CLI Authentication);
commands reuse the stored credential automatically.
Agent loop
{ "error", "code", "next" } with exit 2 (auth) or 3 (input).
Environment
Auth
nexspace login
Authenticate. Defaults to the browser device-code OAuth flow; pass --token to
store an API key/PAT instead. Credentials are saved to the OS keychain when
available (falling back to ~/.nexspace/config.json).
Scope each command needs
The same table applies to an API key’s scopes.
Scope and role: a scope never exceeds your account’s role, a read scope
never covers a request that changes data, and some routes refuse every API key
and OAuth token. See CLI Authentication → Scopes.
nexspace login-device
Explicit alias for the OAuth device-code login flow.
nexspace logout
Remove stored credentials.
nexspace whoami
Print the identity the current credential authenticates as.
Discovery
nexspace search <query>
Rank MCP tools by natural-language intent.
nexspace mcp tools
List available MCP tools.
nexspace mcp schema <toolName>
Print inputSchema (and outputSchema when present) for a tool.
nexspace mcp call <toolName>
Invoke an MCP tool by name.
Under
--dry-run the named tool is never called, read-only or not. Where a
preview sibling exists (runPayroll, not implemented yet, → previewPayrollRun) the CLI calls that
instead and returns its result under result; otherwise it returns
{ dryRun: true, valid: true, mutating } with nothing executed.
Context
nexspace context use
Pin a facility so shifts, staff, and payroll commands default to it
instead of repeating --facility-id on every call.
--org-id. Org scope is derived from the credential you logged in
with and cannot be overridden per-request; the few super-admin REST routes that
accept a narrowing override take it explicitly as
nexspace api GET /api/crm/... -q orgUnitId=N.
Facilities
nexspace facilities list / get
Staff
nexspace staff search / get / find-credentialed / credentials-expiring
Shifts
nexspace shifts list / get / fill / propose / swap / coverage
--dry-run on mutating verbs before the real call.
Credentials
nexspace credentials verify
Payroll
nexspace payroll preview / run
payroll preview computes a run without committing it. payroll run is not
available: runPayroll is not implemented yet, so the server does not list it
and refuses a call (nothing is created, sent to the payroll provider or
billed). --dry-run on run still executes the preview.
CRM
nexspace crm leads-search / leads-qualify
Notify
nexspace notify shift-swap
This verb sends real SMS and push notifications, so it validates strictly rather
than notifying a subset: a non-numeric entry in
--staff-ids or an unrecognized
--channels value exits 3 (VALIDATION_FAILED) and sends nothing.
API Keys
Dashboard only. Key management refuses every API key and OAuth token, so these commands return403 however you logged in (an OAuth login included).
Create, list and revoke keys at Settings → API keys in the dashboard. The
commands remain for completeness. See
Authentication → API Keys.
nexspace api-keys list / create / revoke
resource:action. A resource-level wildcard (crm:*) is
accepted; a bare * or *:* is rejected with 400 VALIDATION_ERROR because
the resource half must be a real resource name.
Webhooks & events
nexspace webhooks list / create / delete / test
nexspace events listen
Local receiver + temporary subscription. Verifies X-NexSpace-Signature when
the create response includes signingSecret. Cloud API hosts cannot reach
127.0.0.1 — pass --forward-url (ngrok / cloudflared).
nexspace events trigger
Fire a test delivery against an existing subscription.
Approvals, audit & logs
Admin-gated AI action surfaces (same APIs as Admin → AI Config → Approvals). These are not the same asnexspace agents approvals (headless run
resolution under agents:approve).
nexspace approvals list / approve / reject
list needs no scope (your role decides). approve and reject execute or
cancel the deferred tool call, so they need the agents:approve scope, the same
as nexspace agents approvals (nexspace login --scope agents:approve), and,
as there, resolve only an approval one of your own agent runs raised. Any other
approval answers 403 DELEGATED_CREDENTIAL_NOT_ALLOWED, even for a facility
admin or platform operator: resolve it in the dashboard.
nexspace audit list
nexspace logs tail
Polls GET /api/ai/audit as JSONL (there is no general HTTP request-log API).
Agents
Headless agent runs (distinct from admin AIapprovals above). Requires
agents:run / agents:approve / agents.manage as noted. See also
Agent runs.
nexspace agents run <agentId>
Start a headless agent run and stream its events to completion. Backed by
POST /api/agents/{id}/runs + the run SSE stream
(GET /api/agents/{id}/runs/{runId}/stream); requires the agents:run scope.
In
stream-json mode each event is emitted as one JSON object per line —
ideal for agents/CI that consume the run incrementally. A run_started line is
emitted first, then one line per status / assistant / tool_call / result
/ done event. The command exits non-zero if the run ends in error or
rejected.
nexspace agents runs <list|get|cancel|approvals>
Inspect and control runs after they start. All require the agents:run scope
and only operate on runs owned by the credential’s user.
nexspace agents approvals <approve|reject> <approvalId>
Resolve a pending_approval action raised by one of your runs. Requires the
agents:approve scope. Approving executes the deferred tool and resumes the run
once all its approvals are terminal; rejecting terminates the run as rejected.
nexspace agents triggers <list|create|update|delete|toggle|run-now>
Manage automation triggers that fire an agent on a cron schedule or business
event through the durable headless-run path. Requires the agents.manage
permission and the ai suite; from the CLI that means an API key with the
agents:manage scope (no OAuth scope covers it).
create/update accept: --type, --cron, --timezone, --event-type,
--event-filters (JSON), --run-as-user-id, --facility-id, --seed-message,
--no-activate (create only). Schedule triggers need --cron; event triggers
need --event-type.
Fixtures & conformance
nexspace fixtures
Sandbox / webhook helpers for agent demos.
nexspace conformance run
Runs the Governance Conformance Suite (Vitest) from a NexSpace checkout.
Gate on
fullyEnforced rather than the exit code alone if you need every clause
actually enforced; the exit code ignores pending clauses.
Agent helpers
nexspace skill install
Install the nexspace-operations skill for Cursor and/or Claude Code.
nexspace agent playbook
Print the short search → schema → dry-run → call reminder.
nexspace run
Inline agent scripting with injected execute, search, api, and schema.
Useful for fan-out; not a production runtime SLA — prefer MCP/REST for
stable integrations.
--dry-run matches mcp call --dry-run: every execute() returns a
{ dryRun: true, skipped: true } envelope instead of running the tool — including
read-only tools, so a mis-classified verb can’t slip through. The injected
api() helper still performs GETs (discovery stays useful) but short-circuits
POST / PUT / PATCH / DELETE the same way. search() and schema() are
unaffected.
Escape hatch
nexspace api <METHOD> <PATH>
Authenticated passthrough to any API endpoint. A POST / PUT / PATCH /
DELETE needs a write scope for the route’s resource (staff:write, not
staff:read, behind a staff.view guard); a refusal answers
403 INSUFFICIENT_SCOPE and its suggestion names the scope to add. The
human-only routes in CLI Authentication → Scopes
refuse every credential.
nexspace update
Update a standalone (Homebrew/curl) install to the latest release. npm installs
update with npm i -g @nexspace/cli; Homebrew with brew upgrade nexspace.

