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

API reference

Organizations

An organization's members and roles (one owner, admins, members), ownership and budget. When the sign-in provider holds the organization, its roles change through Nexus UI, which updates the provider first.

View as Markdown

List orgs

get/v1/orgs

Your organizations: your personal organization first, then each company organization, with your role in each and which one this request is in.

org.readEvery memberTry it in the API Explorer

Responses

200OKapplication/json

  • orgsarray of OrgSummaryrequired
    • idstringrequired
    • namestringrequired
    • slugstring
    • clerkOrgIdstring

      Its sign-in provider organization's id: Nexus UI's URL segment when it has no slug

    • kind"company" | "personal"required

      A company organization, or a person's own personal organization (one per person, one member)

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

      The organization this request is in

    • imageUrlstring

      Its logo, as the tenant's imageUrl (https://img.clerk.com/…); unset when it has none.

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/orgs" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Create org

post/v1/orgs

Create a company organization that Nexus Gateway alone holds, with no sign-in provider organization behind it. You become its owner. Without a slug, the first free one made from the name is used. Only once the Gateway holds organizations; before that, 409 use_nexus_ui. Audited as org.created and member.joined.

org.createEvery 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

  • namestringrequired

    1 to 120 characters after trimming

  • slugstring

    A lowercase DNS label that is not a Nexus UI page (settings, invite, …)

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

Responses

201Createdapplication/json

  • idstringrequired
  • namestringrequired
  • slugstring
  • clerkOrgIdstring

    Its sign-in provider organization's id: Nexus UI's URL segment when it has no slug

  • kind"company" | "personal"required

    A company organization, or a person's own personal organization (one per person, one member)

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

    The organization this request is in

  • imageUrlstring

    Its logo, as the tenant's imageUrl (https://img.clerk.com/…); unset when it has none.

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.

409Another company organization has the slug (`slug_taken`), or the sign-in provider still holds the Gateway's organizations (`use_nexus_ui`)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`).
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409Another company organization has the slug (`slug_taken`), or the sign-in provider still holds the Gateway's organizations (`use_nexus_ui`)
409use_nexus_uiOnly once the Gateway holds organizations; before that, 409 `use_nexus_ui`
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/orgs" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Platform"
  }'

Org waiting counts

get/v1/orgs/waiting

Read your pending Gateway approvals and waiting cloud sessions by organization.

org.readEvery memberTry it in the API Explorer

Responses

200OKapplication/json

  • countsobjectrequired

    Counts keyed by the caller’s current organization memberships.

  • checkedAtintegerrequired

    Gateway time in milliseconds since the Unix epoch.

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/orgs/waiting" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Switch org

post/v1/orgs/switch

A new token for another of your organizations (by slug, id, or personal), of your credential's kind (cli or ui; an API key gets a cli token that is still an API key to the Gateway), and who you are there. Your current credential stays valid.

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

  • orgstringrequired

    A slug, an id, or personal

Responses

200OKapplication/json

  • tenantobjectrequired
    • idstringrequired
    • namestringrequired
    • createdAtstring (date-time)required
    • slugstring
    • kind"company" | "personal"

      A company organization, or a person's own personal organization (one per person, one member)

    • imageUrlstring

      The organization's logo, as Clerk serves it (https://img.clerk.com/…); unset when it has none.

    • mark"staff" | "test" | "demo"

      Set only when it is Nexus's own; unset for a customer's.

  • userobject

    The person calling, when the key is a person's

    • idstringrequired
    • emailstring
    • namestring
    • mark"staff" | "test" | "demo"

      Set only when it is Nexus's own; unset for a customer's.

  • teamsarray of object

    Your teams in this organization

    • idstring
    • slugstring
    • namestring
    • role"lead" | "member"

      lead is reserved for the planned team-lead role and grants nothing extra yet.

  • teamobject

    Your default team

    • idstring
    • slugstring
    • namestring
  • 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.

  • tokenstringrequired

    Nx_…: shown once

  • tokenKind"cli" | "ui"required
  • expiresAtstring (date-time)

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
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/orgs/switch" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "org": "<org>"
  }'

Delete account

post/v1/auth/account/delete

Delete your own account, from a sign-in made in the last ten minutes (not an API key; a dry run says signInNeeded when yours is older). The sign-in provider deletes your sign-in, the payment provider deletes your personal organization's customer (its plan ends at once), and Gateway takes you out of every organization, closes your personal organization and erases your email and name. Your organizations' spend and audit trail stay, under your user id. Before the customer goes, paying after the fact turns off and one charge tries your personal organization's unpaid usage on the card on file; what it does not collect is written off (unpaidUsageUsd), and its Nexus credits are lost (creditsLostUsd). Refused while you own a company organization: transfer ownership first. A deletion needs confirm: "DELETE", which the person types to confirm. dryRun checks and changes nothing.

account.deleteEvery 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 (optional) · application/json

  • dryRunboolean
  • confirm"DELETE"

    What the person typed to confirm: DELETE. A deletion without it changes nothing (400 confirmation_required); a dry run needs none.

Responses

200OKapplication/json

  • userIdstringrequired
  • dryRunbooleanrequired
  • deletedbooleanrequired

    False on a dry run; true once the account is deleted.

  • personalOrgstring

    Your personal organization's id, closed with the account; absent when you have none.

  • leftarray of objectrequired

    The company organizations you leave.

    • idstringrequired
    • namestringrequired
  • planEndedbooleanrequired

    Whether your personal organization's plan and cards at the payment provider end with it.

  • signInNeededbooleanrequired

    Whether you must sign in again first: only a sign-in from the last ten minutes deletes your account.

  • unpaidUsageUsdstring

    Your personal organization's usage that its card has not paid, as a decimal dollar string. On a dry run, what the deletion charges to the card on file first. Once deleted, what that charge did not collect, which Nexus writes off. Absent when nothing is unpaid.

  • creditsLostUsdstring

    Your personal organization's Nexus credits that the deletion loses, as a decimal dollar string. Nothing refunds them. Absent when none are left.

400The person did not type DELETE to confirm (`confirmation_required`). Nothing changed.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.

403A sign-in older than ten minutes (`recent_sign_in_required`): sign in again first. An API key, not a sign-in (`sign_in_required`), or a caller that is no person (`person_required`). Nothing changed.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 account is already deleted (`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.

409You own a company organization (`owns_organization`); `nexus.organizations` lists each one's id, name and slug. Or calls your card pays for, or a charge for your usage, are still running (`usage_settling`): paying after the fact is now off; try again in 10 minutes. Nothing else changed.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.

502Clerk did not delete your sign-in (`clerk_unavailable`), or the payment provider did not delete the customer; retry.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.

503This Gateway has no secret key for the sign-in provider, or no Stripe key while your personal organization has a customer (`not_configured`); nothing changed. Also `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 person did not type DELETE to confirm (`confirmation_required`). Nothing changed.
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404The account is already deleted (`not_found`).
409You own a company organization (`owns_organization`); `nexus.organizations` lists each one's id, name and slug. Or calls your card pays for, or a charge for your usage, are still running (`usage_settling`): paying after the fact is now off; try again in 10 minutes. Nothing else changed.
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
502Clerk did not delete your sign-in (`clerk_unavailable`), or the payment provider did not delete the customer; retry.
503This Gateway has no secret key for the sign-in provider, or no Stripe key while your personal organization has a customer (`not_configured`); nothing changed. Also `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/account/delete" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "dryRun": true,
    "confirm": "DELETE"
  }'

Set org profile

patch/v1/orgs/profile

Rename your company organization, change its slug, or remove its logo (owners and admins). A personal organization that holds the slug moves to a free one. An organization the sign-in provider made changes here only once the Gateway holds organizations; before that, 409 use_nexus_ui. Audited as org.settings_changed.

org.settingsOwner, AdminTry it in the API Explorer

Request body · application/json

  • namestring

    1 to 120 characters after trimming

  • slugstring

    A lowercase DNS label that is not a Nexus UI page

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

  • imageUrlnull

    Null removes the logo. A new logo is uploaded with setOrgLogo (POST /v1/orgs/logo)

Responses

200OKapplication/json

  • idstringrequired
  • namestringrequired
  • slugstring
  • clerkOrgIdstring

    Its sign-in provider organization's id: Nexus UI's URL segment when it has no slug

  • kind"company" | "personal"required

    A company organization, or a person's own personal organization (one per person, one member)

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

    The organization this request is in

  • imageUrlstring

    Its logo, as the tenant's imageUrl (https://img.clerk.com/…); unset when it has none.

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.

409Another company organization has the slug (`slug_taken`), a personal organization's name and slug are its person's (`personal_org`), or the sign-in provider still holds this organization (`use_nexus_ui`)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`).
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409Another company organization has the slug (`slug_taken`), a personal organization's name and slug are its person's (`personal_org`), or the sign-in provider still holds this organization (`use_nexus_ui`)
409use_nexus_uiAn organization the sign-in provider made changes here only once the Gateway holds organizations; before that, 409 `use_nexus_ui`
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 PATCH "$NEXUS_URL/v1/orgs/profile" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Platform",
    "slug": "platform"
  }'
post/v1/orgs/logo

Upload your company organization's logo (owners and admins): the body is the image's bytes, a PNG, JPEG or WebP of 1 MB at most, typed by its first bytes. The Gateway stores it in Nexus's bucket and sets the organization's imageUrl to it. Only once the Gateway holds organizations; before that, 409 use_nexus_ui. Audited as org.settings_changed.

org.settingsOwner, AdminTry it in the API Explorer

Request body · image/png

string (binary)

Responses

200OKapplication/json

  • idstringrequired
  • namestringrequired
  • slugstring
  • clerkOrgIdstring

    Its sign-in provider organization's id: Nexus UI's URL segment when it has no slug

  • kind"company" | "personal"required

    A company organization, or a person's own personal organization (one per person, one member)

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

    The organization this request is in

  • imageUrlstring

    Its logo, as the tenant's imageUrl (https://img.clerk.com/…); unset when it has none.

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.

409A personal organization has no logo to change (`personal_org`), or the Gateway does not hold organizations yet (`use_nexus_ui`)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 image is over 1 MB (`request_too_large`)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.

415The image is not a PNG, JPEG or WebP by its first bytes (`unsupported_logo_type`)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.

502The bucket refused the image (`logo_storage_failed`); nothing changedapplication/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`logo_storage_unconfigured`: the Gateway has no bucket for logos (`NEXUS_ORG_LOGO_BUCKET`). `cutover_paused`: only while the operator pauses sign-in for the auth cutover; retry after `Retry-After` seconds. Nothing changed.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`).
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409A personal organization has no logo to change (`personal_org`), or the Gateway does not hold organizations yet (`use_nexus_ui`)
409use_nexus_uiOnly once the Gateway holds organizations; before that, 409 `use_nexus_ui`
413The image is over 1 MB (`request_too_large`)
415The image is not a PNG, JPEG or WebP by its first bytes (`unsupported_logo_type`)
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
502The bucket refused the image (`logo_storage_failed`); nothing changed
503`logo_storage_unconfigured`: the Gateway has no bucket for logos (`NEXUS_ORG_LOGO_BUCKET`). `cutover_paused`: only while the operator pauses sign-in for the auth cutover; retry after `Retry-After` seconds. Nothing changed.

Example

curl
curl -X POST "$NEXUS_URL/v1/orgs/logo" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '"<value>"'

List members

get/v1/orgs/members

The organization's members and roles; spend per person for owners and admins (and each person's own). limit and cursor page it.

members.readEvery memberTry it in the API Explorer

Parameters

  • 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

  • membersarray of Member
    • userIdstringrequired
    • emailstring
    • namestring
    • role"owner" | "admin" | "member"required
    • joinedAtstring (date-time)required
    • spentUsdnumber
    • callsinteger
  • 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/orgs/members" \
  -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.members();

List presence

get/v1/presence

Every member of the organization and whether they are online (seen in the last two minutes), online ones first (every role: members.read; a signed-in member only). lastSeenAt is set only while a member is online; a member who turned off showing reads offline to everyone else. You are always online to yourself. showOnline is your own setting. Each online member's activity says what they are doing, as you may see it.

members.readEvery memberTry it in the API Explorer

Responses

200OKapplication/json

  • membersarray of PresenceMemberrequired
    • userIdstringrequired
    • namestring | nullrequired
    • emailstring | nullrequired
    • role"owner" | "admin" | "member"required
    • onlinebooleanrequired

      Seen within the online window. You are always online to yourself.

    • lastSeenAtstring (date-time) | nullrequired

      The last heartbeat, only while it is within the online window.

    • activityPresenceActivity | nullrequired

      What they are doing, while online; null otherwise.

  • onlineWindowSecondsintegerrequired

    How long after a heartbeat a member still counts as online.

  • showOnlinebooleanrequired

    Your own setting.

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

Example

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

Presence heartbeat

post/v1/presence

Your heartbeat while Nexus UI is open and visible, about every 30 seconds (every role: members.read; a signed-in member only, 403 role_required otherwise). You count as online for two minutes after it. Gateway stores at most one every 20 seconds, and none while you turned off showing when you are online. It may carry what you are doing (activity): chatting, a page by id, or idle. A change of activity is stored at once. Answers your setting.

members.readEvery memberTry it in the API Explorer

Request body (optional) · application/json

  • activityReportedActivity

    What Nexus UI reports with a heartbeat. Coarse on purpose: no chat title, no path, no repository. Gateway keeps a page's id only when you may open the page and reads its title itself. agents is taken as idle: Gateway counts running agents from agent sessions.

    • kind"chatting" | "page" | "agents" | "idle"required
    • pageIdstring

      Required with page.

Responses

200OKapplication/json

  • showOnlinebooleanrequired

    Whether others see when you are online. On by default.

400Not a known activity (`invalid_activity`)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
400Not a known activity (`invalid_activity`)
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

Example

curl
curl -X POST "$NEXUS_URL/v1/presence" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "activity": {
      "kind": "chatting"
    }
  }'

Get presence settings

get/v1/presence/settings

Whether you show when you are online (every role: members.read; a signed-in member only). On unless you turned it off.

members.readEvery memberTry it in the API Explorer

Responses

200OKapplication/json

  • showOnlinebooleanrequired

    Whether others see when you are online. On by default.

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

Example

curl
curl "$NEXUS_URL/v1/presence/settings" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Set presence settings

put/v1/presence/settings

Choose whether you show when you are online (every role: members.read; a signed-in member only). Off, Gateway forgets your last heartbeat and stores none, so you read offline to everyone else at once; you still see yourself online.

members.readEvery memberTry it in the API Explorer

Request body · application/json

  • showOnlinebooleanrequired

    Whether others see when you are online. On by default.

Responses

200OKapplication/json

  • showOnlinebooleanrequired

    Whether others see when you are online. On by default.

400Not `{ "showOnline": bool }` (`invalid_setting`)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
400Not `{ "showOnline": bool }` (`invalid_setting`)
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

Example

curl
curl -X PUT "$NEXUS_URL/v1/presence/settings" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "showOnline": false
  }'

Set member role

post/v1/orgs/members/{userId}/role

Make a member an admin or a member (owners and admins). The owner's role changes only by transfer.

members.manageOwner, AdminTry it in the API Explorer

Parameters

  • userIdpath · stringrequired
  • Idempotency-Keyheader · string

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

Request body · application/json

  • role"admin" | "member"required

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.

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
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
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/orgs/members/user_123/role" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "admin"
  }'
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.setMemberRole("<user id>", "admin");

Remove member

DEL/v1/orgs/members/{userId}

Remove a member (owners and admins). The membership is flagged, not deleted, so an owner or admin can recover them for 30 days; their tokens and keys are revoked at once. The owner must transfer ownership first.

members.manageOwner, AdminTry it in the API Explorer

Parameters

  • userIdpath · stringrequired
  • Idempotency-Keyheader · string

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

Responses

200OKapplication/json

object

404No such member (`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.

409They are the owner (`owner_role`): transfer ownership first. Or a token removes its own person (`self_removal`).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.

502A token's removal: Clerk did not take them out of its organization (`clerk_unavailable`); nothing changed.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.

503A token's removal: the organization signs in with the sign-in provider and this Gateway has no secret key for it (`not_configured`); nothing changed. Also `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
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
404No such member (`not_found`).
409They are the owner (`owner_role`): transfer ownership first. Or a token removes its own person (`self_removal`).
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
502A token's removal: Clerk did not take them out of its organization (`clerk_unavailable`); nothing changed.
503A token's removal: the organization signs in with the sign-in provider and this Gateway has no secret key for it (`not_configured`); nothing changed. Also `cutover_paused`, only while the operator pauses sign-in for the auth cutover; nothing changed. Retry after `Retry-After` seconds.

Example

curl
curl -X DELETE "$NEXUS_URL/v1/orgs/members/user_123" \
  -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.removeMember("<user id>");

List removed members

get/v1/orgs/members/removed

Removed members (owners and admins), newest removal first, each with the end of its 30-day recovery window.

members.manageOwner, AdminTry it in the API Explorer

Responses

200OKapplication/json

  • membersarray of RemovedMemberrequired
    • userIdstringrequired
    • emailstring
    • namestring
    • role"owner" | "admin" | "member"required
    • removedAtstring (date-time)required
    • removedBystring

      The user id who removed them; absent when the sign-in provider did.

    • recoverableUntilstring (date-time)required
    • recoverablebooleanrequired

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/orgs/members/removed" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Recover member

post/v1/orgs/members/{userId}/recover

Recover a removed member inside the 30-day window (owners and admins): their role, teams, default team and person spend limit come back; their tokens and keys do not. In an org that signs in with Clerk, Gateway adds them back to the Clerk organization. dryRun checks and changes nothing. A 409 removal_final after the window; 503 not_configured without CLERK_SECRET_KEY on Gateway, in an org that signs in with Clerk.

members.manageOwner, AdminTry it in the API Explorer

Parameters

  • userIdpath · stringrequired
  • Idempotency-Keyheader · string

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

Request body (optional) · application/json

  • dryRunboolean

Responses

200OKapplication/json

  • userIdstringrequired
  • emailstring
  • role"owner" | "admin" | "member"required
  • teamsarray of stringrequired

    The slugs of the teams they come back to.

  • dryRunbooleanrequired
  • recoveredbooleanrequired

404No such member (`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.

409They are a member (`not_removed`), or the 30-day window ended (`removal_final`).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.

502Clerk did not add them back to its organization (`clerk_unavailable`); nothing changed.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.

503The organization signs in with the sign-in provider and this Gateway has no secret key for it (`not_configured`); nothing changed. Also `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
404not_foundNothing matches the path in your organization
404No such member (`not_found`).
409They are a member (`not_removed`), or the 30-day window ended (`removal_final`).
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
502Clerk did not add them back to its organization (`clerk_unavailable`); nothing changed.
503The organization signs in with the sign-in provider and this Gateway has no secret key for it (`not_configured`); nothing changed. Also `cutover_paused`, only while the operator pauses sign-in for the auth cutover; nothing changed. Retry after `Retry-After` seconds.
503not_configuredA 409 removal_final after the window; 503 `not_configured` without CLERK_SECRET_KEY on Gateway, in an org that signs in with Clerk

Example

curl
curl -X POST "$NEXUS_URL/v1/orgs/members/user_123/recover" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "dryRun": true
  }'

List invitations

get/v1/orgs/invitations

The organization's pending invitations, oldest first, expired ones included (owners and admins). Only once Core holds organizations (NEXUS_ORG_OWNER=core); before that, 409 use_nexus_ui.

members.inviteOwner, AdminTry it in the API Explorer

Responses

200OKapplication/json

  • invitationsarray of objectrequired
    • idstringrequired
    • emailstringrequired
    • role"member" | "admin"required
    • invitedBystring | null

      The person who invited them, when a person did.

    • createdAtstring (date-time)required
    • expiresAtstring (date-time)required
    • sentAtstring (date-time) | null

      The last send.

    • expiredbooleanrequired

      Past expiresAt: its link no longer works; resend 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).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
409use_nexus_uiOnly once Core holds organizations (`NEXUS_ORG_OWNER=core`); before that, 409 `use_nexus_ui`
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/orgs/invitations" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Invite members

post/v1/orgs/invitations

Invite people to the organization (owners and admins); Clerk emails each invitation. Name emails, or pending: true for everyone in a team by email who has not joined. Emails already in the organization or already invited are skipped. dryRun sends nothing. Sending more than one needs expect, the number you confirmed (409 count_changed if it differs). 501 without CLERK_SECRET_KEY on Gateway (dry runs still work, checking Gateway only). Once Core holds organizations (NEXUS_ORG_OWNER=core), Core writes each invitation and emails its one-time link itself; an expired invitation of the email is sent again.

members.inviteOwner, 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

  • emailsarray of string (email)

    at most 500 items

  • pendingboolean

    Everyone with a pending team membership.

  • role"member" | "admin"

    default "member"

  • dryRunboolean

    default false

  • expectinteger

    Required to send more than one invitation: how many you confirmed.

Responses

200OKapplication/json

  • dryRunbooleanrequired
  • role"member" | "admin"required
  • checkedClerkbooleanrequired

    False on a dry run without CLERK_SECRET_KEY: only Gateway's members were checked.

  • toSendintegerrequired

    Invitations sent, or in a dry run, that would be.

  • resultsarray of objectrequired
    • emailstringrequired
    • status"would_invite" | "sent" | "already_member" | "not_signed_in" | "already_invited" | "removed" | "failed"required
    • invitationIdstring
    • messagestring

      The sign-in provider's message when it failed.

  • countsobjectrequired

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
409count_changedSending more than one needs `expect`, the number you confirmed (409 `count_changed` if it differs)
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/orgs/invitations" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "pending": true,
    "dryRun": true
  }'
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.invite({ pending: true, dryRun: true });

Revoke invitation

DEL/v1/orgs/invitations/{id}

Revoke a pending invitation (owners and admins), so its link stops working. While the sign-in provider holds organizations the id is the provider's and the provider cancels it; once Core holds them (NEXUS_ORG_OWNER=core) the id is Core's. Audited as invitation.revoked.

members.inviteOwner, AdminTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The invitation's id: the sign-in provider's while it holds organizations, else Core's from GET /v1/orgs/invitations.

  • Idempotency-Keyheader · string

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

Responses

200OKapplication/json

  • revokedbooleanrequired

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
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
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 DELETE "$NEXUS_URL/v1/orgs/invitations/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

Resend invitation

post/v1/orgs/invitations/{id}/resend

Email a pending invitation again with a new link and a new expiry, 7 days from now; the old link stops working (owners and admins). At most once per 10 minutes per invitation: 429 resend_too_soon. Only once Core holds organizations; before that, 409 use_nexus_ui. Audited as invitation.sent with via: resend.

members.inviteOwner, AdminTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The invitation's id, from GET /v1/orgs/invitations.

  • Idempotency-Keyheader · string

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

Responses

200OKapplication/json

  • emailstringrequired
  • statusstringrequired
  • invitationIdstring | null
  • messagestring | 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.

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
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
409use_nexus_uiOnly once Core holds organizations; before that, 409 `use_nexus_ui`
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).
429resend_too_soon429 `resend_too_soon`
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/orgs/invitations/<id>/resend" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

List my invitations

get/v1/orgs/invitations/mine

Your own pending invitations, across organizations, oldest first: those sent to an email one of your sign-ins verified. An unverified email matches none. Expired invitations and organizations you are already in are left out. Accept one with POST /v1/orgs/invitations/accept and its id. Only once Core holds organizations (NEXUS_ORG_OWNER=core); before that, 409 use_nexus_ui. A person only (403 person_required).

authenticatedEvery member, module keysTry it in the API Explorer

Responses

200OKapplication/json

  • invitationsarray of objectrequired
    • idstringrequired

      Accept it with this id.

    • emailstringrequired

      Your email it was sent to.

    • orgNamestringrequired
    • orgSlugstring | null
    • role"member" | "admin"required
    • invitedBystring | null

      The inviter's name, else their email; null when no person invited you or that person is gone.

    • expiresAtstring (date-time)required

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
403person_requiredA person only (403 `person_required`)
409use_nexus_uiOnly once Core holds organizations (`NEXUS_ORG_OWNER=core`); before that, 409 `use_nexus_ui`
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/orgs/invitations/mine" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Accept invitation

post/v1/orgs/invitations/accept

Accept an invitation: you join its organization with its role. Name the token in its link or the id from GET /v1/orgs/invitations/mine: exactly one. A body with neither or both is 400 invalid_request. For a token, Nexus UI's server must vouch that you verified the invited email (403 email_mismatch). For an id, one of your sign-ins must have verified the invited email; any other id is a 404. A used, revoked or replaced link is a 404; an expired invitation is 409 invitation_expired. Only once Core holds organizations; before that, 409 use_nexus_ui. Audited as member.joined with via: invitation.

authenticatedEvery member, module keysTry 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

object | object

Responses

200OKapplication/json

  • idstringrequired
  • namestringrequired
  • slugstring
  • clerkOrgIdstring

    Its sign-in provider organization's id: Nexus UI's URL segment when it has no slug

  • kind"company" | "personal"required

    A company organization, or a person's own personal organization (one per person, one member)

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

    The organization this request is in

  • imageUrlstring

    Its logo, as the tenant's imageUrl (https://img.clerk.com/…); unset when it has none.

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
400invalid_requestA body with neither or both is 400 `invalid_request`
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
403email_mismatchFor a token, Nexus UI's server must vouch that you verified the invited email (403 `email_mismatch`)
409invitation_expiredA used, revoked or replaced link is a 404; an expired invitation is 409 `invitation_expired`
409use_nexus_uiOnly once Core holds organizations; before that, 409 `use_nexus_ui`
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/orgs/invitations/accept" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "<token>"
  }'

List org domains

get/v1/orgs/domains

The organization's verified email domains (owners and admins). While Clerk holds organizations (the default), they are Clerk's, from its Enhanced B2B add-on: people with a verified email on a domain join through Clerk as its enrollmentMode says; 409 not_a_clerk_org for an organization that does not sign in with Clerk; 503 not_configured without CLERK_SECRET_KEY on Gateway. Once Core holds organizations (NEXUS_ORG_OWNER=core), they are the domains a Nexus operator assigned: each one's id is the domain, its enrollmentMode is automatic_suggestion, and a person whose Google sign-in is on it sees the organization in listDomainSuggestions. 409 personal_org for a personal organization.

members.inviteOwner, AdminTry it in the API Explorer

Responses

200OKapplication/json

  • domainsarray of OrgDomainrequired
    • idstringrequired

      The sign-in provider's domain id.

    • domainstringrequired
    • enrollmentMode"automatic_invitation" | "automatic_suggestion" | "manual_invitation" | "enterprise_sso"required
    • verifiedbooleanrequired
    • pendingInvitationsintegerrequired

      Invitations the sign-in provider sent on this domain that nobody accepted yet.

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
409not_a_clerk_orgPeople with a verified email on a domain join through Clerk as its `enrollmentMode` says; 409 `not_a_clerk_org` for an organization that does not sign in with Clerk; 503 `not_configured` without CLERK_SECRET_KEY on Gateway
409personal_org409 `personal_org` for a personal 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
503not_configuredPeople with a verified email on a domain join through Clerk as its `enrollmentMode` says; 409 `not_a_clerk_org` for an organization that does not sign in with Clerk; 503 `not_configured` without CLERK_SECRET_KEY on Gateway

Example

curl
curl "$NEXUS_URL/v1/orgs/domains" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Add org domain

post/v1/orgs/domains

Add a verified email domain (owners and admins). While Clerk holds organizations: you must have a verified email on it in Clerk (403 domain_not_yours), so an admin cannot add another company's domain and pull its people into their organization; a public mail provider such as gmail.com is refused (400 public_mail_domain), and so is a personal organization (409 personal_org). Clerk's refusal, such as a domain another organization has, is a 409 clerk_refused with Clerk's message. Audited as domain.added. Once Core holds organizations (NEXUS_ORG_OWNER=core), a Nexus operator assigns domains after a review, so this is 409 operator_assigns_domains (400 public_mail_domain for a public mail provider's).

members.inviteOwner, 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

  • domainstringrequired

    A host name, as acme.com.

  • enrollmentMode"automatic_invitation" | "automatic_suggestion" | "manual_invitation"

    Automatic_invitation: the sign-in provider invites everyone with a verified email on the domain. automatic_suggestion: the provider suggests the organization and an admin accepts each request. manual_invitation: nobody joins without an invitation.

    default "automatic_invitation"

Responses

200OKapplication/json

  • idstringrequired

    The sign-in provider's domain id.

  • domainstringrequired
  • enrollmentMode"automatic_invitation" | "automatic_suggestion" | "manual_invitation" | "enterprise_sso"required
  • verifiedbooleanrequired
  • pendingInvitationsintegerrequired

    Invitations the sign-in provider sent on this domain that nobody accepted yet.

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
400public_mail_domainYou must have a verified email on it in Clerk (403 `domain_not_yours`), so an admin cannot add another company's domain and pull its people into their organization; a public mail provider such as gmail.com is refused (400 `public_mail_domain`), and so is a personal organization (409 `personal_org`)
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
403domain_not_yoursYou must have a verified email on it in Clerk (403 `domain_not_yours`), so an admin cannot add another company's domain and pull its people into their organization; a public mail provider such as gmail.com is refused (400 `public_mail_domain`), and so is a personal organization (409 `personal_org`)
409personal_orgYou must have a verified email on it in Clerk (403 `domain_not_yours`), so an admin cannot add another company's domain and pull its people into their organization; a public mail provider such as gmail.com is refused (400 `public_mail_domain`), and so is a personal organization (409 `personal_org`)
409clerk_refusedClerk's refusal, such as a domain another organization has, is a 409 `clerk_refused` with Clerk's message
409operator_assigns_domainsOnce Core holds organizations (NEXUS_ORG_OWNER=core), a Nexus operator assigns domains after a review, so this is 409 `operator_assigns_domains` (400 `public_mail_domain` for a public mail provider's)
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/orgs/domains" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "<domain>"
  }'

Remove org domain

DEL/v1/orgs/domains/{id}

Remove a verified email domain by its id from listOrgDomains (owners and admins). New people stop joining by it; who already joined stays. Another organization's domain is a 404. Audited as domain.removed.

members.inviteOwner, AdminTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The domain's id, from listOrgDomains: the sign-in provider's id, or the domain itself once Core holds organizations.

  • Idempotency-Keyheader · string

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

Responses

200OKapplication/json

  • removedbooleanrequired

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
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
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 DELETE "$NEXUS_URL/v1/orgs/domains/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

List domain suggestions

get/v1/orgs/domain-suggestions

The company organizations you may join by domain, with the domain of each. A suggestion needs your own Google sign-in: its hd is a domain a Nexus operator assigned to the organization, and Google verified your email on that domain. An email-code sign-in, an unverified email or the email on your account never counts. An organization you belong to, or were removed from, is left out. Only once Core holds organizations (NEXUS_ORG_OWNER=core); before that, 409 use_nexus_ui.

authenticatedEvery member, module keysTry it in the API Explorer

Responses

200OKapplication/json

  • suggestionsarray of DomainSuggestionrequired
    • domainstringrequired

      The domain, lower-case.

    • orgOrgSummaryrequired

      The organization; no role or current, since the person is not a member yet.

      • idstringrequired
      • namestringrequired
      • slugstring
      • clerkOrgIdstring

        Its sign-in provider organization's id: Nexus UI's URL segment when it has no slug

      • kind"company" | "personal"required

        A company organization, or a person's own personal organization (one per person, one member)

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

        The organization this request is in

      • imageUrlstring

        Its logo, as the tenant's imageUrl (https://img.clerk.com/…); unset when it has none.

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
409use_nexus_uiOnly once Core holds organizations (NEXUS_ORG_OWNER=core); before that, 409 `use_nexus_ui`
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/orgs/domain-suggestions" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Join by domain

post/v1/orgs/domain-suggestions/join

Join an organization of listDomainSuggestions: you become a member, never an admin. 404 no_domain_match when none of your Google sign-ins is on a domain of that organization; the answer does not say whether it exists. 409 member_removed while an admin's removal of you can still be undone. A member already keeps their role. Only once Core holds organizations; before that, 409 use_nexus_ui. Audited as member.joined with via: domain.

authenticatedEvery member, module keysTry 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

  • orgstringrequired

    The organization's id, from listDomainSuggestions.

Responses

200OKapplication/json

  • idstringrequired
  • namestringrequired
  • slugstring
  • clerkOrgIdstring

    Its sign-in provider organization's id: Nexus UI's URL segment when it has no slug

  • kind"company" | "personal"required

    A company organization, or a person's own personal organization (one per person, one member)

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

    The organization this request is in

  • imageUrlstring

    Its logo, as the tenant's imageUrl (https://img.clerk.com/…); unset when it has none.

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
404no_domain_match404 `no_domain_match` when none of your Google sign-ins is on a domain of that organization; the answer does not say whether it exists
409member_removed409 `member_removed` while an admin's removal of you can still be undone
409use_nexus_uiOnly once Core holds organizations; before that, 409 `use_nexus_ui`
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/orgs/domain-suggestions/join" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "org": "<org>"
  }'

Transfer ownership

post/v1/orgs/owner

Transfer ownership to another member (the owner only); the previous owner becomes an admin.

Parameters

  • Idempotency-Keyheader · string

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

Request body · application/json

  • userIdstringrequired

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.

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/orgs/owner" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "user_123"
  }'
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.transferOwnership("<user id>");

Set budget

post/v1/orgs/budget

Set the organization's budget in USD, a cap per UTC day, ISO week or calendar month (owners and admins); never below what the period spent and what is reserved.

budgets.manageOwner, 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

  • budgetUsdnumber | string

    The organization's budget per period in US dollars: a JSON number (deprecated) or a decimal string with at most 6 decimals ("12.245"), read exactly. Send budgetUsdDecimal instead to send only a string.

  • budgetUsdDecimalstring

    The organization's budget per period as a decimal string in US dollars, at most 6 decimals, never below 0; read exactly into micro-dollars, never through a float. With budgetUsd too, both must name the same amount (400 amount_mismatch).

    pattern ^[0-9]+(\.[0-9]{1,6})?$

  • period"day" | "week" | "month"

    The cap's period. Absent keeps the current one, a month unless set

  • dryRunboolean

    Make the same checks and write nothing; the answer is { dryRun, before, after }, each { budgetUsd, budgetUsdDecimal, period }

Responses

200OKapplication/json

object | object

400`budgetUsd` and `budgetUsdDecimal` both missing, `dryRun` not true or false (`invalid_request`), a decimal string with more than 6 decimals (`too_many_decimals`), an amount that is not one or is below 0 (`invalid_amount`), or a number and its `Decimal` twin that name different amounts (`amount_mismatch`), or a period other than day, week or month (`invalid_period`)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.

403Only owners and admins set the organization's budget (`role_required`): a member without `budgets.manage`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.

409The new budget is below what the period has already spent and reserved (`conflict`)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
400invalid_request_errorA field is missing or not valid; the message names it
400`budgetUsd` and `budgetUsdDecimal` both missing, `dryRun` not true or false (`invalid_request`), a decimal string with more than 6 decimals (`too_many_decimals`), an amount that is not one or is below 0 (`invalid_amount`), or a number and its `Decimal` twin that name different amounts (`amount_mismatch`), or a period other than day, week or month (`invalid_period`)
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409The new budget is below what the period has already spent and reserved (`conflict`)
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/orgs/budget" \
  -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.setBudget(100);

Export directory CSV

get/v1/orgs/directory/export.csv

Every person and team of the organization with its name: the one file that maps ids to names, as CSV (owners and admins). The people are its members and the people its calls and kept agent sessions name (former members too), then its teams and the teams those name, each by id. Names are read when the file is asked for. An erased person reads erased: true with no name; a person with no record reads with no name, and a deleted team with its id alone. It takes no parameter and has no row limit, range or cursor. The data files name people and teams by id only. Each request is an audit event (observability.directory_exported) with the file's manifest, never its rows, and counts toward the 60 exports an hour.

spend.exportOwner, AdminTry it in the API Explorer

Responses

200CSV with a header row: one column per field of `DirectoryEntry`, in its order.text/csv

string

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/orgs/directory/export.csv" \
  -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.directoryExport("csv");

Export directory JSON Lines

get/v1/orgs/directory/export.jsonl

Every person and team of the organization with its name: the one file that maps ids to names, as JSON Lines (owners and admins). The people are its members and the people its calls and kept agent sessions name (former members too), then its teams and the teams those name, each by id. Names are read when the file is asked for. An erased person reads erased: true with no name; a person with no record reads with no name, and a deleted team with its id alone. It takes no parameter and has no row limit, range or cursor. The data files name people and teams by id only. Each request is an audit event (observability.directory_exported) with the file's manifest, never its rows, and counts toward the 60 exports an hour.

spend.exportOwner, AdminTry it in the API Explorer

Responses

200JSON Lines: one `DirectoryEntry` per line, then one line `{"manifest": ExportManifest}`.application/jsonl

string

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/orgs/directory/export.jsonl" \
  -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.directoryExport("jsonl");

Clerk webhook

post/v1/clerk/webhook

Clerk's webhook, signed by Svix with CLERK_WEBHOOK_SECRET (svix-id, svix-timestamp and svix-signature; refused more than five minutes from now). For organizationMembership.created, .updated and .deleted, and user.deleted, Gateway reads the membership or the person from Clerk again and makes its copy match: a member Clerk no longer has loses their membership, teams and tokens (member.removed, via: clerk; the owner loses only the tokens), and a role Clerk changed is mirrored. For organization.updated, Gateway reads the organization from Clerk again and mirrors its name, slug and logo as a sign-in does (org.settings_changed, actor clerk; a logo not on img.clerk.com is dropped); an organization Gateway does not have is ignored. A repeated or late event changes nothing. 401 for a bad signature; 503 not_configured without CLERK_WEBHOOK_SECRET or CLERK_SECRET_KEY; 502 when Clerk does not answer, so Svix retries.

publicAnyone, signed in or notTry it in the API Explorer

Responses

200OKapplication/json

  • okbooleanrequired
  • eventstringrequired
  • changedintegerrequired

    How many memberships changed.

Errors

StatusCodeWhen
503not_configured401 for a bad signature; 503 `not_configured` without CLERK_WEBHOOK_SECRET or CLERK_SECRET_KEY; 502 when Clerk does not answer, so Svix retries

Example

curl
curl -X POST "$NEXUS_URL/v1/clerk/webhook"

Get billing

get/v1/billing

The organization's billing (owner only): the Stripe mode of this Gateway, whether the organization has a Stripe customer yet, its payment method on file (defaultPaymentMethod, of any type; paymentMethod only when it is a card), how it pays for what Nexus runs (pricing v2.0: freeStart, credits and autoTopup, afterTheFact; plan where this Gateway sells plans), the numbers a page shows (pricing), and pastDue. pastDue is null, or names the oldest month Stripe could not collect: when it first failed (since), its period, and when model calls stop (blockedFrom, since plus NEXUS_BILLING_GRACE_DAYS, 7 days by default). From blockedFrom until an owner pays, every model call is refused with 402 payment_past_due. Never Stripe's customer id or the card number. A customer made in the other mode (test or live) is not shown. 503 not_configured until STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET are both set and well formed (the message says which is wrong).

Responses

200OKapplication/json

  • sharedPaymentTokensboolean

    True when this Gateway supports delegated Stripe shared payment tokens on credit purchases. Currently enabled only in Stripe test mode; live mode returns false. Check before submitting a token.

  • mode"test" | "live"required

    The mode of Gateway's Stripe key.

  • customerobject | nullrequired

    Null until the first card setup starts.

    • state"creating" | "ready"required

      creating: Gateway started the Stripe customer and the first setup has not finished. ready: the customer exists.

  • paymentMethodCardSummary | nullrequired

    The payment method on file when it is a card. Null when there is none, or when it is not a card: read defaultPaymentMethod for any type.

  • defaultPaymentMethodPaymentMethodSummary | nullrequired

    The payment method on file, of any type: the one credits, auto top-ups and charges for usage after the fact are charged to. Null until one is saved.

  • creditsNexusCredits | null

    The organization's prepaid Nexus credits; null before it buys any.

  • autoTopupAutoTopup | null

    The organization's auto top-up of Nexus credits; null before an owner sets it.

  • planAllowanceobject

    The current plan's monthly allowances. Absent when no allowance is available.

    • resetAtstring (date-time)required

      Start of the next usage month in UTC.

    • aiobject | nullrequired

      AI allowance in decimal USD, counting settled usage. Null until the allowance is granted.

      • includedUsdstringrequired
      • usedUsdstringrequired
      • leftUsdstringrequired
    • cloudobject | nullrequired

      Cloud allowance in default-size hours. Null when plan cloud metering is unavailable.

      • includedHoursnumberrequired
      • usedHoursnumberrequired
      • leftHoursnumberrequired
  • pastDueobject | nullrequired

    Null while no month of this mode is unpaid after Stripe tried to collect it. Otherwise the oldest such month.

    • sincestring (date-time)required

      When the month first failed.

    • periodstringrequired

      The unpaid month, YYYY-MM.

      pattern ^[0-9]{4}-(0[1-9]|1[0-2])$

    • blockedFromstring (date-time) | nullrequired

      since plus the grace (NEXUS_BILLING_GRACE_DAYS). From then on model calls are refused with 402 payment_past_due. Null when this Gateway has no gate, so nothing is refused.

    • invoiceUrlstring (uri) | nullrequired

      Stripe's page that pays the unpaid month (its hosted invoice). Null when Stripe gave none.

  • pricingChangeobject | null

    A change to Nexus pricing and the Customer Terms (NEXUS_PRICING_CHANGE), until 30 days past the day it takes effect. Each organization created before that day is told once by billing.pricing_change. Null, or absent from an older Gateway, when there is none.

    • effectiveOnstring (date)required

      The day the change takes effect, at 00:00 UTC: YYYY-MM-DD.

  • planBillingPlan | null

    The organization's plan; null on the Free plan

  • freeStartobject | null

    The organization's free start (pricing v2.0): what Nexus gave it once, and what is left. Null when it got none.

    • grantedUsdstringrequired

      What Nexus gave, a decimal dollar string.

    • remainingUsdstringrequired

      What is left, never below zero.

    • expiresAtstring (date-time) | null

      When the free start expires, or expired: 30 days after its grant. Null when the organization's subsidy holds no free start.

    • expiredUsdstring | null

      What was left of the free start when it expired, a decimal dollar string. Null before it expires.

  • afterTheFactAfterTheFact | null

    How the organization pays after the fact (pricing v2.0); null before an owner turns it on.

  • pricingobjectrequired

    The numbers a billing page shows, so no client writes a price of its own. Decimal dollar strings.

    • markupBpsintegerrequired

      Nexus's rate on AI it runs past the free start and a plan's allowance, in basis points: 500 is provider price + 5%. App hosting and cloud machines have their own prices.

    • minPurchaseUsdstringrequired

      The least one credit purchase buys.

    • thresholdUsdstringrequired

      Paying after the fact, the card is charged each time the unpaid usage reaches this.

    • defaultLimitUsdstringrequired

      The monthly usage limit a new after-the-fact setting starts at.

    • maxLimitUsdstringrequired

      The most a usage limit may be now for this organization: $100 in its first week, then $100,000. A higher limitUsd answers 400 invalid_amount.

    • freeStartMaxOutputUsdstring

      The free start pays only for a model whose cheapest host charges at most this per million output tokens.

    • minFinalChargeUsdstring

      Minimum final charge when pay after the fact turns off.

  • promotionalCreditUsdstring

    Available referral and promotional credit, excluding the welcome free start.

403Not the owner (`permission_error`)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.

503Stripe is not configured (`not_configured`): the message says which variable is wrongapplication/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
402payment_past_dueFrom `blockedFrom` until an owner pays, every model call is refused with 402 `payment_past_due`
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
503Stripe is not configured (`not_configured`): the message says which variable is wrong
503not_configured503 `not_configured` until STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET are both set and well formed (the message says which is wrong)

Example

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

Get billing statement

get/v1/billing/statement

The organization's bill for one UTC month (owner only). A month the close stored answers from the stored row, as it closed, and invoice shows its Stripe invoice. Any other month is priced now, from the ledger and the prices Gateway has: NEXUS_PRICE_GATEWAY_CALL_MICROS and NEXUS_PRICE_GATEWAY_COST_BPS. Both are 0 until a price is set, so the total reads 0. It counts the calls on the organization's own provider keys. Refused calls and calls a Nexus subsidy paid are left out. Money is a decimal string. The bill is the total in whole cents, rounded down, as a string. carriedInUsd is the rest of the newest stored month before this one. carriedOutUsd is the part below one cent, and it carries into the next month. A month under 50 cents is not invoiced: all of its total carries. providerCostUsd is what the providers charged. They bill it, not Nexus. The stored months are the ones of Gateway's Stripe key mode. Without Stripe nothing is stored, so every month is priced now. The route reads no Stripe, so it answers with Stripe off. 400 for a period that is not YYYY-MM or has not started.

Parameters

  • periodquery · string

    YYYY-MM from 1970-01 to 9998-12, a UTC month that has started; default the current month

Responses

200OKapplication/json

  • periodstringrequired

    The month, as YYYY-MM.

    pattern ^[0-9]{4}-(0[1-9]|1[0-2])$

  • linesarray of BillingStatementLinerequired

    Every charge. Both lines are always there, with amount 0 until a price is set.

    • code"gateway.calls" | "gateway.provider_cost" | "gateway.nexus_usage"required

      gateway.calls: the calls on the organization's own keys. gateway.provider_cost: Nexus's fee on what the providers charged for them. gateway.nexus_usage: a contract's calls on Nexus-supplied keys, at provider price plus Nexus's rate; only on a month that has some.

    • unit"call" | "usd"required
    • quantitystringrequired

      Unit call: a whole number of calls. Unit usd: a decimal dollar amount.

    • rateUsdstring

      Unit call only: the price of one call.

      pattern ^[0-9]+\.[0-9]{6}$

    • rateBpsinteger

      Unit usd only: basis points of quantity (100 is 1%).

      min 0 · max 10000

    • amountUsdstringrequired

      quantity times the rate, rounded down to a micro-dollar.

      pattern ^[0-9]+\.[0-9]{6}$

  • providerCostUsdstringrequired

    What the providers charged for the calls on the organization's own keys. The providers bill it, not Nexus.

    pattern ^[0-9]+\.[0-9]{6}$

  • carriedInUsdstringrequired

    The rest of the month before: the part of its total that no invoice took.

    pattern ^[0-9]+\.[0-9]{6}$

  • totalUsdstringrequired

    The lines and carriedInUsd added.

    pattern ^[0-9]+\.[0-9]{6}$

  • amountCentsstringrequired

    What to charge: totalUsd in whole cents, rounded down. A whole number as a string. A month under 50 cents is not invoiced.

    pattern ^[0-9]+$

  • carriedOutUsdstringrequired

    What moves to the next month: the part of totalUsd below one cent. A month under 50 cents is not invoiced, so all of its total moves.

    pattern ^[0-9]+\.[0-9]{6}$

  • invoiceBillingInvoice | nullrequired

    The Stripe invoice of a stored month. Null for a month that is priced now, and for a stored month under 50 cents, which is not invoiced.

400Not a month as YYYY-MM, or a month that has not started (`invalid_request_error`)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.

403Not the owner (`permission_error`)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
400invalid_request_errorA field is missing or not valid; the message names it
400Not a month as YYYY-MM, or a month that has not started (`invalid_request_error`)
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/billing/statement" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

List billing statements

get/v1/billing/statements

The months the close stored for the organization (owner only), in the mode of Gateway's Stripe key, newest first, at most 24. Each month shows its total, its whole cents, its state and its Stripe invoice page. A closed month is under 50 cents: nothing was invoiced and its total carries into the next month. Money is a decimal string. The route reads no Stripe. 503 not_configured until STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET are both set and well formed (the message says which is wrong).

Responses

200OKapplication/json

  • statementsarray of BillingStatementSummaryrequired

    The stored months, newest first, at most 24.

    • periodstringrequired

      The month, as YYYY-MM.

      pattern ^[0-9]{4}-(0[1-9]|1[0-2])$

    • totalUsdstringrequired

      The lines and the rest carried in, added.

      pattern ^[0-9]+\.[0-9]{6}$

    • amountCentsstringrequired

      What the statement priced: totalUsd in whole cents, rounded down. A whole number as a string. A closed month invoices none of it.

      pattern ^[0-9]+$

    • state"closed" | "invoicing" | "invoiced" | "paid" | "failed" | "void" | "uncollectible"required

      closed: under 50 cents, so nothing was invoiced and the total carries into the next month. The other states are the ones of the invoice.

    • hostedInvoiceUrlstring | nullrequired

      Stripe's page for the invoice. Null for a closed month, and until Stripe has finalized the invoice.

403Not the owner (`permission_error`)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.

503Stripe is not configured (`not_configured`): the message says which variable is wrongapplication/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
503Stripe is not configured (`not_configured`): the message says which variable is wrong
503not_configured503 `not_configured` until STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET are both set and well formed (the message says which is wrong)

Example

curl
curl "$NEXUS_URL/v1/billing/statements" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Start payment method setup

post/v1/billing/payment-method

Start saving a card for the organization (owner only): a link to a card page hosted by Stripe Checkout. Open url in a browser before expiresAt. Stripe sends the person back to the organization's billing page in Nexus UI (<NEXUS_UI_URL>/<org>/billing?checkout=done or =cancelled). Gateway makes the organization's Stripe customer on the first call and reuses it after; each call makes a new link. Takes no body, or {"embedded": true}: the same card setup as a form Nexus UI shows inside its billing page. With STRIPE_PUBLISHABLE_KEY on Gateway, that answer is EmbeddedCardSetup (Stripe.js's clientSecret and the publishableKey, no url), and Stripe sends the page to ?checkout=done once the card is saved; without it, the hosted link as without the body. 400 when embedded is not a boolean. Audited as billing.customer_created when the customer is made, and as billing.customer_deleted when Stripe no longer has it; neither event names Stripe's customer id. 502 stripe_error when Stripe refuses or does not answer (the message names Stripe's type and code). 503 not_configured until Stripe is set up, or without NEXUS_UI_URL on Gateway; 503 billing_setup_in_progress while a first call for the organization is still running (try again in a moment).

Parameters

  • Idempotency-Keyheader · string

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

Request body (optional) · application/json

  • embeddedboolean

    Ask for the card form inside Nexus UI's billing page instead of Stripe's own page. Gateway answers the hosted link when it has no publishable key.

Responses

200OKapplication/json

PaymentMethodSetup | EmbeddedCardSetup

400`embedded` is not a boolean (`invalid_request`)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.

403Not the owner (`permission_error`)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.

502Stripe refused the call or did not answer (`stripe_error`)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.

503Stripe is not configured, NEXUS_UI_URL is not set (`not_configured`), or a first call for this organization is still running (`billing_setup_in_progress`)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
400`embedded` is not a boolean (`invalid_request`)
400embedded400 when `embedded` is not a boolean
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
502Stripe refused the call or did not answer (`stripe_error`)
502stripe_error502 `stripe_error` when Stripe refuses or does not answer (the message names Stripe's type and code)
503Stripe is not configured, NEXUS_UI_URL is not set (`not_configured`), or a first call for this organization is still running (`billing_setup_in_progress`)
503not_configured503 `not_configured` until Stripe is set up, or without NEXUS_UI_URL on Gateway; 503 `billing_setup_in_progress` while a first call for the organization is still running (try again in a moment)
503billing_setup_in_progress503 `not_configured` until Stripe is set up, or without NEXUS_UI_URL on Gateway; 503 `billing_setup_in_progress` while a first call for the organization is still running (try again in a moment)

Example

curl
curl -X POST "$NEXUS_URL/v1/billing/payment-method" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "embedded": false
  }'

Confirm payment

post/v1/billing/confirm-payment

Confirm a payment the bank wants the cardholder to confirm (3-D Secure), owner only. Off session, Stripe refuses such a charge with authentication_required and keeps its PaymentIntent; this confirms that same usage charge after the fact again on session; one the bank's page never finished is cancelled at Stripe an hour later. An auto top-up that turned off for the bank's check is fixed by saving the card again (startPaymentMethodSetup). status redirect: open url, the bank's page, which sends the person back to the organization's billing page in Nexus UI (<NEXUS_UI_URL>/<org>/billing?confirmed=1). succeeded or processing: Stripe took it, or a bank debit is on its way. Stripe's notice records the payment as for any charge; nothing is charged twice. Takes no body. 409 nothing_to_confirm when no charge waits for the bank's check (save the card again with startPaymentMethodSetup), charge_running while a usage charge is being taken. 402 when the card is declined on session.

Parameters

  • Idempotency-Keyheader · string

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

Responses

200OKapplication/json

  • status"redirect" | "succeeded" | "processing"required

    redirect: open url. succeeded: Stripe took the payment. processing: a bank debit is on its way.

  • urlstring (uri) | nullrequired

    The bank's page while it waits for the cardholder; null otherwise

402The card was declined on session (`stripe_error`)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.

403Not the owner (`permission_error`)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.

409No charge waits for the bank's check (`nothing_to_confirm`), or a usage charge is being taken now (`charge_running`)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.

502Stripe refused the call or did not answer (`stripe_error`)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.

503Stripe is not configured, or NEXUS_UI_URL is not set (`not_configured`)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
402budget_exceededThe card was declined on session (`stripe_error`)
403role_requiredYour role does not have this permission
409No charge waits for the bank's check (`nothing_to_confirm`), or a usage charge is being taken now (`charge_running`)
409nothing_to_confirm409 `nothing_to_confirm` when no charge waits for the bank's check (save the card again with startPaymentMethodSetup), `charge_running` while a usage charge is being taken
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
502Stripe refused the call or did not answer (`stripe_error`)
503Stripe is not configured, or NEXUS_UI_URL is not set (`not_configured`)

Example

curl
curl -X POST "$NEXUS_URL/v1/billing/confirm-payment" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

Start billing portal

post/v1/billing/portal

Open the organization's Stripe customer portal (owner only): a link to a page hosted by Stripe where the owner manages payment methods, sees and pays invoices, sets tax ids and cancels at period end. Plans and seats change through Gateway, not the portal. Open url in a browser at once: Stripe's link expires within minutes. Stripe sends the person back to the organization's billing page in Nexus UI (<NEXUS_UI_URL>/<org>/billing). Gateway makes the organization's Stripe customer on the first call and reuses it after; each call makes a new link. Takes no body. The Stripe account needs a default portal configuration. 502 stripe_error when Stripe refuses or does not answer (the message names Stripe's type and code). 503 not_configured until Stripe is set up, or without NEXUS_UI_URL on Gateway; 503 billing_setup_in_progress while a first call for the organization is still running (try again in a moment).

Parameters

  • Idempotency-Keyheader · string

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

Responses

200OKapplication/json

  • urlstringrequired

    Stripe's customer portal for the organization. Open it at once: it expires within minutes.

403Not the owner (`permission_error`)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.

502Stripe refused the call or did not answer (`stripe_error`)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.

503Stripe is not configured, NEXUS_UI_URL is not set (`not_configured`), or a first call for this organization is still running (`billing_setup_in_progress`)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
502Stripe refused the call or did not answer (`stripe_error`)
502stripe_error502 `stripe_error` when Stripe refuses or does not answer (the message names Stripe's type and code)
503Stripe is not configured, NEXUS_UI_URL is not set (`not_configured`), or a first call for this organization is still running (`billing_setup_in_progress`)
503not_configured503 `not_configured` until Stripe is set up, or without NEXUS_UI_URL on Gateway; 503 `billing_setup_in_progress` while a first call for the organization is still running (try again in a moment)
503billing_setup_in_progress503 `not_configured` until Stripe is set up, or without NEXUS_UI_URL on Gateway; 503 `billing_setup_in_progress` while a first call for the organization is still running (try again in a moment)

Example

curl
curl -X POST "$NEXUS_URL/v1/billing/portal" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

Buy credits

post/v1/billing/credits

Buy Nexus credits (owner only): the organization's own money, prepaid at face value and never expiring, spent by Nexus features after the free start and a plan's included usage at provider price plus Nexus's rate. Body: amountUsd, a decimal string in whole cents, from "10.00" to "10000.00"; a new organization buys at most $100 in its first 7 days, counting the purchases still being paid, such as an open Checkout page until it expires (400 purchase_limit). With a payment method on file, Gateway charges it off session: status: credited with the credits after, or processing for a bank debit still on its way (Stripe's notice credits it). Without one, or when the bank wants the person (3-D Secure) or the card declines, status: checkout with a Stripe Checkout url to open before expiresAt; Stripe sends the person back to <NEXUS_UI_URL>/<org>/billing?checkout=credits. A payment credits once, from Stripe's payment_intent.succeeded, and only to the organization whose Stripe customer paid. The Idempotency-Key header keys the Stripe call, so a retry never charges twice. Audited as credit.purchased. 400 invalid_amount; 502 stripe_error; 503 not_configured until Stripe is set up, or without NEXUS_UI_URL for a hosted purchase. With paymentToken, charge the agent wallet shared payment token directly in Stripe test mode. Live mode returns 503 payment_tokens_not_supported before contacting Stripe. There is no hosted fallback. 400 invalid_payment_token rejects a malformed credential, or one Stripe has deactivated (used, revoked or expired); 402 payment_authentication_required requires the cardholder. The same Idempotency-Key and body replay the first result.

Parameters

  • Idempotency-Keyheader · string

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

Request body · application/json

  • paymentTokenstring

    Optional Stripe shared payment token from an agent wallet, scoped to Nexus, USD, the purchase amount and an expiry. Currently accepted only in Stripe test mode. Confirms without a saved card, NEXUS_UI_URL or Checkout. Never accepts card details or merchant API keys. Does not save a card or enable recurring charges.

    max length 255 · pattern ^spt_[A-Za-z0-9_]+$

  • amountUsdstringrequired

    Dollars in whole cents, such as "50.00": from 10.00 to 10000.00.

Responses

200OKapplication/json

  • status"credited" | "processing" | "checkout"required

    credited: charged and credited now; processing: Stripe is still taking a bank debit, and its notice credits it; checkout: open url to pay.

  • amountUsdstringrequired

    What the purchase buys, in decimal dollars.

  • creditsNexusCredits

    The organization's prepaid Nexus credits, its own money, never expiring. A Nexus feature's call spends them after the free start, at its provider cost plus markupBps. Decimal dollar strings.

    • purchasedUsdstringrequired

      Bought, over all time.

    • spentUsdstringrequired

      What settled calls cost the credits: each call's provider cost plus markupBps.

    • reservedUsdstringrequired

      Held by calls in progress.

    • remainingUsdstringrequired

      Bought, less spent, held and reversed. Below zero after a refund or a lost dispute took back credit that was already spent: then Nexus pays for no call (the free start, credits or the card after the fact) until a purchase pays it back.

    • reversedUsdstring

      What refunds, lost disputes and operators took back, and what an open dispute holds of its purchase until it closes. A refund that fails gives its credit back. Only while something is taken back.

    • markupBpsintegerrequired

      Nexus's rate on AI in basis points (500 is 5%).

  • paymentIdstring

    Stripe's PaymentIntent, while processing.

  • urlstring

    Stripe Checkout's page, for checkout.

  • expiresAtstring (date-time)

    When Stripe stops accepting url.

  • checkoutSessionIdstring

    Exact Checkout session to confirm; returned by current Gateways.

400An amount outside $25 to $10,000 or not in whole cents (`invalid_amount`), or past a new organization's limit (`purchase_limit`)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.

402The delegated payment requires cardholder authentication or was not completed (payment_authentication_required, payment_declined, payment_failed).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.

403Only the owner buys credits (`role_required`)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.

502Stripe refused the call or did not answer (`stripe_error`)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.

503Delegated payment tokens are disabled in live mode (`payment_tokens_not_supported`), Stripe is not configured, NEXUS_UI_URL is not set for a hosted purchase (`not_configured`), or a first call for this organization is still running (`billing_setup_in_progress`)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
400An amount outside $25 to $10,000 or not in whole cents (`invalid_amount`), or past a new organization's limit (`purchase_limit`)
400purchase_limit`amountUsd`, a decimal string in whole cents, from "10.00" to "10000.00"; a new organization buys at most $100 in its first 7 days, counting the purchases still being paid, such as an open Checkout page until it expires (400 `purchase_limit`)
400invalid_amount400 `invalid_amount`; 502 `stripe_error`; 503 `not_configured` until Stripe is set up, or without NEXUS_UI_URL for a hosted purchase
401authentication_errorNo key, or a key Gateway does not accept
402budget_exceededThe delegated payment requires cardholder authentication or was not completed (payment_authentication_required, payment_declined, payment_failed).
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
502Stripe refused the call or did not answer (`stripe_error`)
502stripe_error400 `invalid_amount`; 502 `stripe_error`; 503 `not_configured` until Stripe is set up, or without NEXUS_UI_URL for a hosted purchase
503Delegated payment tokens are disabled in live mode (`payment_tokens_not_supported`), Stripe is not configured, NEXUS_UI_URL is not set for a hosted purchase (`not_configured`), or a first call for this organization is still running (`billing_setup_in_progress`)
503not_configured400 `invalid_amount`; 502 `stripe_error`; 503 `not_configured` until Stripe is set up, or without NEXUS_UI_URL for a hosted purchase

Example

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

Set auto topup

put/v1/billing/auto-topup

Turn the organization's auto top-up of Nexus credits on or off (owner only). Body: enabled, and belowUsd and addUsd as decimal strings in whole cents (or the ones set before). On needs the payment method on file (409 no_payment_method), and not a card whose payment was disputed (409 card_disputed). A closed organization cannot turn it on (409 organization_closed). When the credits left fall below belowUsd, Gateway's Stripe sweep (NEXUS_STRIPE_SWEEP_MS) charges that payment method addUsd off session and credits it, one top-up at a time, at most 3 top-ups or $500 a UTC day. A decline, a bank that wants the person, no payment method, a bank debit that fails later (payment_intent.payment_failed), a dispute, or a refund that takes the credits below zero turns it off, and offReason says why. Off keeps the amounts; turning off what was never set answers autoTopup: null. Audited as credit.auto_topup_changed. 400 invalid_amount; 503 not_configured until Stripe is set up.

Parameters

  • Idempotency-Keyheader · string

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

Request body · application/json

  • enabledbooleanrequired
  • belowUsdstring

    Dollars in whole cents, above 0.00 and at most 10000.00. Needed to turn on the first time.

  • addUsdstring

    Dollars in whole cents, from 10.00 to 500.00. Needed to turn on the first time.

Responses

200OKapplication/json

  • autoTopupAutoTopup | nullrequired

    The setting after; null after turning off what was never set.

400`belowUsd` not above $0 or above $10,000, or `addUsd` outside $25 to $500 or not in whole cents (`invalid_amount`); `enabled` missing; or turning on without both amountsapplication/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.

403Not the owner (`permission_error`)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.

409Turning on with no payment method on file (`no_payment_method`)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.

503Stripe is not configured (`not_configured`)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
400`belowUsd` not above $0 or above $10,000, or `addUsd` outside $25 to $500 or not in whole cents (`invalid_amount`); `enabled` missing; or turning on without both amounts
400invalid_amount400 `invalid_amount`; 503 `not_configured` until Stripe is set up
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409Turning on with no payment method on file (`no_payment_method`)
409no_payment_methodOn needs the payment method on file (409 `no_payment_method`), and not a card whose payment was disputed (409 `card_disputed`)
409card_disputedOn needs the payment method on file (409 `no_payment_method`), and not a card whose payment was disputed (409 `card_disputed`)
409organization_closedA closed organization cannot turn it on (409 `organization_closed`)
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
503Stripe is not configured (`not_configured`)
503not_configured400 `invalid_amount`; 503 `not_configured` until Stripe is set up

Example

curl
curl -X PUT "$NEXUS_URL/v1/billing/auto-topup" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": false
  }'

Get org settings

get/v1/orgs/settings

The organization's settings: how many days chat messages are kept (90 by default).

org.readEvery memberTry it in the API Explorer

Responses

200OKapplication/json

  • hiddenMobilePlacesarray of "assistant" | "artifacts" | "customize"

    Places hidden from members in the mobile drawer. The owner still sees them.

  • chatRetentionDaysintegerrequired

    Days chat messages are kept (90 by default)

    min 1 · max 3650

  • agentSubscriptionsboolean

    Whether nexus claude --subscription may run (true by default)

  • growthEventsboolean

    Whether the Gateway records the organization's growth events in its own store (true by default)

  • chatSuggestionsboolean

    Whether chat sessions suggest the person's next message after an answer, a call the organization pays for (true by default)

  • defaultsobjectrequired
    • hiddenMobilePlacesarray of "assistant" | "artifacts" | "customize"

      default []

    • chatRetentionDaysinteger
    • growthEventsboolean
    • chatSuggestionsboolean
    • artifacts.external"off" | "named" | "public"
    • artifacts.external.codeboolean
    • artifacts.external.domainsobject
      • allowarray of stringrequired
      • denyarray of stringrequired
    • artifacts.external.expiryobject
      • maxDaysinteger | nullrequired

        min 1 · max 3650

      • requiredbooleanrequired
    • artifacts.external.continueboolean
    • artifacts.external.who"everyone" | "admins"
    • agentSubscriptionsboolean
    • artifacts.pagesboolean
    • artifacts.pages.publicboolean
    • artifacts.pages.queriesboolean
    • webSearch.engine"off" | "borrowed"
    • webSearch.modelstring | null
    • webSearch.domainsobject
      • allowarray of stringrequired
      • denyarray of stringrequired
    • webSearch.maxPerTurninteger
    • webSearch.requireZdrboolean
    • sessionContent"never" | "user" | "user_and_org"
    • multiplayerSessionsboolean
    • cloudHistoryboolean
    • webSessionViewerboolean
  • updatedAtstring (date-time)
  • artifacts.external"off" | "named" | "public"

    Sharing artifacts outside the organization: off, named people only, or also public links (default public)

  • artifacts.external.codeboolean

    May external snapshots include Ask your code's sources (default false)

  • artifacts.external.domainsobject

    Email domains named outsiders may (allow, when set) or may not (deny) have; a domain matches itself and its subdomains (default both empty)

    • allowarray of stringrequired
    • denyarray of stringrequired
  • artifacts.external.expiryobject

    The longest a public link may stay open, and whether every public link must expire (default none and false)

    • maxDaysinteger | nullrequired

      min 1 · max 3650

    • requiredbooleanrequired
  • artifacts.external.continueboolean

    May people outside continue the chat in an organization of their own, at its expense (default true)

  • artifacts.external.who"everyone" | "admins"

    Who may share outside: everyone, or owners and admins (default everyone)

  • artifacts.pagesboolean

    Pages: off refuses new pages, versions, shares and every page frame (default true)

  • artifacts.pages.publicboolean

    Public links to pages: off refuses new ones and stops existing ones from opening (default false in a company organization, true in a personal one)

  • artifacts.pages.queriesboolean

    Page queries (Nexus Data): on lets a page's owner approve read-only queries on a connection, whose results the page's readers see; off refuses saving and running them (default false)

  • webSearch.engine"off" | "borrowed"

    Gates hosted web search in chat and in Code (nexus claude --api, nexus codex --api): off or borrowed (default borrowed; off means no web search runs)

  • webSearch.modelstring | null

    The model that runs a chat's search: null for the default (the chat's own model, the cheapest on nexus/auto), cheapest, or a model's catalog id. A pinned model the person may not use, or nobody pays for, gives that person no search, and so does an id this Gateway cannot call, which is shown as stored. Chat only

  • webSearch.domainsobject

    Domains a search result may (allow, when set) or may not (deny) come from (default both empty). While any is set, no web search runs, in chat or in Code, until the engine applies them

    • allowarray of stringrequired
    • denyarray of stringrequired
  • webSearch.maxPerTurninteger

    Most searches in one chat turn (default 3). Applies to Gateway-run engines (chat) only

    min 1 · max 10

  • webSearch.requireZdrboolean

    Whether only engines with zero data retention may run (default false). While set, no web search runs, in chat or in Code, until the engine applies it

  • sessionContent"never" | "user" | "user_and_org"

    The content policy for synced sessions that runners follow, readable by every member. The default is user in every organization; only a saved user_and_org applies, and it reads as user while the organization has no recovery key (getOrgRecoveryKey)

  • multiplayerSessionsboolean

    Whether members read each other's team-visible synced sessions, still end-to-end encrypted. False by default; always false in a personal one

  • cloudHistoryboolean

    Whether Gateway stores the organization's cloud session history, so a sleeping cloud session reads on any device. True by default. Off, Gateway stores none. Omitted for an organization that cannot run cloud machines and stores no cloud history

  • webSessionViewerboolean

    Whether Nexus UI in a browser opens the organization's synced sessions. True by default. Off, Nexus UI's credential (its session token or its server's secret) gets 403 web_session_viewer_off for sealed events, key copies and a new device

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/orgs/settings" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Set org settings

put/v1/orgs/settings

Change the organization's settings (owners and admins). chatRetentionDays: 1 to 3650, or null for the default; a shorter window deletes expired messages at once. Audited as org.settings_changed.

org.settingsOwner, 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

  • hiddenMobilePlacesarray of "assistant" | "artifacts" | "customize" | null

    Places an owner hides from members in the mobile drawer. Only an owner can change this setting. Null makes all places visible.

  • chatRetentionDaysinteger | null

    min 1 · max 3650

  • agentSubscriptionsboolean | null

    Whether nexus claude --subscription may run (people's own Claude logins, outside Gateway's checks); null for the default, true

  • growthEventsboolean | null

    Whether the Gateway records the organization's growth events in its own store; null for the default, true. No safety control depends on it

  • chatSuggestionsboolean | null

    Whether chat sessions suggest the person's next message after an answer, a call the organization pays for; null for the default, true

  • webSearch.engine"off" | "borrowed" | null

    Gates hosted web search in chat and in Code (nexus claude --api, nexus codex --api): off or borrowed; null for the default, borrowed. An unknown engine is a 400 that names the allowed values

  • webSearch.modelstring | null

    The model that runs a chat's search, whatever the chat's model is: cheapest, or the catalog id of a model that can search (GET /v1/models lists it with web_search_usd); null or default for the default, the chat's own model (the cheapest on nexus/auto). It is stored as the model's catalog id. Chat only: in Code an agent searches on its own model. Anything else is a 400 that lists the models

  • webSearch.domainsobject | null

    Domains a search result may (allow, when set) or may not (deny) come from; null for the default, both empty. While any is set, no web search runs, in chat or in Code, until the engine applies them

    • allowarray of string
    • denyarray of string
  • webSearch.maxPerTurninteger | null

    Most searches in one chat turn; null for the default, 3. Applies to Gateway-run engines (chat) only

    min 1 · max 10

  • webSearch.requireZdrboolean | null

    Whether only engines with zero data retention may run; null for the default, false. While set, no web search runs, in chat or in Code, until the engine applies it

  • artifacts.external"off" | "named" | "public" | null

    Sharing an artifact outside the organization: off, named (named people by verified email) or public (also anyone with an unguessable link); null for the default, public. Another value is a 400

  • artifacts.external.codeboolean | null

    Whether an artifact shared outside the organization may include Ask your code's sources; null for the default, false

  • artifacts.external.domainsobject | null

    Email domains a named share outside the organization may (allow, when set) or may not (deny) go to; null for the default, both empty

    • allowarray of string
    • denyarray of string
  • artifacts.external.expiryobject | null

    Limits on how long a public link stays open: maxDays (1-3650, or null for no limit) and whether an expiry is required; null for the default, no limit and not required

    • maxDaysinteger | null

      min 1 · max 3650

    • requiredboolean
  • artifacts.external.continueboolean | null

    Whether people outside the organization may continue or remix what it shares; null for the default, true

  • artifacts.external.who"everyone" | "admins" | null

    Who may share outside the organization: everyone or admins; null for the default, everyone

  • artifacts.pagesboolean | null

    Pages on or off; null for the default, true

  • artifacts.pages.publicboolean | null

    Public links to pages; null for the default (false in a company organization, true in a personal one)

  • artifacts.pages.queriesboolean | null

    Page queries (Nexus Data): a page's owner may approve read-only queries on a connection for its readers; null for the default, false

  • sessionContent"never" | "user" | "user_and_org" | null

    What leaves a person's machine when coding sessions sync, end-to-end encrypted: never (only usage numbers), user (only the person's own devices can read it) or user_and_org (also the organization's recovery key); null for the default. Needs synced_sessions.manage_policy. user_and_org answers 409 org_recovery_key_required until the organization registers a recovery key (putOrgRecoveryKey)

  • multiplayerSessionsboolean | null

    Whether members read each other's team-visible synced sessions; null for the default, false. A personal organization answers 403 personal_organization

  • cloudHistoryboolean | null

    Whether Gateway stores the organization's cloud session history, readable by Nexus's systems and encrypted at rest; null for the default, true. Off, Gateway stores none and deletes what it holds

  • webSessionViewerboolean | null

    Whether Nexus UI in a browser opens the organization's synced sessions; null for the default, true. Needs synced_sessions.manage_policy. Off, Nexus UI's credential gets 403 web_session_viewer_off for sealed events, key copies and a new device; the desktop, the phone and the CLI read as before

Responses

200OKapplication/json

  • hiddenMobilePlacesarray of "assistant" | "artifacts" | "customize"

    Places hidden from members in the mobile drawer. The owner still sees them.

  • chatRetentionDaysintegerrequired

    Days chat messages are kept (90 by default)

    min 1 · max 3650

  • agentSubscriptionsboolean

    Whether nexus claude --subscription may run (true by default)

  • growthEventsboolean

    Whether the Gateway records the organization's growth events in its own store (true by default)

  • chatSuggestionsboolean

    Whether chat sessions suggest the person's next message after an answer, a call the organization pays for (true by default)

  • defaultsobjectrequired
    • hiddenMobilePlacesarray of "assistant" | "artifacts" | "customize"

      default []

    • chatRetentionDaysinteger
    • growthEventsboolean
    • chatSuggestionsboolean
    • artifacts.external"off" | "named" | "public"
    • artifacts.external.codeboolean
    • artifacts.external.domainsobject
      • allowarray of stringrequired
      • denyarray of stringrequired
    • artifacts.external.expiryobject
      • maxDaysinteger | nullrequired

        min 1 · max 3650

      • requiredbooleanrequired
    • artifacts.external.continueboolean
    • artifacts.external.who"everyone" | "admins"
    • agentSubscriptionsboolean
    • artifacts.pagesboolean
    • artifacts.pages.publicboolean
    • artifacts.pages.queriesboolean
    • webSearch.engine"off" | "borrowed"
    • webSearch.modelstring | null
    • webSearch.domainsobject
      • allowarray of stringrequired
      • denyarray of stringrequired
    • webSearch.maxPerTurninteger
    • webSearch.requireZdrboolean
    • sessionContent"never" | "user" | "user_and_org"
    • multiplayerSessionsboolean
    • cloudHistoryboolean
    • webSessionViewerboolean
  • updatedAtstring (date-time)
  • artifacts.external"off" | "named" | "public"

    Sharing artifacts outside the organization: off, named people only, or also public links (default public)

  • artifacts.external.codeboolean

    May external snapshots include Ask your code's sources (default false)

  • artifacts.external.domainsobject

    Email domains named outsiders may (allow, when set) or may not (deny) have; a domain matches itself and its subdomains (default both empty)

    • allowarray of stringrequired
    • denyarray of stringrequired
  • artifacts.external.expiryobject

    The longest a public link may stay open, and whether every public link must expire (default none and false)

    • maxDaysinteger | nullrequired

      min 1 · max 3650

    • requiredbooleanrequired
  • artifacts.external.continueboolean

    May people outside continue the chat in an organization of their own, at its expense (default true)

  • artifacts.external.who"everyone" | "admins"

    Who may share outside: everyone, or owners and admins (default everyone)

  • artifacts.pagesboolean

    Pages: off refuses new pages, versions, shares and every page frame (default true)

  • artifacts.pages.publicboolean

    Public links to pages: off refuses new ones and stops existing ones from opening (default false in a company organization, true in a personal one)

  • artifacts.pages.queriesboolean

    Page queries (Nexus Data): on lets a page's owner approve read-only queries on a connection, whose results the page's readers see; off refuses saving and running them (default false)

  • webSearch.engine"off" | "borrowed"

    Gates hosted web search in chat and in Code (nexus claude --api, nexus codex --api): off or borrowed (default borrowed; off means no web search runs)

  • webSearch.modelstring | null

    The model that runs a chat's search: null for the default (the chat's own model, the cheapest on nexus/auto), cheapest, or a model's catalog id. A pinned model the person may not use, or nobody pays for, gives that person no search, and so does an id this Gateway cannot call, which is shown as stored. Chat only

  • webSearch.domainsobject

    Domains a search result may (allow, when set) or may not (deny) come from (default both empty). While any is set, no web search runs, in chat or in Code, until the engine applies them

    • allowarray of stringrequired
    • denyarray of stringrequired
  • webSearch.maxPerTurninteger

    Most searches in one chat turn (default 3). Applies to Gateway-run engines (chat) only

    min 1 · max 10

  • webSearch.requireZdrboolean

    Whether only engines with zero data retention may run (default false). While set, no web search runs, in chat or in Code, until the engine applies it

  • sessionContent"never" | "user" | "user_and_org"

    The content policy for synced sessions that runners follow, readable by every member. The default is user in every organization; only a saved user_and_org applies, and it reads as user while the organization has no recovery key (getOrgRecoveryKey)

  • multiplayerSessionsboolean

    Whether members read each other's team-visible synced sessions, still end-to-end encrypted. False by default; always false in a personal one

  • cloudHistoryboolean

    Whether Gateway stores the organization's cloud session history, so a sleeping cloud session reads on any device. True by default. Off, Gateway stores none. Omitted for an organization that cannot run cloud machines and stores no cloud history

  • webSessionViewerboolean

    Whether Nexus UI in a browser opens the organization's synced sessions. True by default. Off, Nexus UI's credential (its session token or its server's secret) gets 403 web_session_viewer_off for sealed events, key copies and a new device

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
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 PUT "$NEXUS_URL/v1/orgs/settings" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "hiddenMobilePlaces": [
      "assistant"
    ],
    "chatRetentionDays": 1,
    "agentSubscriptions": false,
    "growthEvents": false,
    "chatSuggestions": false,
    "webSearch.engine": "off",
    "webSearch.model": "<webSearch.model>",
    "webSearch.domains": {
      "allow": [
        "<allow>"
      ],
      "deny": [
        "<deny>"
      ]
    },
    "webSearch.maxPerTurn": 1,
    "webSearch.requireZdr": false,
    "artifacts.external": "off",
    "artifacts.external.code": false,
    "artifacts.external.domains": {
      "allow": [
        "<allow>"
      ],
      "deny": [
        "<deny>"
      ]
    },
    "artifacts.external.expiry": {
      "maxDays": 1,
      "required": false
    },
    "artifacts.external.continue": false,
    "artifacts.external.who": "everyone",
    "artifacts.pages": false,
    "artifacts.pages.public": false,
    "artifacts.pages.queries": false,
    "sessionContent": "never",
    "multiplayerSessions": false,
    "cloudHistory": false,
    "webSessionViewer": false
  }'

Get effective settings

get/v1/orgs/effective-settings

Every control in the control inventory, as far as the caller reaches: owners and admins every control, a team lead the controls of the teams they lead, everyone their own values and those of their teams and the organization. An entry also keeps its own route's permission: a control the caller may not read there (the automatic top-up without org.billing) carries the refusal. An entry whose source was not read carries an error, and the answer stays 200.

org.readEvery memberTry it in the API Explorer

Responses

200OKapplication/json

  • controlsarray of EffectiveSettingrequired
    • keystringrequired

      The control's key in the inventory (controls.json).

    • capabilitystringrequired
    • valueany

      The control's value, when its source was read: any JSON value. A model policy control maps each level that stores a rule (organization:organization, team:<slug>, agent:<name>) to the rule it stores. A level without a rule inherits the rule above it, so one level's entry is not, on its own, the rule enforced there.

    • errorstring

      Set only when the control's value was not read. Tell a read value from an unread one by this field, not by value: a read value can be 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
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/orgs/effective-settings" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Get custody report

get/v1/orgs/custody

The vault's custody report for the organization (owners and admins): which master key wraps its data keys and who holds that master (Nexus's NEXUS_SECRET, a Cloud KMS key in Nexus's project, or one in the customer's own project, which the customer can revoke); every version of its data key; and every secret or reference the vault holds, with its table, its data key version and its last four characters. It never holds a secret or a data key.

audit.read_allOwner, AdminTry it in the API Explorer

Responses

200OKapplication/json

  • masterCustodyMasterrequired
    • holder"nexus_secret" | "nexus_kms" | "customer_kms"required

      nexus_secret: derived from Nexus's NEXUS_SECRET. nexus_kms: a Cloud KMS key in Nexus's project. customer_kms: a Cloud KMS key in the customer's own project; the customer can revoke Nexus's access.

    • keystring

      The customer's Cloud KMS key's resource name; absent when Nexus holds the master.

  • dataKeysarray of CustodyDataKeyrequired
    • versionintegerrequired
    • masterCustodyMasterrequired
      • holder"nexus_secret" | "nexus_kms" | "customer_kms"required

        nexus_secret: derived from Nexus's NEXUS_SECRET. nexus_kms: a Cloud KMS key in Nexus's project. customer_kms: a Cloud KMS key in the customer's own project; the customer can revoke Nexus's access.

      • keystring

        The customer's Cloud KMS key's resource name; absent when Nexus holds the master.

    • createdAtstring (date-time)required
  • holdingsarray of CustodyHoldingrequired
    • kind"provider_key" | "connector_credential"required
    • namestringrequired

      The provider (anthropic, or anthropic:team:team_… for a team's key), or the connector and its scope (linear:user:usr_…).

    • tablestringrequired

      The table that stores it.

    • sealedWith"data_key" | "nexus_secret" | "reference"required

      data_key: the organization's data key of version keyVersion. nexus_secret: a key derived from NEXUS_SECRET, sealed before data keys. reference: no secret is held, only a reference to a vendor's short-lived token.

    • keyVersioninteger
    • last4string
    • createdAtstring (date-time)required

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/orgs/custody" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Get org subscription

get/v1/orgs/subscription

The organization's subscription (anyone in it): the plan, the member who pays, the member who receives billing mail, the paid term, the status and the seats (one per human member). An organization nobody changed yet reads as active since it was created, with everything else null and updatedAt: null.

org.readEvery memberTry it in the API Explorer

Responses

200OKapplication/json

  • planstring | nullrequired

    Written by Billing: an entry of Billing Capabilities' plan catalogue; null until one is chosen.

  • payerUserIdstring | nullrequired

    The member who pays; null until named.

  • billingContactUserIdstring | nullrequired

    The member who receives billing mail; null until named.

  • periodStartstring (date) | nullrequired

    Written by Billing: the first day of the paid term.

  • periodEndstring (date) | nullrequired

    Written by Billing: the day the paid term ends; null for an open term.

  • status"active" | "past_due" | "cancelled" | "under_contract"required

    Written by Billing alone. It changes what the organization is entitled to, never who is in it.

  • statusEffectiveAtstring (date-time)required

    When the status took effect.

  • effectiveAtstring (date-time)required

    When the newest change took effect.

  • updatedAtstring (date-time) | nullrequired

    When the subscription was last written; null until its first change.

  • seatsintegerrequired

    One per member that GET /v1/orgs/members lists, counted when read.

    min 0

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/orgs/subscription" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Change org subscription

patch/v1/orgs/subscription

Name the payer and the billing contact (owners only). A field changes when present and clears when null; an absent field stays. Both must be members (400 not_a_member). plan, periodStart, periodEnd and status are refused (400 written_by_billing): Billing writes them from what the organization pays for. effectiveAt (default now) is when the change took effect: never in the future and never before the newest change (400 invalid_effective_at). dryRun: true answers with the result and writes nothing. Audited as subscription.changed, with the changed fields before and after and metadata.effectiveAt; a body that changes nothing writes nothing.

Parameters

  • Idempotency-Keyheader · string

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

Request body · application/json

  • payerUserIdstring | null

    The member who pays: a user id from GET /v1/orgs/members.

  • billingContactUserIdstring | null

    The member who receives billing mail.

  • effectiveAtstring (date-time)

    When the change took effect; default now.

  • dryRunboolean

    Check the change and answer with the result; write nothing.

    default false

Responses

200OKapplication/json

  • subscriptionOrgSubscriptionrequired
    • planstring | nullrequired

      Written by Billing: an entry of Billing Capabilities' plan catalogue; null until one is chosen.

    • payerUserIdstring | nullrequired

      The member who pays; null until named.

    • billingContactUserIdstring | nullrequired

      The member who receives billing mail; null until named.

    • periodStartstring (date) | nullrequired

      Written by Billing: the first day of the paid term.

    • periodEndstring (date) | nullrequired

      Written by Billing: the day the paid term ends; null for an open term.

    • status"active" | "past_due" | "cancelled" | "under_contract"required

      Written by Billing alone. It changes what the organization is entitled to, never who is in it.

    • statusEffectiveAtstring (date-time)required

      When the status took effect.

    • effectiveAtstring (date-time)required

      When the newest change took effect.

    • updatedAtstring (date-time) | nullrequired

      When the subscription was last written; null until its first change.

    • seatsintegerrequired

      One per member that GET /v1/orgs/members lists, counted when read.

      min 0

  • changedarray of stringrequired

    The fields that changed, or would change on a dry run; empty when nothing did.

  • dryRunbooleanrequired

    True when nothing was written.

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
400not_a_memberBoth must be members (400 `not_a_member`)
400written_by_billing`plan`, `periodStart`, `periodEnd` and `status` are refused (400 `written_by_billing`): Billing writes them from what the organization pays for
400invalid_effective_atNever in the future and never before the newest change (400 `invalid_effective_at`)
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 PATCH "$NEXUS_URL/v1/orgs/subscription" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "payerUserId": "<payerUserId>",
    "billingContactUserId": "<billingContactUserId>",
    "effectiveAt": "2026-10-01T00:00:00Z",
    "dryRun": false
  }'

List plans

get/v1/billing/plans

The plans this organization can take, priced as Stripe holds them (owner only): one source for Nexus UI, the desktop app, both CLIs and the phone. A per-seat plan is for companies and any other plan for personal organizations, so only the organization's kind is listed (audience). Each plan has its name (the Stripe Product's), perSeat, minSeats, and per interval amountUsd (the price, per seat for a per-seat plan) and includedUsd (included usage each month, per seat), as decimal strings. Each plan also has its cloud hours a month per seat (includedHours), the price of an hour past them (hourlyUsd, a decimal string or null) and the machine sizes it allows (sizes). A price Stripe could not give has amountUsd: null and a machine-readable error (stripe_error, stripe_timeout, inactive, not_usd, interval_mismatch, no_fixed_amount). Cheapest a month first. current is the plan the organization's subscription holds. Prices are cached for 10 minutes. 502 stripe_error when Stripe gave none of the listed prices; 503 not_configured without Stripe or NEXUS_PLANS.

Responses

200OKapplication/json

  • audience"personal" | "company"required
  • plansarray of CataloguePlanrequired
    • planstringrequired

      The plan's key in NEXUS_PLANS, such as plus, pro or teams_pro.

    • namestringrequired

      The Stripe Product's name; the key when Stripe gave none.

    • perSeatbooleanrequired
    • minSeatsintegerrequired
    • includedHoursintegerrequired

      Cloud hours each month, in hours of the default machine size, per seat for a per-seat plan; 0 when NEXUS_PLANS sets none (pricing v3.0).

      min 0

    • hourlyUsdstring | nullrequired

      The price of a default-size hour past the plan's hours, as a decimal string with six places; null when NEXUS_PLANS sets none.

      pattern ^[0-9]+\.[0-9]{6}$

    • sizesarray of "small" | "default" | "large" | "xlarge"required

      The machine sizes the plan allows, smallest first; only default when NEXUS_PLANS sets none.

    • intervalsarray of objectrequired
      • interval"month" | "year"required
      • amountUsdstring | nullrequired

        The price for the interval, per seat for a per-seat plan; null with error.

      • includedUsdstringrequired

        Included usage each month, per seat for a per-seat plan.

      • errorstring | nullrequired

        Why the price is not shown: stripe_error, stripe_timeout, inactive, not_usd, interval_mismatch or no_fixed_amount.

    • currentbooleanrequired

      The organization's subscription holds this plan.

  • currentobject | nullrequired

    The plan the organization's subscription holds; null on the Free plan.

403Not the owner (`permission_error`)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.

502Stripe gave none of the listed prices (`stripe_error`)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.

503Stripe or NEXUS_PLANS is not configured (`not_configured`)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
502Stripe gave none of the listed prices (`stripe_error`)
502stripe_error502 `stripe_error` when Stripe gave none of the listed prices; 503 `not_configured` without Stripe or NEXUS_PLANS
503Stripe or NEXUS_PLANS is not configured (`not_configured`)
503not_configured502 `stripe_error` when Stripe gave none of the listed prices; 503 `not_configured` without Stripe or NEXUS_PLANS

Example

curl
curl "$NEXUS_URL/v1/billing/plans" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Change plan

post/v1/billing/plan/change

Change the organization's plan, interval or seats (owner only). Body: plan, interval, seats for a per-seat plan (one per member, at least its minimum: left out, Gateway counts them), and dryRun. A change that costs more a month applies now, and so does monthly to yearly at the same rate a month or more (a yearly price costs its plan's monthly price a month): Stripe prorates it and invoices the difference at once, and the month's included usage grows by the difference at once (live mode, or NEXUS_PLANS_TEST_GRANTS=on). A payment that fails changes nothing (402 payment_failed). Any other change (a cheaper plan, fewer seats, yearly to monthly, monthly to a yearly plan that costs less a month) applies at the period's end through a Stripe subscription schedule, shows as pendingChange on GET /v1/billing, and replaces an earlier pending change; DELETE cancels it. dryRun: true answers when, at and amountDueUsd (what is invoiced now) and changes nothing. The Idempotency-Key header keys the Stripe call. 400 unknown_plan, plan_not_for_org, same_plan; 409 no_plan without a paid plan, plan_ending while the plan is cancelled (renew it on Stripe's billing page first); 502 stripe_error; 503 not_configured until Stripe and NEXUS_PLANS are set.

Parameters

  • Idempotency-Keyheader · string

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

Request body · application/json

  • planstringrequired
  • interval"month" | "year"required
  • seatsinteger

    For a per-seat plan: from its minimum to 1000 (its minimum when absent).

  • dryRunboolean

    Answer what the change would charge and when, and change nothing.

Responses

200OKapplication/json

  • when"now" | "period_end"required
  • atstringrequired

    When it applies (ISO 8601).

  • amountDueUsdstring | nullrequired

    What is invoiced now, a decimal string: a dry run's preview, or 0 for a change at the period's end; null after a change applied now (Stripe invoiced it).

  • dryRunbooleanrequired
  • planBillingPlan | nullrequired

    The plan after the change, or as it is for a dry run.

400An unknown plan or interval, seats out of range, a plan for the other kind of organization, or the plan the organization is onapplication/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.

402Stripe could not take the payment for the change (`payment_failed`); nothing changedapplication/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.

403Not the owner (`permission_error`)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.

409No paid plan to change (`no_plan`), or the plan is cancelled, for this period or a later one (`plan_ending`, with `cancelAt` on `GET /v1/billing`)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.

502Stripe refused the call, did not answer, or gave no prices to compare (`stripe_error`)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.

503Stripe or NEXUS_PLANS is not configured (`not_configured`)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
400An unknown plan or interval, seats out of range, a plan for the other kind of organization, or the plan the organization is on
400unknown_plan400 `unknown_plan`, `plan_not_for_org`, `same_plan`; 409 `no_plan` without a paid plan, `plan_ending` while the plan is cancelled (renew it on Stripe's billing page first); 502 `stripe_error`; 503 `not_configured` until Stripe and NEXUS_PLANS are set
401authentication_errorNo key, or a key Gateway does not accept
402budget_exceededStripe could not take the payment for the change (`payment_failed`); nothing changed
402payment_failedA payment that fails changes nothing (402 `payment_failed`)
403role_requiredYour role does not have this permission
409No paid plan to change (`no_plan`), or the plan is cancelled, for this period or a later one (`plan_ending`, with `cancelAt` on `GET /v1/billing`)
409no_plan400 `unknown_plan`, `plan_not_for_org`, `same_plan`; 409 `no_plan` without a paid plan, `plan_ending` while the plan is cancelled (renew it on Stripe's billing page first); 502 `stripe_error`; 503 `not_configured` until Stripe and NEXUS_PLANS are set
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
502Stripe refused the call, did not answer, or gave no prices to compare (`stripe_error`)
502stripe_error400 `unknown_plan`, `plan_not_for_org`, `same_plan`; 409 `no_plan` without a paid plan, `plan_ending` while the plan is cancelled (renew it on Stripe's billing page first); 502 `stripe_error`; 503 `not_configured` until Stripe and NEXUS_PLANS are set
503Stripe or NEXUS_PLANS is not configured (`not_configured`)
503not_configured400 `unknown_plan`, `plan_not_for_org`, `same_plan`; 409 `no_plan` without a paid plan, `plan_ending` while the plan is cancelled (renew it on Stripe's billing page first); 502 `stripe_error`; 503 `not_configured` until Stripe and NEXUS_PLANS are set

Example

curl
curl -X POST "$NEXUS_URL/v1/billing/plan/change" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "plan": "3f9c0a1b2c3d4e5f",
    "interval": "month"
  }'

Cancel plan change

DEL/v1/billing/plan/change

Cancel the plan change pending for the period's end (owner only): Stripe releases the schedule and the plan stays as it is. 409 no_pending_change without one; 502 stripe_error; 503 not_configured until Stripe is set up.

Parameters

  • Idempotency-Keyheader · string

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

Responses

200OKapplication/json

  • planBillingPlan | nullrequired

403Not the owner (`permission_error`)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.

409No plan change pending (`no_pending_change`)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.

502Stripe refused the call or did not answer (`stripe_error`)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.

503Stripe is not configured (`not_configured`)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
409No plan change pending (`no_pending_change`)
409no_pending_change409 `no_pending_change` without one; 502 `stripe_error`; 503 `not_configured` until Stripe is set up
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
502Stripe refused the call or did not answer (`stripe_error`)
502stripe_error409 `no_pending_change` without one; 502 `stripe_error`; 503 `not_configured` until Stripe is set up
503Stripe is not configured (`not_configured`)
503not_configured409 `no_pending_change` without one; 502 `stripe_error`; 503 `not_configured` until Stripe is set up

Example

curl
curl -X DELETE "$NEXUS_URL/v1/billing/plan/change" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

Start plan

post/v1/billing/plan

Start a plan for the organization (owner only): a link to a Stripe Checkout page that starts the subscription. Stripe sends the person back to <NEXUS_UI_URL>/<org>/billing?checkout=plan, or =plan_cancelled. The plans are the ones in NEXUS_PLANS (Pro, Max's tiers, Team, Team Premium), billed monthly or yearly; a per-seat plan has one seat per member, at least its minimum (the seats follow the members), so seats may be left out and, when given, must be that number. The plan's included usage is granted once a month as a Nexus subsidy and does not roll over. A per-seat plan is for companies and any other plan for personal organizations (GET /v1/billing/plans lists an organization's). 400 unknown_plan for a plan or interval this Gateway does not sell; 400 plan_not_for_org for a plan of the other kind of organization; 409 plan_active while the organization has a live subscription: change it with POST /v1/billing/plan/change. 502 stripe_error when Stripe refuses or does not answer. 503 not_configured until Stripe and NEXUS_PLANS are set, or without NEXUS_UI_URL.

Parameters

  • Idempotency-Keyheader · string

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

Request body · application/json

  • planstringrequired

    A plan in NEXUS_PLANS, such as plus, pro, teams_plus or teams_pro

  • interval"month" | "year"required
  • seatsinteger

    Per-seat plans only (Teams Plus, Teams Pro); the plan's minimum when absent

    min 1 · max 1000

Responses

200OKapplication/json

  • urlstringrequired

    Stripe Checkout's page, where the person enters the card.

  • expiresAtstring (date-time)required

    When Stripe stops accepting url.

  • checkoutSessionIdstring

    Exact Checkout session to confirm; returned by current Gateways.

400A bad plan, interval or seats (`unknown_plan`, `invalid_request`)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.

403Not the owner (`permission_error`)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.

409A live subscription already holds the plan (`plan_active`)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.

502Stripe refused the call or did not answer (`stripe_error`)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.

503Stripe or NEXUS_PLANS is not configured, or NEXUS_UI_URL is not set (`not_configured`)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
400A bad plan, interval or seats (`unknown_plan`, `invalid_request`)
400unknown_plan400 `unknown_plan` for a plan or interval this Gateway does not sell; 400 `plan_not_for_org` for a plan of the other kind of organization; 409 `plan_active` while the organization has a live subscription: change it with `POST /v1/billing/plan/change`
400plan_not_for_org400 `unknown_plan` for a plan or interval this Gateway does not sell; 400 `plan_not_for_org` for a plan of the other kind of organization; 409 `plan_active` while the organization has a live subscription: change it with `POST /v1/billing/plan/change`
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409A live subscription already holds the plan (`plan_active`)
409plan_active400 `unknown_plan` for a plan or interval this Gateway does not sell; 400 `plan_not_for_org` for a plan of the other kind of organization; 409 `plan_active` while the organization has a live subscription: change it with `POST /v1/billing/plan/change`
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
502Stripe refused the call or did not answer (`stripe_error`)
502stripe_error502 `stripe_error` when Stripe refuses or does not answer
503Stripe or NEXUS_PLANS is not configured, or NEXUS_UI_URL is not set (`not_configured`)
503not_configured503 `not_configured` until Stripe and NEXUS_PLANS are set, or without NEXUS_UI_URL

Example

curl
curl -X POST "$NEXUS_URL/v1/billing/plan" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "plan": "3f9c0a1b2c3d4e5f",
    "interval": "month"
  }'

Set after the fact

put/v1/billing/after-the-fact

Turn paying after the fact on or off, or change its monthly usage limit (owner only; pricing v2.0). Body: enabled, and limitUsd as a decimal string in whole cents. Turning it on needs the payment method on file (409 no_payment_method), and so does turning it on again with no limitUsd; a call with limitUsd changes the limit of a setting already on without one. A closed organization cannot turn it on (409 organization_closed). Calls the free start and the credits cannot pay then go on the card, at provider price plus Nexus's rate, up to the limit in a UTC month (past it, 402 usage_limit_reached). Gateway's Stripe sweep charges the card off session each time the unpaid usage reaches pricing.thresholdUsd (less carries over, and what is left is charged once it is turned off); a charge that fails stops the calls the card pays (402 payment_failed) and tells the owners, until a charge goes through. A disputed payment (charge.dispute.created) stops its card the same way (failed.reason: disputed) until an owner adds another card, and that card never pays again (409 card_disputed on turning it on with that card, or on again with no limitUsd; a limit change still works). Off stops new calls on the card and still charges what is owed. Off with limitUsd keeps the limit, even when it was never on. Audited as billing.after_the_fact_changed. 400 invalid_amount; 503 not_configured until Stripe is set up.

Parameters

  • Idempotency-Keyheader · string

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

Request body · application/json

  • enabledbooleanrequired
  • limitUsdstring

    The monthly usage limit, dollars in whole cents, from 1.00 to 100000.00 (at most 100.00 in a new organization's first 7 days). A new setting starts at pricing.defaultLimitUsd.

Responses

200OKapplication/json

  • afterTheFactAfterTheFact | nullrequired

    The setting after; null after turning off what was never on with no limitUsd.

400`limitUsd` outside $1 to $100,000 ($100 in a new organization's first 7 days) or not in whole cents (`invalid_amount`); `enabled` missingapplication/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.

403Not the owner (`permission_error`)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.

409Turning on with no payment method on file (`no_payment_method`)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.

503Stripe is not configured (`not_configured`)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
400`limitUsd` outside $1 to $100,000 ($100 in a new organization's first 7 days) or not in whole cents (`invalid_amount`); `enabled` missing
400invalid_amount400 `invalid_amount`; 503 `not_configured` until Stripe is set up
401authentication_errorNo key, or a key Gateway does not accept
402usage_limit_reachedCalls the free start and the credits cannot pay then go on the card, at provider price plus Nexus's rate, up to the limit in a UTC month (past it, 402 `usage_limit_reached`)
402payment_failedGateway's Stripe sweep charges the card off session each time the unpaid usage reaches `pricing.thresholdUsd` (less carries over, and what is left is charged once it is turned off); a charge that fails stops the calls the card pays (402 `payment_failed`) and tells the owners, until a charge goes through
403role_requiredYour role does not have this permission
409Turning on with no payment method on file (`no_payment_method`)
409no_payment_methodTurning it on needs the payment method on file (409 `no_payment_method`), and so does turning it on again with no `limitUsd`; a call with `limitUsd` changes the limit of a setting already on without one
409organization_closedA closed organization cannot turn it on (409 `organization_closed`)
409card_disputed`disputed`) until an owner adds another card, and that card never pays again (409 `card_disputed` on turning it on with that card, or on again with no `limitUsd`; a limit change still works)
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
503Stripe is not configured (`not_configured`)
503not_configured400 `invalid_amount`; 503 `not_configured` until Stripe is set up

Example

curl
curl -X PUT "$NEXUS_URL/v1/billing/after-the-fact" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": false
  }'

List receipts

get/v1/billing/receipts

The organization's receipts (owner only; pricing v2.0), newest first, at most 100: credit purchases (credits, auto_topup), charges for usage after the fact (usage) and invoiced months (invoice). Read from Gateway's own records, with no call to Stripe. 503 not_configured until Stripe is set up.

Responses

200OKapplication/json

  • receiptsarray of Receiptrequired
    • idstringrequired

      The payment (pi_…), or month:<YYYY-MM> for an invoiced month.

    • atstring (date-time)required
    • kind"credits" | "auto_topup" | "usage" | "invoice"required
    • descriptionstringrequired

      What it paid for, such as Credits or Usage, threshold charge.

    • amountUsdstringrequired
    • status"paid" | "open" | "failed" | "void"required
    • urlstring | nullrequired

      Stripe's page of an invoiced month; null for a payment.

    • receiptbooleanrequired

      Stripe has a receipt page for it: GET /v1/billing/receipts/{id} answers its link.

403Not the owner (`permission_error`)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.

503Stripe is not configured (`not_configured`)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
100creditsHe organization's receipts (owner only; pricing v2.0), newest first, at most 100: credit purchases (`credits`, `auto_topup`), charges for usage after the fact (`usage`) and invoiced months (`invoice`)
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
503Stripe is not configured (`not_configured`)
503not_configured503 `not_configured` until Stripe is set up

Example

curl
curl "$NEXUS_URL/v1/billing/receipts" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Get receipt

get/v1/billing/receipts/{paymentId}

Stripe's receipt page of one of the organization's payments (owner only; pricing v2.0): a credit purchase or a charge for usage after the fact, by its pi_… id. 404 not_found for a payment that is not the organization's; 409 no_receipt while Stripe has none; 502 stripe_error; 503 not_configured until Stripe is set up.

Parameters

  • paymentIdpath · stringrequired

    The payment's id (pi_…); any other id is no receipt (404).

Responses

200OKapplication/json

  • urlstringrequired

    Stripe's receipt page of the payment.

403Not the owner (`permission_error`)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.

404Not one of the organization's payments (`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.

409Stripe has no receipt for the payment yet (`no_receipt`)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.

503Stripe is not configured (`not_configured`)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
404Not one of the organization's payments (`not_found`)
409Stripe has no receipt for the payment yet (`no_receipt`)
409no_receipt404 `not_found` for a payment that is not the organization's; 409 `no_receipt` while Stripe has none; 502 `stripe_error`; 503 `not_configured` until Stripe is set 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).
429rate_limit_errorToo many requests from this key in a minute
502stripe_error404 `not_found` for a payment that is not the organization's; 409 `no_receipt` while Stripe has none; 502 `stripe_error`; 503 `not_configured` until Stripe is set up
503Stripe is not configured (`not_configured`)
503not_configured404 `not_found` for a payment that is not the organization's; 409 `no_receipt` while Stripe has none; 502 `stripe_error`; 503 `not_configured` until Stripe is set up

Example

curl
curl "$NEXUS_URL/v1/billing/receipts/<paymentId>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Billing operation

get/v1/billing/operations/{operationId}

Confirm one billing operation

Parameters

  • operationIdpath · stringrequired

Responses

200OKapplication/json

  • kind"card" | "credits"required
  • status"pending" | "complete" | "expired" | "failed" | "superseded"required

    superseded: a newer card setup set its card first, so this one ended without setting the default.

403Not the owner (`permission_error`)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.

404Not one of the organization's payments (`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.

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.

503Stripe is not configured (`not_configured`)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
404Not one of the organization's payments (`not_found`)
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
503Stripe is not configured (`not_configured`)

Example

curl
curl "$NEXUS_URL/v1/billing/operations/<operationId>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"