Skip to content
NewNexus 2.0 is here, and it’s open source. Read the launch post

API reference

API overview

One API for everything in Nexus, the same one the CLI and Nexus UI use.

View as Markdown

Everything you can do in Nexus UI or the CLI goes through the Nexus API: organizations, keys, teams, spend, the audit log, model calls and every product. This reference is generated from the API's own OpenAPI description at each build, so it lists exactly the endpoints that exist.

Base URL

The API lives under /v1 on your Nexus Gateway, for example https://api.nexus.inc/v1. The examples use two shell variables:

export NEXUS_URL=https://api.nexus.inc
export NEXUS_API_KEY=nx_…          # an API key: Nexus UI → Settings → Keys

Your Gateway also serves the full description, with every registered product's operations merged in, at GET /v1/openapi.json.

Authentication

Send a personal token as Authorization: Bearer <token>. See Authentication for the kinds of tokens and how to get one. Each endpoint below shows the permission it needs and who has it; the full matrix is on Permissions.

Requests and responses

  • Request and response bodies are JSON, except where an endpoint says otherwise (an audit export is CSV; the agent gateway streams server-sent events).
  • Every answer carries an x-request-id; the audit log records it with each change.
  • Every write and model call accepts an Idempotency-Key, so a retry is applied once. See Idempotency keys.
  • Name the team a call is attributed to with the x-nexus-team header. See Attribution.
  • Errors are { "error": { "message", "type", "code" } }. See Errors.
  • Requests are rate-limited per key per minute (429).

Examples

Each endpoint has a curl example and, where the typed client has the call, a TypeScript example using @nexus/kit, the client the CLI and Nexus UI use. @nexus/kit is not published to npm yet: Coming.

Try it on an endpoint opens it in Nexus UI's API Explorer, which sends the request with your key and shows the answer.