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

API reference

Authentication

nexus auth login (a device code approved in Nexus UI), personal tokens and API keys.

View as Markdown

Start device login

post/v1/auth/device

Start nexus auth login: a device code for the CLI and a user code to approve in Nexus UI (ten minutes, single use). No key needed.

publicAnyone, signed in or notTry it in the API Explorer

Request body · application/json

  • clientstring

    E.g. nexus CLI on <host>. Control characters are dropped. Without agent and scope, each character outside ASCII is stored as ?. A label that starts with an agent's reserved label (Nexus Slack) needs that agent and a scope, else a 400 reserved_client.

  • agentstring

    With scope: the agent the sign-in is for (slack). Its approval issues an agent link (nxo_…), never a personal token.

    pattern ^[a-z0-9][a-z0-9-]{0,39}$

  • scopestring

    With agent: the matrix actions the agent link holds, space-separated (models.use, spend.read_own, connectors.use, chat.ask, chat.web, agents.memory). Any other is a 400 invalid_scope.

  • client_idstring

    With NEXUS_OAUTH_CLIENT_TIERS=on: the OAuth client that signs in (nxc_cli). Without one, nxc_unregistered. An unknown or revoked client is a 400 invalid_client.

Responses

200OKapplication/json

  • device_codestring
  • user_codestring
  • verification_uristring
  • verification_uri_completestring
  • expires_ininteger
  • intervalinteger

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

503`cutover_paused`: only while the operator pauses sign-in for the auth cutover; nothing changed. Retry after `Retry-After` seconds.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
503`cutover_paused`: only while the operator pauses sign-in for the auth cutover; nothing changed. Retry after `Retry-After` seconds.

Example

curl
curl -X POST "$NEXUS_URL/v1/auth/device" \
  -H "Content-Type: application/json" \
  -d '{
    "client": "my script"
  }'
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.startDeviceLogin("my script");

Poll device login

post/v1/auth/token

Poll for the device login's token, no faster than interval. 400 with code authorization_pending, slow_down (with a new interval), expired_token or access_denied until approved; then a personal token, once, or for a sign-in that asked for a scope, an agent link that holds only that scope. With grant_type authorization_code (Rust only), the phone's sign-in exchanges the code authorizeApp sent to its redirect URI, with its PKCE verifier, for a personal token, once; 400 invalid_grant for an unknown, used, expired or mismatched code, which a failed try also uses up.

publicAnyone, signed in or notTry it in the API Explorer

Request body · application/json

  • device_codestring

    The device login's code (grant_type urn:ietf:params:oauth:grant-type:device_code, or none).

  • grant_type"urn:ietf:params:oauth:grant-type:device_code" | "authorization_code"
  • codestring

    With authorization_code: the code sent to the app's redirect URI.

  • code_verifierstring

    With authorization_code: the PKCE verifier whose S256 challenge authorizeApp was given (RFC 7636).

  • redirect_uristring

    With authorization_code: the redirect URI the code was sent to.

Responses

200OKapplication/json

  • access_tokenstring
  • token_typestring
  • expires_atstring
  • tenantobject
  • userobject
  • role"owner" | "admin" | "member"
  • scopestring

    The matrix actions an agent link holds, space-separated; only for a sign-in that asked for a scope.

  • ui_urlstring

    Nexus UI's address (NEXUS_UI_URL), when Gateway knows it: where a client's links into Nexus UI go.

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400invalid_grantWith `grant_type` `authorization_code` (Rust only), the phone's sign-in exchanges the code `authorizeApp` sent to its redirect URI, with its PKCE verifier, for a personal token, once; 400 `invalid_grant` for an unknown, used, expired or mismatched code, which a failed try also uses up
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).

Example

curl
curl -X POST "$NEXUS_URL/v1/auth/token" \
  -H "Content-Type: application/json" \
  -d '{
    "device_code": "<device_code>",
    "grant_type": "urn:ietf:params:oauth:grant-type:device_code",
    "code": "<code>",
    "code_verifier": "<code_verifier>",
    "redirect_uri": "<redirect_uri>"
  }'
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.pollDeviceLogin("<device_code>");

List tokens

get/v1/auth/tokens

Your live tokens in this organization; ?all=1 for everyone's (owners and admins). Newest first; limit and cursor page it.

keys.manage_ownEvery memberTry it in the API Explorer

Parameters

  • allquery · "1"

    1 for everyone's tokens (owners and admins); default: yours

  • limitquery · integer

    Items per page, 1 to 500 (default 100). Without limit or cursor the answer holds the whole list.

  • cursorquery · string

    NextCursor from the previous page. A cursor whose item left the list answers 400 invalid_cursor.

Responses

200OKapplication/json

  • tokensarray of Token
    • idstringrequired
    • userIdstringrequired
    • kind"api" | "cli" | "ui"required
    • prefixstringrequired
    • labelstring
    • createdAtstring (date-time)required
    • expiresAtstring (date-time)
    • currentboolean
  • nextCursorstring

    The next page's cursor, while more items follow. Only when limit or cursor was sent.

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl "$NEXUS_URL/v1/auth/tokens" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.tokens();

Create API key

post/v1/auth/tokens

Create a personal API key for CI, scripts and the API. The key is in this answer only. A person holds at most 100 live API keys in an organization: the next is refused with 409 api_key_limit until one is revoked.

keys.manage_ownEvery memberTry it in the API Explorer

Parameters

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Request body · application/json

  • labelstringrequired

Responses

201Createdapplication/json

  • idstringrequired
  • userIdstringrequired
  • kind"api" | "cli" | "ui"required
  • prefixstringrequired
  • labelstring
  • createdAtstring (date-time)required
  • expiresAtstring (date-time)
  • currentboolean
  • tokenstring

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409api_key_limitThe next is refused with 409 `api_key_limit` until one is revoked
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl -X POST "$NEXUS_URL/v1/auth/tokens" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "CI"
  }'
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.createToken("CI");

Revoke token

DEL/v1/auth/tokens/{id}

Revoke a token: your own, or anyone's for owners and admins.

keys.manage_ownEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired
  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Responses

200OKapplication/json

object

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl -X DELETE "$NEXUS_URL/v1/auth/tokens/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.revokeToken("<token id>");

Revoke scoped key

post/v1/auth/scoped-keys/revoke

Revoke a module's scoped key (nxs_…) before it expires, without rotating NEXUS_SECRET (owners and admins). A scoped key lives one hour and stops when its person leaves the organization; this stops one key at once. Name it by its key id (scoped:<product>/<capability>/smk_…) or by its smk_… mint id; 400 invalid_scoped_key for anything else. GET /v1/spend shows the key id as keyId on each model call the key made. The audit log shows it as the actor of the key's connector writes. Gateway keeps no record of the keys it mints, so it accepts any well-formed id. A revoke does not prove that the key was live. Revoking a revoked key answers already: true and changes nothing. With dryRun: true, nothing changes. Audited as key.revoked with target type scoped_key.

keys.manage_allOwner, AdminTry it in the API Explorer

Parameters

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Request body · application/json

  • idstringrequired

    The key id (scoped:intelligence/wiki/smk_…) or the mint id (smk_…).

  • reasonstring

    Why, kept in the audit event.

  • dryRunboolean

    Check the id and change nothing.

    default false

Responses

200OKapplication/json

  • idstringrequired

    The mint id (smk_…).

  • keyIdstring

    The key id, when the request named it.

  • alreadybooleanrequired

    It was revoked before this request.

  • dryRunbooleanrequired
  • revokedAtstring (date-time) | null

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400invalid_scoped_keyName it by its key id (`scoped:<product>/<capability>/smk_…`) or by its `smk_…` mint id; 400 `invalid_scoped_key` for anything else
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl -X POST "$NEXUS_URL/v1/auth/scoped-keys/revoke" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "<id>"
  }'

Logout

post/v1/auth/logout

Revoke the calling token. An agent link may end itself whatever its grant.

keys.manage_ownEvery memberTry it in the API Explorer

Parameters

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Responses

200OKapplication/json

object

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl -X POST "$NEXUS_URL/v1/auth/logout" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.logout();

Whoami

get/v1/auth/whoami

Who the calling credential is, and nothing else: its kind, its organization's id, its person's id, an agent link's grant, and the email only for a person's own credential. Any valid credential may call it (authenticated): an agent link and an operator whatever their grant. No organization details, no other member and no role. A person's id is set for a person's own credential, for an agent link (the person it acts for) and for an operator (the operator); a service account, a module key and a sandbox have none. Not audited, as GET /v1/tenants/me is not; an operator's request is logged as operator.request.

authenticatedEvery member, module keysTry it in the API Explorer

Responses

200OKapplication/json

  • kind"person" | "agent_link" | "service_account" | "module" | "sandbox" | "operator"required

    person: a person's own API key, CLI token or Nexus UI session; agent_link: an agent link (nxo_…); service_account: nxsa_…; module: a module's scoped key; sandbox: a sandbox session's reference; operator: a Nexus operator under a grant.

  • tenantIdstringrequired

    The organization the credential acts in.

  • userIdstring

    The person: the caller's own, an agent link's person, or the operator. Absent for a service account, a module key and a sandbox.

  • emailstring

    The person's email, only for a person's own credential.

  • grantarray of string

    An agent link's granted actions (matrix names). Absent for every other kind.

  • role"owner" | "admin" | "member"

    The person's role in the organization: the caller's own, or the role of the person an agent link acts for. Absent for every other kind.

  • featuresGatewayFeatures

    The products this Gateway has on. Unset reads as all off.

    • wikibooleanrequired

      Nexus Wiki is on. Off, its routes and Ask your code answer 404 wiki_off, and clients hide them.

    • appsboolean

      Nexus Apps (NEXUS_APPS_ENABLED): nexus apps and /v1/apps. An older Gateway leaves it out: off.

    • agentSessionAuditboolean

      Coding agent sessions write agent_session.started and agent_session.ended audit events (NEXUS_AUDIT_AGENT_SESSIONS). An older Gateway leaves it out: off.

401No credential (`missing_credential`), or one Gateway does not accept: unknown, expired or revoked (`invalid_credential`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

403An operator grant that is unknown, expired, revoked or another person's (`operator_grant_invalid`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl "$NEXUS_URL/v1/auth/whoami" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Lookup device code

get/v1/auth/device/{code}

A pending nexus auth login code, before approval (Nexus UI's server only).

auth.device_approveEvery memberTry it in the API Explorer

Parameters

  • codepath · stringrequired

Responses

200OKapplication/json

object

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl "$NEXUS_URL/v1/auth/device/<code>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Approve device code

post/v1/auth/device/approve

Approve or deny a nexus auth login code for the signed-in person (Nexus UI's server only).

auth.device_approveEvery memberTry it in the API Explorer

Parameters

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Request body · application/json

  • userCodestringrequired
  • approveboolean

Responses

200OKapplication/json

  • approvedboolean

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

503`cutover_paused`: only while the operator pauses sign-in for the auth cutover; nothing changed. Retry after `Retry-After` seconds.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute
503`cutover_paused`: only while the operator pauses sign-in for the auth cutover; nothing changed. Retry after `Retry-After` seconds.

Example

curl
curl -X POST "$NEXUS_URL/v1/auth/device/approve" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "userCode": "<userCode>"
  }'

Authorize app

post/v1/auth/authorize

The phone's sign-in (Nexus UI's server only), after the person's tap, or at once for the app's claimed HTTPS redirect: a code for the signed-in person in the selected organization, bound to the app's PKCE challenge and redirect URI. Nexus UI sends it to that redirect URI; the app exchanges it on pollDeviceLogin with grant_type authorization_code within two minutes. Gateway's GET /authorize sends the app's sign-in sheet to Nexus UI's /app/device/authorize.

auth.device_approveEvery memberTry it in the API Explorer

Parameters

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Request body · application/json

  • clientstring

    The app's label, kept on its token: Nexus for iPhone.

  • codeChallengestringrequired

    BASE64URL(SHA-256(verifier)), unpadded: 43 characters (RFC 7636).

  • codeChallengeMethod"S256"required
  • redirectUri"https://nexus.inc/app/device/authorize/done" | "xyz.nexus.app:/auth"required

    The app's claimed HTTPS redirect (iOS 17.4 and later), or its private-use scheme, the reverse of nexus.xyz (RFC 8252, 7.1 and 7.2).

  • clientIdstring

    With NEXUS_OAUTH_CLIENT_TIERS=on: the OAuth client that signs in (nxc_mobile). Without one, nxc_unregistered. An unknown or revoked client is a 400 invalid_client.

Responses

200OKapplication/json

  • codestringrequired

    For the app's redirect URI only; single-use.

  • expiresInintegerrequired

    Seconds the code lives.

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

503`cutover_paused`: only while the operator pauses sign-in for the auth cutover; nothing changed. Retry after `Retry-After` seconds.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute
503`cutover_paused`: only while the operator pauses sign-in for the auth cutover; nothing changed. Retry after `Retry-After` seconds.

Example

curl
curl -X POST "$NEXUS_URL/v1/auth/authorize" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "codeChallenge": "<codeChallenge>",
    "codeChallengeMethod": "S256",
    "redirectUri": "https://nexus.inc/app/device/authorize/done"
  }'

UI session

post/v1/ui/session

Nexus UI's server: sync the signed-in person and org, and get a short-lived UI token. Authenticated by NEXUS_UI_SECRET, not a token. personal: true with only user (no org) opens the person's personal organization; every sync makes the person's personal organization if they have none. referral (a referral code, GET /v1/referrals) records who referred a person this sync creates, once; an unknown code, your own code or a person who existed before is ignored, never an error. signUp (method: google, github or email; country: a two-letter code; utmSource, utmMedium, utmCampaign; referrer: a host name) says where a person this sync creates came from, and is kept in their personal organization's org.created audit event; a value of another shape is dropped, never an error. Two bodies: the provider-neutral one names the person by user.provider and user.subject and Core's organization by org.id or org.slug (or personal: true); it makes no organization and carries no role, and a person no identity names is made only by a personal sync. The Clerk body (user.clerkUserId, org.clerkOrgId, clerkRole, creator) works until the cut-over. A body with fields of both is 400 mixed_identity_fields; a provider without a subject, or the reverse, is 400 incomplete_identity_fields; an organization the person is not a member of is 403 not_a_member.

ui.sessionNexus UI's server onlyTry it in the API Explorer

Request body · application/json

  • userobject

    The signed-in person.

    • providerstring

      The provider that signed the person in, such as google, email or clerk. The provider-neutral body only.

      max length 64

    • subjectstring

      The provider's own id for the person: Google's sub, the normalized email for an email code, the hosted provider's user id for clerk. The provider-neutral body only.

      max length 512

    • emailstring

      The person's email. In the provider-neutral body it is kept only with emailVerified: true.

    • emailVerifiedboolean

      Whether the provider verified email. The provider-neutral body only.

    • namestring
    • idpOrgstring

      The provider's organization claim, such as Google's hd. The provider-neutral body only.

    • clerkUserIdstring

      The legacy body only; deprecated, removed at the cut-over.

  • orgobject

    The organization. Leave it out with personal: true.

    • idstring

      Core's tenant id. The provider-neutral body only.

    • slugstring

      Core's slug in the provider-neutral body; the slug the sign-in provider proposes in the legacy body.

    • clerkOrgIdstring

      The legacy body only; deprecated, removed at the cut-over.

    • namestring

      The legacy body only; deprecated, removed at the cut-over.

    • imageUrlstring

      The legacy body only; deprecated, removed at the cut-over.

  • personalboolean

    Sync into the person's personal organization.

  • clerkRolestring

    The legacy body only; deprecated, removed at the cut-over.

  • creatorobject

    The legacy body only; deprecated, removed at the cut-over.

    • clerkUserIdstring
    • emailstring
    • namestring
  • tokenboolean

    false: sync only, with no token.

  • referralstring

    A referral code.

  • signUpobject

    Where a person this sync creates came from.

Responses

200OKapplication/json

object

400The request is not valid; the message names the field. A JSON body that is not an object, or a string in it that holds U+0000 (`nul_in_string`), is a 400 on every route that reads one. So is an `Idempotency-Key` that is not 1 to 255 printable ASCII characters (`invalid_idempotency_key`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

401No credential (`missing_credential`), or a credential Gateway does not accept (`invalid_credential`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

403The caller may not do this: for example, the role does not have the permission (`role_required`), or the team named is not the caller's (`not_in_team`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

408The request body stopped arriving for 30 seconds, or took longer than 10 minutes in all (`request_timeout`; `nexus` holds `gap_seconds` and `total_seconds`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

413The request body is over the operation's limit (`request_too_large`): 1,000,000 bytes, unless the operation says otherwise.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

426The `nexus` CLI that sent `x-nexus-cli-version` is older than Gateway supports (`cli_too_old`; `minimum` names the oldest it takes). A request without that header is never refused.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

503Gateway takes no new request now: it is at its limit of requests in flight (`overloaded`), or it is stopping (`draining`). Also a first sign-in (`cutover_paused`), only while the operator pauses sign-in for the auth cutover. Retry after `Retry-After` seconds.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

504The request passed Gateway's deadline, 30 seconds by default (`timeout`). Model calls that may stream are outside it.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400The request is not valid; the message names the field. A JSON body that is not an object, or a string in it that holds U+0000 (`nul_in_string`), is a 400 on every route that reads one. So is an `Idempotency-Key` that is not 1 to 255 printable ASCII characters (`invalid_idempotency_key`).
400mixed_identity_fieldsA body with fields of both is 400 `mixed_identity_fields`; a provider without a subject, or the reverse, is 400 `incomplete_identity_fields`; an organization the person is not a member of is 403 `not_a_member`
400incomplete_identity_fieldsA body with fields of both is 400 `mixed_identity_fields`; a provider without a subject, or the reverse, is 400 `incomplete_identity_fields`; an organization the person is not a member of is 403 `not_a_member`
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
403not_a_memberA body with fields of both is 400 `mixed_identity_fields`; a provider without a subject, or the reverse, is 400 `incomplete_identity_fields`; an organization the person is not a member of is 403 `not_a_member`
408The request body stopped arriving for 30 seconds, or took longer than 10 minutes in all (`request_timeout`; `nexus` holds `gap_seconds` and `total_seconds`).
413The request body is over the operation's limit (`request_too_large`): 1,000,000 bytes, unless the operation says otherwise.
426The `nexus` CLI that sent `x-nexus-cli-version` is older than Gateway supports (`cli_too_old`; `minimum` names the oldest it takes). A request without that header is never refused.
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute
503Gateway takes no new request now: it is at its limit of requests in flight (`overloaded`), or it is stopping (`draining`). Also a first sign-in (`cutover_paused`), only while the operator pauses sign-in for the auth cutover. Retry after `Retry-After` seconds.
504The request passed Gateway's deadline, 30 seconds by default (`timeout`). Model calls that may stream are outside it.

Example

curl
curl -X POST "$NEXUS_URL/v1/ui/session" \
  -H "Content-Type: application/json" \
  -d '{
    "user": {
      "provider": "anthropic",
      "subject": "<subject>",
      "email": "ada@example.com",
      "emailVerified": false,
      "name": "Platform",
      "idpOrg": "<idpOrg>",
      "clerkUserId": "<clerkUserId>"
    },
    "org": {
      "id": "<id>",
      "slug": "platform",
      "clerkOrgId": "<clerkOrgId>",
      "name": "Platform",
      "imageUrl": "<imageUrl>"
    },
    "personal": false,
    "clerkRole": "<clerkRole>",
    "creator": {
      "clerkUserId": "<clerkUserId>",
      "email": "ada@example.com",
      "name": "Platform"
    },
    "token": false,
    "referral": "<referral>",
    "signUp": {}
  }'

UI send email code

post/v1/ui/email-code

Nexus UI's server: email a Better Auth sign-in code through Core's sender. Authenticated by NEXUS_UI_SECRET and a nexus-ui-v2 signature (x-nexus-ui-signature-version: 2), required here whatever NEXUS_UI_SIGNATURE_REQUIRED says; without one, 401 ui_signature_required. A +tag alias of another mailbox (Core's canonical_email rule; Gmail's dots are no alias) is refused with 400 email_alias_refused, and a listed disposable domain with 400 disposable_email_refused: no email is sent. At most 5 codes per mailbox in 10 minutes, 10 per client address a minute and 50 per work email domain in 10 minutes: 429 too_many_codes. The code is never logged or echoed. 503 not_configured without email on Gateway.

ui.sessionNexus UI's server onlyTry it in the API Explorer

Request body · application/json

  • emailstring (email)required
  • codestringrequired

    pattern ^[A-Za-z0-9]{4,12}$

  • type"sign-in" | "email-verification" | "forget-password" | "change-email"

    Better Auth's kind of code; sign-in when absent.

Responses

200OKapplication/json

  • sentbooleanrequired

400The request is not valid; the message names the field. A JSON body that is not an object, or a string in it that holds U+0000 (`nul_in_string`), is a 400 on every route that reads one. So is an `Idempotency-Key` that is not 1 to 255 printable ASCII characters (`invalid_idempotency_key`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

401No credential (`missing_credential`), or a credential Gateway does not accept (`invalid_credential`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

503`cutover_paused`: only while the operator pauses sign-in for the auth cutover; nothing changed. Retry after `Retry-After` seconds.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400The request is not valid; the message names the field. A JSON body that is not an object, or a string in it that holds U+0000 (`nul_in_string`), is a 400 on every route that reads one. So is an `Idempotency-Key` that is not 1 to 255 printable ASCII characters (`invalid_idempotency_key`).
400email_alias_refusedA `+tag` alias of another mailbox (Core's `canonical_email` rule; Gmail's dots are no alias) is refused with 400 `email_alias_refused`, and a listed disposable domain with 400 `disposable_email_refused`: no email is sent
400disposable_email_refusedA `+tag` alias of another mailbox (Core's `canonical_email` rule; Gmail's dots are no alias) is refused with 400 `email_alias_refused`, and a listed disposable domain with 400 `disposable_email_refused`: no email is sent
401authentication_errorNo key, or a key Gateway does not accept
401ui_signature_required2`), required here whatever `NEXUS_UI_SIGNATURE_REQUIRED` says; without one, 401 `ui_signature_required`
403role_requiredYour role does not have this permission
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429too_many_codes429 `too_many_codes`
429rate_limit_errorToo many requests from this key in a minute
503`cutover_paused`: only while the operator pauses sign-in for the auth cutover; nothing changed. Retry after `Retry-After` seconds.
503not_configured503 `not_configured` without email on Gateway

Example

curl
curl -X POST "$NEXUS_URL/v1/ui/email-code" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "ada@example.com",
    "code": "<code>"
  }'

UI referral invite

get/v1/ui/referrals/{code}

Nexus UI's server: who invited a person whose sign-up carries this referral code, so the sign-up page can say so. Authenticated by NEXUS_UI_SECRET, not a token. inviter.name is the name of the person whose code it is; {} for a campaign's code, or for a person with no name. Only a code that would admit the sign-up and record its referral answers 200; any other is 404 referral_not_found: one that cannot be a code, one no one has (or whose person deleted their account), an old code anyone could guess from a name, a person's code while referrals are off, and, while sign-up is invite-only, a code with no invitation left. It never says the person's email or id, and it writes nothing.

ui.sessionNexus UI's server onlyTry it in the API Explorer

Parameters

  • codepath · stringrequired

    The referral code the sign-up link carries (/r/<code>), read as a sign-up reads it: trimmed and lowercased.

Responses

200OKapplication/json

  • inviterobject

    The person whose code it is. Absent for a campaign's code, or for a person with no name.

    • namestringrequired

      Their name as Nexus has it, trimmed.

      min length 1

401No credential (`missing_credential`), or a credential Gateway does not accept (`invalid_credential`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

403The caller may not do this: for example, the role does not have the permission (`role_required`), or the team named is not the caller's (`not_in_team`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

404The code would not admit and record a sign-up (`referral_not_found`)application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404The code would not admit and record a sign-up (`referral_not_found`)
404referral_not_foundOnly a code that would admit the sign-up and record its referral answers 200; any other is 404 `referral_not_found`: one that cannot be a code, one no one has (or whose person deleted their account), an old code anyone could guess from a name, a person's code while referrals are off, and, while sign-up is invite-only, a code with no invitation left
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl "$NEXUS_URL/v1/ui/referrals/<code>"

Desktop download access

get/v1/desktop/download-access

Authorize employee desktop downloads

org.readEvery memberTry it in the API Explorer

Responses

200Verified Nexus employeeapplication/json

  • allowedtruerequired

401Missing, expired or revoked session

403The caller is not a verified Nexus employee

503Employee verification is unavailable

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
429rate_limit_errorToo many requests from this key in a minute
503Employee verification is unavailable

Example

curl
curl "$NEXUS_URL/v1/desktop/download-access" \
  -H "Authorization: Bearer $NEXUS_API_KEY"