# Staff

> Reads across organizations for Nexus's own people only: a person with a platform role who is marked staff or signs in with a Nexus address. Each read is audited in the caller's organization before it runs. Metadata and counts only, never content.

## List staff users

`GET /v1/staff/users`

Every person, newest first, with who they are, how they arrived (the sign-up's `org.created`), their organizations, when they were last seen and their figures over the window: calls, tokens, spend, sessions, failed and refused calls. Staff only; audited as `staff.list_viewed`.

Permission: `staff.read` (Owner, Admin).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `days` | query | integer | no | Whole UTC days ending today, 1 to 90; default 7 |
| `limit` | query | integer | no | People on the page, 1 to 500; default 100 |
| `cursor` | query | string | no | The last person's id on the previous page (`nextCursor`) |
| `x-nexus-staff-viewer` | header | string | no | The dashboard's signed-in viewer, kept in the audit event as sent; never used for access |

### Responses

- `200` OK (application/json, StaffUsersPage)
  - `window` (StaffWindow, required): Whole UTC days: from inclusive, until exclusive (the end of today).
    - `from` (string (date-time), required)
    - `until` (string (date-time), required)
    - `days` (integer, required)
  - `users` (array of StaffUserSummary, required)
    - `id` (string, required)
    - `email` (string | null, required): Null once erased
    - `name` (string | null, required)
    - `createdAt` (string (date-time), required)
    - `erased` (boolean, required)
    - `mark` ("staff" | "test" | "demo" | null, required)
    - `class` ("customer" | "nexus", required)
    - `signUp` (object | null, required): The personal organization's `org.created`; null for people from before it
      - `at` (string (date-time))
      - `method` (string | null)
      - `emailDomain` (string | null)
      - `country` (string | null)
      - `utmSource` (string | null)
      - `utmMedium` (string | null)
      - `utmCampaign` (string | null)
      - `referrer` (string | null)
      - `referral` (string | null)
      - `campaign` (string | null)
    - `orgs` (array of object, required)
      - `id` (string, required)
      - `kind` ("personal" | "company", required)
      - `name` (string | null, required): Null for a personal organization
      - `slug` (string | null, required)
      - `role` ("owner" | "admin" | "member", required)
      - `class` ("customer" | "nexus", required)
      - `mark` (string | null, required)
    - `lastSeenAt` (string (date-time) | null, required): The latest model call, any time, or agent session heartbeat in the window
    - `totals` (object, required)
      - `usage` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
      - `refusedCalls` (integer, required)
      - `failedCalls` (integer, required)
      - `sessions` (integer, required)
      - `failedSessions` (integer, required)
      - `subscription` (StaffSubscriptionUsage | null, required)
    - `apps` (array of string, required)
    - `plan` (object, required)
      - `nexus` ("payg" | "credits" | null, required)
      - `creditsBoughtUsd` (string | null, required)
      - `connected` (array of object, required)
        - `provider` (string, required): The plan's provider: `claude` (Anthropic) or `chatgpt` (OpenAI)
        - `tier` (string | null, required): The person's latest plan with the provider, from their app (`agent_plans`): `free`, `pro`, `max`, `plus`, `team`, `enterprise` or `unknown`. Null when no session sent one, as with `NEXUS_COLLECT_AGENT_PLAN` off.
    - `avgSessionMinutes` (integer | null, required): The mean app session in the window from the apps' heartbeat (`timeInApp`'s minutes over its sessions), else the mean length of their agent sessions. Null with neither.
    - `flag` ("abuse" | "bug" | null, required)
  - `nextCursor` (string | null, required)
  - `stats` (object | null, required): The day's tiles, on the first page only; null on a page a cursor names.
    - `people` (integer, required)
    - `signedUpToday` (integer, required)
    - `signedUpDailyAvg7d` (string, required)
    - `activeToday` (integer, required)
    - `hitErrorToday` (integer, required)
  - `collection` (StaffCollection): Current Gateway collection switches. Historical rows can remain available when a switch is disabled. A flag is true only when the signal is kept for everyone; a signal kept for organizations marked staff alone is false and listed in staffOnly.
    - `activity` (boolean, required)
    - `agentPlan` (boolean, required)
    - `clientErrors` (boolean, required)
    - `signupSource` (boolean, required)
    - `staffOnly` (array of "activity" | "agentPlan" | "clientErrors"): The signals kept only for organizations marked as staff; omitted when none is.
- `400` `days` (`invalid_days`), `limit` (`invalid_limit`) or `cursor` (`invalid_cursor`) is out of range (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `403` Not a person with a platform role who is one of Nexus's own people (`staff_required`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over 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, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | `days` (`invalid_days`), `limit` (`invalid_limit`) or `cursor` (`invalid_cursor`) is out of range |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 429 |  | Over 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). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) |

### Example

```sh
curl "$NEXUS_URL/v1/staff/users" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fstaff%2Fusers)

## Get staff user

`GET /v1/staff/users/{id}`

One person: their summary, each day of the window, the apps, models and products they used, their agent sessions by agent and route, calls that did not settle by reason, and their latest failed and refused calls with request ids. Spend counts the organizations the person has left too. Staff only; audited as `staff.person_viewed`.

Permission: `staff.read` (Owner, Admin).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The person's id |
| `days` | query | integer | no | Whole UTC days ending today, 1 to 90; default 30 |
| `x-nexus-staff-viewer` | header | string | no | The dashboard's signed-in viewer, kept in the audit event as sent; never used for access |

### Responses

- `200` OK (application/json, StaffUserDetail)
  - `window` (StaffWindow, required): Whole UTC days: from inclusive, until exclusive (the end of today).
    - `from` (string (date-time), required)
    - `until` (string (date-time), required)
    - `days` (integer, required)
  - `user` (StaffUserSummary, required)
    - `id` (string, required)
    - `email` (string | null, required): Null once erased
    - `name` (string | null, required)
    - `createdAt` (string (date-time), required)
    - `erased` (boolean, required)
    - `mark` ("staff" | "test" | "demo" | null, required)
    - `class` ("customer" | "nexus", required)
    - `signUp` (object | null, required): The personal organization's `org.created`; null for people from before it
      - `at` (string (date-time))
      - `method` (string | null)
      - `emailDomain` (string | null)
      - `country` (string | null)
      - `utmSource` (string | null)
      - `utmMedium` (string | null)
      - `utmCampaign` (string | null)
      - `referrer` (string | null)
      - `referral` (string | null)
      - `campaign` (string | null)
    - `orgs` (array of object, required)
      - `id` (string, required)
      - `kind` ("personal" | "company", required)
      - `name` (string | null, required): Null for a personal organization
      - `slug` (string | null, required)
      - `role` ("owner" | "admin" | "member", required)
      - `class` ("customer" | "nexus", required)
      - `mark` (string | null, required)
    - `lastSeenAt` (string (date-time) | null, required): The latest model call, any time, or agent session heartbeat in the window
    - `totals` (object, required)
      - `usage` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
      - `refusedCalls` (integer, required)
      - `failedCalls` (integer, required)
      - `sessions` (integer, required)
      - `failedSessions` (integer, required)
      - `subscription` (StaffSubscriptionUsage | null, required)
    - `apps` (array of string, required)
    - `plan` (object, required)
      - `nexus` ("payg" | "credits" | null, required)
      - `creditsBoughtUsd` (string | null, required)
      - `connected` (array of object, required)
        - `provider` (string, required): The plan's provider: `claude` (Anthropic) or `chatgpt` (OpenAI)
        - `tier` (string | null, required): The person's latest plan with the provider, from their app (`agent_plans`): `free`, `pro`, `max`, `plus`, `team`, `enterprise` or `unknown`. Null when no session sent one, as with `NEXUS_COLLECT_AGENT_PLAN` off.
    - `avgSessionMinutes` (integer | null, required): The mean app session in the window from the apps' heartbeat (`timeInApp`'s minutes over its sessions), else the mean length of their agent sessions. Null with neither.
    - `flag` ("abuse" | "bug" | null, required)
  - `daily` (array of object, required)
    - `day` (string (date), required)
    - `usage` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
      - `calls` (integer, required)
      - `promptTokens` (integer, required)
      - `completionTokens` (integer, required)
      - `tokens` (integer, required)
      - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `refusedCalls` (integer, required)
    - `failedCalls` (integer, required)
    - `sessions` (integer, required)
    - `subscription` (StaffSubscriptionUsage | null, required)
  - `apps` (array of object, required)
    - `app` (string, required)
    - `usage` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
      - `calls` (integer, required)
      - `promptTokens` (integer, required)
      - `completionTokens` (integer, required)
      - `tokens` (integer, required)
      - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
  - `models` (array of object, required)
    - `model` (string, required)
    - `usage` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
      - `calls` (integer, required)
      - `promptTokens` (integer, required)
      - `completionTokens` (integer, required)
      - `tokens` (integer, required)
      - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
  - `products` (array of object, required)
    - `product` (string, required)
    - `usage` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
      - `calls` (integer, required)
      - `promptTokens` (integer, required)
      - `completionTokens` (integer, required)
      - `tokens` (integer, required)
      - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
  - `agents` (array of object, required)
    - `agent` (string, required)
    - `via` (string, required)
    - `sessions` (integer, required)
    - `failed` (integer, required)
    - `interrupted` (integer, required)
    - `lost` (integer, required)
  - `errors` (array of object, required)
    - `status` ("failed" | "refused" | "released", required)
    - `reason` (string | null, required)
    - `calls` (integer, required)
    - `lastAt` (string (date-time), required)
  - `recentFailures` (array of object, required)
    - `id` (string, required)
    - `at` (string (date-time), required)
    - `orgId` (string, required)
    - `status` ("failed" | "refused", required)
    - `model` (string, required)
    - `provider` (string, required)
    - `product` (string, required)
    - `app` (string, required)
    - `reason` (string | null, required)
    - `requestId` (string | null, required)
  - `sessions` (array of object, required)
    - `id` (string, required)
    - `startedAt` (string (date-time), required)
    - `endedAt` (string (date-time) | null, required)
    - `lengthMinutes` (integer, required)
    - `app` (string, required)
    - `mode` ("code" | "chat", required)
    - `agent` (string | null, required)
    - `via` (string, required)
    - `tokens` (integer, required)
    - `gatewayTokens` (integer, required)
    - `subscriptionTokens` (integer, required)
    - `failedCalls` (integer, required)
    - `status` (string, required)
  - `journey` (array of object, required): Each step's first time, null until it happens. For an erased person, the steps the audit trail records are null.
    - `step` (string, required)
    - `label` (string, required)
    - `at` (string (date-time) | null, required)
    - `ok` (boolean, required)
  - `activation` (object | null, required): The person's Desktop sign-ins and chats, from records the Gateway already keeps; null for an erased person.
    - `firstDesktopAt` (string (date-time) | null, required): The first Desktop sign-in, any time, or the first Desktop model call in the window, whichever is earlier.
    - `desktopInstalls` (integer, required): Distinct machines signed in on Desktop, any time, by the sign-in label's host.
    - `firstChatAt` (string (date-time) | null, required): The first chat the person started, any time.
    - `chatsStarted` (integer, required): Chats started in the window.
    - `chatsAnswered` (integer, required): Chats with at least one answer, among those whose first call is in the window.
    - `exitsNotMeasured` (string, required): Why exits are not shown.
  - `staffViews` (object, required)
    - `last30Days` (integer, required)
  - `codeChat` (object, required)
    - `codeMinutes` (integer, required)
    - `chatMinutes` (integer, required)
    - `estimated` (boolean, required)
  - `devices` (array of object, required)
    - `app` (string, required)
    - `version` (string | null, required)
    - `os` (string | null, required): The OS the heartbeat names most for this app version in the window. Null with no heartbeat for it.
    - `minutes` (integer | null, required): Active minutes on this app version in the window, from the heartbeat. Null with none.
    - `calls` (integer, required): Model calls. 0 for an app version only the heartbeat names.
  - `signals` (array of StaffSignal, required)
    - `kind` (string, required)
    - `kindOf` ("bug" | "abuse", required)
    - `value` (string, required)
    - `threshold` (string, required)
    - `since` (string (date-time) | null, required): For review candidates, the observed threshold-trigger time; otherwise the first counting event in the activity window.
    - `baselineMultiple` (string | null, required)
    - `reason` (string, required)
    - `evidence` (StaffReviewEvidence)
      - `from` (string (date-time), required)
      - `until` (string (date-time), required)
      - `observedAt` (string (date-time), required)
      - `scope` (string, required)
      - `counts` (StaffReviewCounts, required)
        - `total` (integer, required) [min 0]
        - `fresh` (integer, required) [min 0]
        - `matured` (integer, required) [min 0]
        - `evaluated` (integer, required) [min 0]
        - `unknown` (integer, required) [min 0]
        - `excluded` (integer, required) [min 0]
        - `qualified` (integer, required) [min 0]
      - `accounts` (array of object, required)
        - `userId` (string, required)
        - `welcomeGrantMicros` (string, required): Exact micro-dollar integer. Never a reservation hold. [pattern ^[0-9]+$]
        - `welcomeSpentMicros` (string, required): Exact micro-dollar integer. Never a reservation hold. [pattern ^[0-9]+$]
        - `lastCall` (string (date-time), required)
        - `organizationCreatedAt` (string (date-time), required)
  - `rules` (array of StaffRule, required)
    - `kind` (string, required)
    - `kindOf` ("bug" | "abuse", required)
    - `subject` ("person" | "org" | "domain" | "network", required)
    - `firesWhen` (string, required)
    - `firing` (any): A count on the attention list; a boolean on a person's page
  - `timeInApp` (object | null, required): Active minutes and app sessions in the window, from the apps' heartbeat. Null with none, as with `NEXUS_COLLECT_ACTIVITY` off.
    - `minutes` (integer, required): At most one a minute per organization and app
    - `sessions` (integer, required): One per organization, app and UTC day with an active minute
  - `activityByHour` (array of object | null, required): Active minutes in each of the last 24 whole UTC hours by surface, oldest first. A day row that spans several hours is spread over them by time. Null with no heartbeat in them.
    - `hour` (string (date-time), required): The hour's start, UTC
    - `code` (integer, required)
    - `chat` (integer, required)
    - `other` (integer, required): Wiki, Review, Pages and every other screen
  - `clientErrors` (array of object | null, required): The newest 50 errors the apps caught since the window's start (kept 30 days), newest first. Never a message. Null with none, as with `NEXUS_COLLECT_CLIENT_ERRORS` off.
    - `eventId` (string, required): `cer_…`
    - `at` (string (date-time), required)
    - `app` (string, required)
    - `version` (string, required)
    - `os` (string, required)
    - `kind` ("crash" | "render" | "network" | "sign_in" | "update" | "agent" | "storage" | "other", required)
    - `component` (string, required): The app's own name for the place
    - `code` (string, required): The app's own error code
    - `fatal` (boolean, required): The app or the window ended
  - `httpErrors` (object | null, required): The 5xx and 429 answers the person met in the window, on any route: sign-in, Nexus UI and model calls (`http_error_days`). Null with none. The counter has no switch.
    - `serverErrors` (integer, required): Answers with a status from 500 to 599
    - `rateLimited` (integer, required): Answers with status 429
    - `byFamily` (array of object, required): By route family and status, most answers first
      - `family` (string, required): The route family, as the `family` label on `/metrics`
      - `status` (integer, required)
      - `count` (integer, required)
      - `lastDay` (string (date), required): The last UTC day with one
  - `collection` (StaffCollection): Current Gateway collection switches. Historical rows can remain available when a switch is disabled. A flag is true only when the signal is kept for everyone; a signal kept for organizations marked staff alone is false and listed in staffOnly.
    - `activity` (boolean, required)
    - `agentPlan` (boolean, required)
    - `clientErrors` (boolean, required)
    - `signupSource` (boolean, required)
    - `staffOnly` (array of "activity" | "agentPlan" | "clientErrors"): The signals kept only for organizations marked as staff; omitted when none is.
  - `clientErrorGroups` (StaffClientErrorGroups): Current UTC calendar day, partial at observedAt. Measured reads all retained daily counters; it does not establish client reporting coverage. Data remains readable while collection is off. Truncation is explicit. Person detail selects groups containing that person, while counts remain global.
    - `state` ("measured" | "unavailable", required)
    - `collectionEnabled` (boolean | null, required)
    - `window` (object, required)
      - `from` (string (date-time), required)
      - `until` (string (date-time), required)
    - `observedAt` (string (date-time), required)
    - `minimumPeople` (3, required)
    - `groupLimit` (50, required)
    - `peopleLimit` (20, required)
    - `groupsTruncated` (boolean, required)
    - `groups` (array of StaffClientErrorGroup, required) [at most 50 items]
      - `id` (string, required)
      - `app` (string, required)
      - `appVersion` (string, required)
      - `os` (string, required)
      - `kind` (string, required)
      - `component` (string, required)
      - `code` (string, required)
      - `affectedPeople` (integer, required) [min 0]
      - `errors` (integer, required) [min 0]
      - `fatalErrors` (integer, required) [min 0]
      - `lastAt` (string (date-time), required)
      - `people` (array of string, required) [at most 20 items]
      - `peopleTruncated` (boolean, required)
  - `referredBy` (object | null, required): Who referred the person, from their row in `referrals`. Ids only, never a name or an email. Null when nobody did, and for an erased person.
    - `kind` ("person" | "campaign", required)
    - `userId` (string | null, required): The referrer's user id, for a link to their staff page; null for a campaign.
    - `campaign` (string | null, required): The campaign's label; null for a person.
    - `at` (string (date-time) | null, required): When the sign-up recorded the referral; null on rows from before it was kept.
  - `referred` (object, required): The people the person referred: empty for an erased person.
    - `total` (integer, required): Everyone they referred, past the 50 listed too. [min 0]
    - `people` (array of object, required): The newest 50 of them, oldest first. Ids only, never a name or an email. [at most 50 items]
      - `userId` (string, required)
      - `signedUpAt` (string (date-time), required): When their sign-up recorded the referral.
      - `erased` (boolean, required): Erased, or no longer on record: their page shows nothing of theirs.
      - `firstCallAt` (string (date-time) | null, required): Their first model call in any of their organizations; null before one, and for an erased person.
      - `paidAt` (string (date-time) | null, required): When their personal organization first paid Nexus with a credit purchase of at least the reward's minimum; null before.
      - `reward` ("pending" | "rewarded" | "not_rewarded", required): The referrer's reward for them, as GET /v1/referrals shows the referrer.
- `400` `days` is out of range (`invalid_days`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `403` Not a person with a platform role who is one of Nexus's own people (`staff_required`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `404` No such person (`unknown_person`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over 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, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | `days` is out of range (`invalid_days`) |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such person (`unknown_person`) |
| 429 |  | Over 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). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) |

### Example

```sh
curl "$NEXUS_URL/v1/staff/users/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fstaff%2Fusers%2F%7Bid%7D)

## Get staff attention

`GET /v1/staff/attention`

People, organizations, sign-up domains and apps to look at now: the bug and abuse rules that fire over the last 24 hours against the 7 days before, each with its value, threshold, start and baseline multiple, every rule with how many it fires for, and what the data cannot measure yet. Staff only; audited as `staff.list_viewed`.

Permission: `staff.read` (Owner, Admin).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `x-nexus-staff-viewer` | header | string | no | The dashboard's signed-in viewer, kept in the audit event as sent; never used for access |

### Responses

- `200` OK (application/json, StaffAttention)
  - `generatedAt` (string (date-time), required)
  - `window` (object, required)
    - `from` (string (date-time), required)
    - `until` (string (date-time), required)
  - `baseline` (object, required)
    - `from` (string (date-time), required)
    - `until` (string (date-time), required)
  - `abuse` (array of object, required)
    - `subject` (object, required)
      - `type` ("person" | "org" | "domain" | "app" | "network", required)
      - `id` (string, required)
      - `label` (string | null, required)
      - `class` ("customer" | "nexus" | null, required)
      - `createdAt` (string (date-time) | null, required)
    - `signals` (array of StaffSignal, required)
      - `kind` (string, required)
      - `kindOf` ("bug" | "abuse", required)
      - `value` (string, required)
      - `threshold` (string, required)
      - `since` (string (date-time) | null, required): For review candidates, the observed threshold-trigger time; otherwise the first counting event in the activity window.
      - `baselineMultiple` (string | null, required)
      - `reason` (string, required)
      - `evidence` (StaffReviewEvidence)
        - `from` (string (date-time), required)
        - `until` (string (date-time), required)
        - `observedAt` (string (date-time), required)
        - `scope` (string, required)
        - `counts` (StaffReviewCounts, required)
          - `total` (integer, required) [min 0]
          - `fresh` (integer, required) [min 0]
          - `matured` (integer, required) [min 0]
          - `evaluated` (integer, required) [min 0]
          - `unknown` (integer, required) [min 0]
          - `excluded` (integer, required) [min 0]
          - `qualified` (integer, required) [min 0]
        - `accounts` (array of object, required)
          - `userId` (string, required)
          - `welcomeGrantMicros` (string, required): Exact micro-dollar integer. Never a reservation hold. [pattern ^[0-9]+$]
          - `welcomeSpentMicros` (string, required): Exact micro-dollar integer. Never a reservation hold. [pattern ^[0-9]+$]
          - `lastCall` (string (date-time), required)
          - `organizationCreatedAt` (string (date-time), required)
    - `detail` (string | null, required)
    - `people` (array of string, required): Explicit affected user IDs, including referred people for personal-referrer findings.
  - `bugs` (array of object, required)
    - `subject` (object, required)
      - `type` ("person" | "org" | "domain" | "app" | "network", required)
      - `id` (string, required)
      - `label` (string | null, required)
      - `class` ("customer" | "nexus" | null, required)
      - `createdAt` (string (date-time) | null, required)
    - `signals` (array of StaffSignal, required)
      - `kind` (string, required)
      - `kindOf` ("bug" | "abuse", required)
      - `value` (string, required)
      - `threshold` (string, required)
      - `since` (string (date-time) | null, required): For review candidates, the observed threshold-trigger time; otherwise the first counting event in the activity window.
      - `baselineMultiple` (string | null, required)
      - `reason` (string, required)
      - `evidence` (StaffReviewEvidence)
        - `from` (string (date-time), required)
        - `until` (string (date-time), required)
        - `observedAt` (string (date-time), required)
        - `scope` (string, required)
        - `counts` (StaffReviewCounts, required)
          - `total` (integer, required) [min 0]
          - `fresh` (integer, required) [min 0]
          - `matured` (integer, required) [min 0]
          - `evaluated` (integer, required) [min 0]
          - `unknown` (integer, required) [min 0]
          - `excluded` (integer, required) [min 0]
          - `qualified` (integer, required) [min 0]
        - `accounts` (array of object, required)
          - `userId` (string, required)
          - `welcomeGrantMicros` (string, required): Exact micro-dollar integer. Never a reservation hold. [pattern ^[0-9]+$]
          - `welcomeSpentMicros` (string, required): Exact micro-dollar integer. Never a reservation hold. [pattern ^[0-9]+$]
          - `lastCall` (string (date-time), required)
          - `organizationCreatedAt` (string (date-time), required)
    - `detail` (string | null, required)
    - `people` (array of string, required): Explicit affected user IDs, including referred people for personal-referrer findings.
  - `rules` (array of StaffRule, required)
    - `kind` (string, required)
    - `kindOf` ("bug" | "abuse", required)
    - `subject` ("person" | "org" | "domain" | "network", required)
    - `firesWhen` (string, required)
    - `firing` (any): A count on the attention list; a boolean on a person's page
  - `notMeasured` (array of object, required)
    - `kind` (string, required)
    - `why` (string, required)
  - `clientErrorGroups` (StaffClientErrorGroups): Current UTC calendar day, partial at observedAt. Measured reads all retained daily counters; it does not establish client reporting coverage. Data remains readable while collection is off. Truncation is explicit. Person detail selects groups containing that person, while counts remain global.
    - `state` ("measured" | "unavailable", required)
    - `collectionEnabled` (boolean | null, required)
    - `window` (object, required)
      - `from` (string (date-time), required)
      - `until` (string (date-time), required)
    - `observedAt` (string (date-time), required)
    - `minimumPeople` (3, required)
    - `groupLimit` (50, required)
    - `peopleLimit` (20, required)
    - `groupsTruncated` (boolean, required)
    - `groups` (array of StaffClientErrorGroup, required) [at most 50 items]
      - `id` (string, required)
      - `app` (string, required)
      - `appVersion` (string, required)
      - `os` (string, required)
      - `kind` (string, required)
      - `component` (string, required)
      - `code` (string, required)
      - `affectedPeople` (integer, required) [min 0]
      - `errors` (integer, required) [min 0]
      - `fatalErrors` (integer, required) [min 0]
      - `lastAt` (string (date-time), required)
      - `people` (array of string, required) [at most 20 items]
      - `peopleTruncated` (boolean, required)
  - `reviewCoverage` (array of StaffReviewCoverage): Rule-specific evaluated, unknown, excluded and fresh cohorts. Absent on older Gateway releases.
    - `total` (integer, required) [min 0]
    - `fresh` (integer, required) [min 0]
    - `matured` (integer, required) [min 0]
    - `evaluated` (integer, required) [min 0]
    - `unknown` (integer, required) [min 0]
    - `excluded` (integer, required) [min 0]
    - `qualified` (integer, required) [min 0]
    - `kind` (string, required)
    - `from` (string (date-time), required)
    - `until` (string (date-time), required)
    - `note` (string, required)
- `403` Not a person with a platform role who is one of Nexus's own people (`staff_required`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over 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, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 429 |  | Over 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). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) |

### Example

```sh
curl "$NEXUS_URL/v1/staff/attention" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fstaff%2Fattention)

## Get staff metrics

`GET /v1/staff/metrics`

Company numbers over a window, customers next to Nexus: people, daily, weekly and monthly actives, the last 7 days' sign-up funnel and activation, today's sources and sign-in methods, sign-ups per day, and usage per day, model, app and organization (the top 50 by spend, the rest summed). Counts only, no content. Staff only; audited as `staff.list_viewed`.

Permission: `staff.read` (Owner, Admin).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `days` | query | integer | no | Whole UTC days ending today, 1 to 90; default 30 |
| `scope` | query | "all" \| "customers" | no | People included in every figure. all preserves the existing view; customers excludes Nexus people, including their activity in other organizations. |
| `x-nexus-staff-viewer` | header | string | no | The dashboard's signed-in viewer, kept in the audit event as sent; never used for access |

### Responses

- `200` OK (application/json, StaffMetrics)
  - `window` (StaffWindow, required): Whole UTC days: from inclusive, until exclusive (the end of today).
    - `from` (string (date-time), required)
    - `until` (string (date-time), required)
    - `days` (integer, required)
  - `people` (object, required)
    - `total` (integer, required)
    - `customers` (integer, required)
    - `nexus` (integer, required)
  - `active` (object, required): People with a model call or an agent session today, in the last 7 days and in the last 30.
    - `dau` (integer, required)
    - `wau` (integer, required)
    - `mau` (integer, required)
  - `activation` (object, required): The share of the last 7 days' sign-ups with a model call or an agent session within a day; null with no sign-up.
    - `withinOneDayShare` (number | null, required) [min 0; max 1]
  - `funnel` (array of object, required): The last 7 days' sign-ups, step by step. The steps are not nested. `desktop_signed_in` is a Desktop sign-in or Desktop model call, `chat_started` a chat they created and `chat_answered` a chat with at least one answer.
    - `step` ("signed_up" | "connected_app" | "first_session" | "first_gateway_call" | "back_day_2" | "desktop_signed_in" | "chat_started" | "chat_answered", required)
    - `label` (string, required)
    - `people` (integer, required)
  - `funnelDetail` (object, required): The funnel's Desktop and chat records for the same sign-ups, from records the Gateway already keeps. Exits are not counted.
    - `desktopInstalls` (integer, required): Distinct machines they signed in on Desktop, by the sign-in label's host.
    - `chatsStarted` (integer, required): Chats they started in the last 7 days.
    - `chatsAnswered` (integer, required): Their chats with at least one answer, among those whose first call is in the last 7 days.
    - `exitsNotMeasured` (string, required): Why exits are not counted.
  - `sources` (array of object | null, required): Today's sign-ups by referrer and campaign, a referral, or `direct`. Null when today has sign-ups and none says where it came from (`NEXUS_SIGNUP_SOURCE` off).
    - `source` (string, required)
    - `signUps` (integer, required)
  - `sourcesNotCollected` (integer, required): Today's sign-ups that say nothing of where they came from: no method, country, UTM value, referrer or referral. Never counted as `direct`.
  - `methods` (object, required): Today's sign-ups: the share by sign-in method and with a work email; null with no sign-up. The method shares are null too when no sign-up today names its method (`NEXUS_SIGNUP_SOURCE` off).
    - `google` (number | null, required) [min 0; max 1]
    - `github` (number | null, required) [min 0; max 1]
    - `email` (number | null, required) [min 0; max 1]
    - `workDomain` (number | null, required) [min 0; max 1]
  - `signUps` (object, required)
    - `daily` (array of object, required)
      - `day` (string (date), required)
      - `customers` (integer, required)
      - `nexus` (integer, required)
    - `totals` (object, required)
      - `customers` (integer, required)
      - `nexus` (integer, required)
  - `usage` (object, required)
    - `daily` (array of object, required)
      - `day` (string (date), required)
      - `customers` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
      - `nexus` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `byModel` (array of object, required)
      - `model` (string, required)
      - `customers` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
      - `nexus` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `byApp` (array of object, required)
      - `app` (string, required)
      - `customers` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
      - `nexus` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `bySurface` (array of object): ByApp with Nexus for desktop's GPUI build apart (`desktop-gpui`, by the client it named). `unknown` is a record that kept no app.
      - `surface` (string, required)
      - `customers` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
      - `nexus` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `byOrg` (array of object, required): The top 50 organizations by spend.
      - `orgId` (string, required)
      - `kind` ("personal" | "company", required)
      - `name` (string | null, required)
      - `class` ("customer" | "nexus", required)
      - `topModel` (string | null, required)
      - `people` (integer, required)
      - `usage` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `otherOrgs` (object, required)
      - `orgs` (integer, required)
      - `usage` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `subscription` (object | null, required): What people's own plans reported; null where the store keeps no subscription days.
  - `codeChat` (object, required)
    - `codeMinutes` (integer, required)
    - `chatMinutes` (integer, required)
    - `estimated` (boolean, required)
  - `timeInApp` (object | null, required): Time in the apps over the window, everyone's, from the heartbeat. Null with none, as with `NEXUS_COLLECT_ACTIVITY` off.
    - `avgSessionMinutes` (integer, required): Active minutes over app sessions
    - `minutes` (integer, required)
    - `sessions` (integer, required): One per person, organization, app and UTC day with an active minute
    - `people` (integer, required): People with an active minute
    - `codeShare` (number, required): Share of the minutes on Code, two decimals [min 0; max 1]
    - `chatShare` (number, required): Share of the minutes on Chat, two decimals [min 0; max 1]
    - `otherShare` (number, required): Share of the minutes on every other surface, two decimals [min 0; max 1]
    - `noCallYet` (integer, required): People with an active minute and no model call ever
  - `cliDownloads` (object | null): The native CLI's downloads through this Gateway (`GET /cli/nexus-<target>`) over the window, the same in either scope. Aggregates only: no person, address, key or user agent. Null without a database.
    - `total` (integer, required)
    - `daily` (array of object, required): Every day of the window, 0 included.
      - `day` (string (date), required)
      - `count` (integer, required)
    - `byTarget` (array of object, required): Most first.
      - `target` (string, required)
      - `count` (integer, required)
    - `byVersion` (array of object, required): Most first.
      - `version` (string, required)
      - `count` (integer, required)
  - `ossInstalls` (object | null): The open-source desktop app's active installs over the window, from its opt-in `daily_active`, and the live registered fork clients. The same in either scope: counts only, no install ID. Null without a database.
    - `daily` (array of object, required): Every day of the window, 0 included.
      - `day` (string (date), required)
      - `installs` (integer, required): Installs that sent `daily_active` for the day
      - `signedIn` (integer, required): Of those, the installs signed in to Nexus Cloud that day
    - `registeredForks` (integer, required): Registered fork clients not revoked, now
  - `scope` ("all" | "customers", required): The scope applied to every figure in this response.
  - `collection` (StaffCollection): Current Gateway collection switches. Historical rows can remain available when a switch is disabled. A flag is true only when the signal is kept for everyone; a signal kept for organizations marked staff alone is false and listed in staffOnly.
    - `activity` (boolean, required)
    - `agentPlan` (boolean, required)
    - `clientErrors` (boolean, required)
    - `signupSource` (boolean, required)
    - `staffOnly` (array of "activity" | "agentPlan" | "clientErrors"): The signals kept only for organizations marked as staff; omitted when none is.
  - `retention` (StaffRetention, required): Recorded account-creation cohorts backed by personal org.created audit evidence in the selected window, at most 90 days. Uses User.createdAt, never organization creation or guessed age. Current Company classification applies across all organizations. Erased identities stay in All; Customers reports unresolved erased classifications. Week 0 is activation during the creation week; Weeks 1–4 are later calendar weeks beginning Monday 00:00 UTC. Active means non-refused recorded model use or observed agent-session start/last heartbeat. No interpolation, app-open inference or future observations. Reuses existing bounded reads under the 20-second staff deadline. No collection watermark proves historical completeness; missing identities, dates and evidence remain explicit.
    - `generatedAt` (string (date-time), required)
    - `from` (string (date-time), required)
    - `until` (string (date-time), required)
    - `scope` ("all" | "customers", required)
    - `period` ("calendar_week_monday_utc", required)
    - `observedFrom` (string (date-time) | null, required): Earliest evidenced account-creation time in this bounded read and scope. Unresolved erased classifications do not establish Customers' boundary. Not a historical completeness watermark.
    - `unlinkedSignUpEvents` (integer, required): Distinct personal organizations with an audit event but no usable identity/date. Cohort and scope are unknown, so all denominators are unavailable. [min 0]
    - `olderAccountEvents` (integer, required): Personal-organization events for accounts created before the read; never assigned new ages. [min 0]
    - `cohorts` (array of StaffRetentionCohort, required)
      - `from` (string (date-time), required)
      - `until` (string (date-time), required)
      - `cohortComplete` (boolean, required)
      - `knownSignUps` (integer, required): Evidenced immutable identities in this scope, once across all organizations. [min 0]
      - `erasedSignUps` (integer, required): Evidenced erased identities still included in this cohort. [min 0]
      - `missingEvidencePeople` (integer, required): In-scope registry identities created in this week without personal audit evidence inside the read. [min 0]
      - `unclassifiedPeople` (integer, required): Erased identities whose Customer/Nexus classification is unavailable for Customers. [min 0]
      - `denominator` (integer | null, required) [min 0]
      - `periods` (array of StaffRetentionPeriod, required) [at most 5 items]
        - `week` (integer, required) [min 0; max 4]
        - `from` (string (date-time), required)
        - `until` (string (date-time), required)
        - `state` ("observed" | "empty" | "immature" | "unavailable", required)
        - `activePeople` (integer | null, required) [min 0]
        - `share` (number | null, required) [min 0; max 1]
    - `unknownCreationDatePeople` (integer, required): Eligible registry identities with an unparseable recorded creation date. No cohort is assignable, so all denominators in this scope are unavailable. [min 0]
  - `peopleInsights` (StaffPeopleInsights, required): Current-scope operational aggregates. Unknown and erased identities are separate from known people. Rankings carry no person identity.
    - `newDaily` (array of StaffPeopleDay, required)
      - `day` (string (date), required)
      - `customers` (integer, required) [min 0]
      - `nexus` (integer, required) [min 0]
      - `unknown` (integer, required) [min 0]
    - `activeDaily` (array of StaffPeopleDay, required)
      - `day` (string (date), required)
      - `customers` (integer, required) [min 0]
      - `nexus` (integer, required) [min 0]
      - `unknown` (integer, required) [min 0]
    - `activeWeekly` (array of StaffPeopleWeek, required)
      - `from` (string (date-time), required)
      - `until` (string (date-time), required)
      - `complete` (boolean, required)
      - `customers` (integer, required) [min 0]
      - `nexus` (integer, required) [min 0]
      - `unknown` (integer, required) [min 0]
    - `byOrg` (array of StaffOrgPeople, required)
      - `orgId` (string, required)
      - `name` (string, required)
      - `class` ("customer" | "nexus", required)
      - `members` (integer, required) [min 0]
      - `active` (integer, required) [min 0]
      - `unresolvedMembers` (integer, required) [min 0]
    - `otherOrgs` (integer, required) [min 0]
    - `personalOnly` (object, required)
      - `customers` (object, required)
        - `members` (integer, required) [min 0]
        - `active` (integer, required) [min 0]
      - `nexus` (object, required)
        - `members` (integer, required) [min 0]
        - `active` (integer, required) [min 0]
    - `topBySpend` (array of StaffTopPerson, required) [at most 10 items]
      - `rank` (integer, required) [min 1]
      - `class` ("customer" | "nexus", required)
      - `orgs` (integer, required) [min 0]
      - `usage` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `topByCalls` (array of StaffTopPerson, required) [at most 10 items]
      - `rank` (integer, required) [min 1]
      - `class` ("customer" | "nexus", required)
      - `orgs` (integer, required) [min 0]
      - `usage` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `unattributed` (object, required)
      - `customers` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
      - `nexus` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `unknownPerson` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
      - `calls` (integer, required)
      - `promptTokens` (integer, required)
      - `completionTokens` (integer, required)
      - `tokens` (integer, required)
      - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `erasedPerson` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
      - `calls` (integer, required)
      - `promptTokens` (integer, required)
      - `completionTokens` (integer, required)
      - `tokens` (integer, required)
      - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `unknownCreationDatePeople` (integer, required) [min 0]
  - `cohortFunnel` (StaffCohortFunnel, required): Monday UTC cohorts. First accepted means a non-refused call on days 0 through 6. Day two is exactly the UTC date two days after creation, with a prior accepted call. Observed counts are lower bounds while follow-up remains open. Each stage has a final denominator only after its own calendar dates and evidence are complete.
    - `period` ("calendar_week_monday_utc", required)
    - `scope` ("all" | "customers", required)
    - `firstCallDays` (7, required)
    - `returnDay` (2, required)
    - `weeks` (array of StaffCohortFunnelWeek, required)
      - `from` (string (date-time), required)
      - `until` (string (date-time), required)
      - `evidencedSignUps` (integer, required) [min 0]
      - `denominator` (integer | null, required) [min 0]
      - `firstAcceptedCalls` (integer, required) [min 0]
      - `day2Returns` (integer, required) [min 0]
      - `state` ("observed" | "partial_week" | "immature" | "missing_evidence" | "ambiguous_call_time", required)
      - `day2Eligible` (integer, required) [min 0]
      - `day2Denominator` (integer | null, required) [min 0]
      - `ambiguousCallPeople` (integer, required) [min 0]
    - `unlinkedSignUpEvents` (integer, required) [min 0]
    - `unknownCreationDatePeople` (integer, required) [min 0]
- `400` `days` is out of range (`invalid_days`) or `scope` is unknown (`invalid_scope`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `403` Not a person with a platform role who is one of Nexus's own people (`staff_required`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over 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, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | `days` is out of range (`invalid_days`) or `scope` is unknown (`invalid_scope`) |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 429 |  | Over 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). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) |

### Example

```sh
curl "$NEXUS_URL/v1/staff/metrics" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fstaff%2Fmetrics)

## Get staff models

`GET /v1/staff/models`

Tokens by model over chosen UTC days, every organization's, customers next to Nexus: calls, prompt and completion tokens and spend per model, over the range and per day. Refused calls add nothing. Counts only, no content. Staff only; audited as `staff.list_viewed`.

Permission: `staff.read` (Owner, Admin).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `from` | query | string (date) | yes | The first UTC day, YYYY-MM-DD, inclusive |
| `to` | query | string (date) | no | The last UTC day, YYYY-MM-DD, inclusive; default today. At most 90 days after from, and not after today |
| `scope` | query | "all" \| "customers" | no | People included. all counts everyone; customers excludes Nexus people, including their calls in other organizations. |
| `x-nexus-staff-viewer` | header | string | no | The dashboard's signed-in viewer, kept in the audit event as sent; never used for access |

### Responses

- `200` OK (application/json, StaffModels)
  - `window` (StaffWindow, required): Whole UTC days: from inclusive, until exclusive (the end of today).
    - `from` (string (date-time), required)
    - `until` (string (date-time), required)
    - `days` (integer, required)
  - `scope` ("all" | "customers", required)
  - `models` (array of object, required): Most tokens first.
    - `model` (string, required)
    - `customers` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
      - `calls` (integer, required)
      - `promptTokens` (integer, required)
      - `completionTokens` (integer, required)
      - `tokens` (integer, required)
      - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `nexus` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
      - `calls` (integer, required)
      - `promptTokens` (integer, required)
      - `completionTokens` (integer, required)
      - `tokens` (integer, required)
      - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
    - `daily` (array of object, required): Every day of the window, a day with no call included.
      - `day` (string (date), required)
      - `customers` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
      - `nexus` (StaffUsage, required): Settled, failed and released calls. Refused calls are counted apart. `spendUsd` is the ledger's cost at the provider, as a decimal string, and null when no call was made.
        - `calls` (integer, required)
        - `promptTokens` (integer, required)
        - `completionTokens` (integer, required)
        - `tokens` (integer, required)
        - `spendUsd` (string | null, required) [pattern ^-?[0-9]+\.[0-9]{6}$]
- `400` `from` or `to` is missing, malformed, reversed, after today or more than 90 days apart (`invalid_range`), or `scope` is unknown (`invalid_scope`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `403` Not a person with a platform role who is one of Nexus's own people (`staff_required`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over 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, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | `from` or `to` is missing, malformed, reversed, after today or more than 90 days apart (`invalid_range`), or `scope` is unknown (`invalid_scope`) |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 429 |  | Over 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). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) |

### Example

```sh
curl "$NEXUS_URL/v1/staff/models?from=2026-10-01" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fstaff%2Fmodels)

## Get staff live

`GET /v1/staff/live`

The live view: people active in the last 5 minutes and by app, people active today, running agent sessions, tokens and failed calls a minute, and today's sign-ups with how they arrived (no email, no id). Staff only; audited as `staff.list_viewed`.

Permission: `staff.read` (Owner, Admin).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `x-nexus-staff-viewer` | header | string | no | The dashboard's signed-in viewer, kept in the audit event as sent; never used for access |

### Responses

- `200` OK (application/json, StaffLive)
  - `generatedAt` (string (date-time), required)
  - `activeNow` (object, required): People with a model call, or an agent session started in the last 24 hours, heard in the last 5 minutes.
    - `people` (integer, required)
    - `byApp` (array of object, required)
      - `app` (string, required)
      - `people` (integer, required)
  - `activeToday` (integer, required)
  - `sessionsRunning` (integer, required): Running agent sessions that started in the last 24 hours.
  - `tokensPerMinute` (integer, required)
  - `errorsPerMinute` (number, required): Failed model calls a minute over the last 5 minutes, one decimal. [min 0]
  - `signUps` (object, required)
    - `lastHour` (integer, required)
    - `today` (integer, required)
    - `latest` (array of object, required): Today's 10 latest sign-ups: how they arrived, and the ids that link the person and their referrer, never a name or an email.
      - `at` (string (date-time), required)
      - `userId` (string | null, required): The person who signed up, for a link to their staff page; null when the event names nobody.
      - `referrerUserId` (string | null, required): The person whose referral code the sign-up carried, from `referrals`; null for a campaign's code or no code.
      - `method` (string | null, required)
      - `referrer` (string | null, required)
      - `campaign` (string | null, required)
      - `country` (string | null, required)
      - `workDomain` (boolean, required)
  - `inApp` (object | null, required): People whose app counted an active minute in the last 2 minutes, from the heartbeat. Null with nobody, as with `NEXUS_COLLECT_ACTIVITY` off.
    - `people` (integer, required)
    - `byApp` (array of object, required): People per app, most first
      - `app` (string, required)
      - `people` (integer, required)
    - `noCallYet` (integer, required): Of them, people with no model call ever
  - `collection` (StaffCollection): Current Gateway collection switches. Historical rows can remain available when a switch is disabled. A flag is true only when the signal is kept for everyone; a signal kept for organizations marked staff alone is false and listed in staffOnly.
    - `activity` (boolean, required)
    - `agentPlan` (boolean, required)
    - `clientErrors` (boolean, required)
    - `signupSource` (boolean, required)
    - `staffOnly` (array of "activity" | "agentPlan" | "clientErrors"): The signals kept only for organizations marked as staff; omitted when none is.
- `403` Not a person with a platform role who is one of Nexus's own people (`staff_required`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over 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, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 429 |  | Over 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). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) |

### Example

```sh
curl "$NEXUS_URL/v1/staff/live" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fstaff%2Flive)

## Get staff revenue

`GET /v1/staff/revenue`

Customer ledger fees, billed usage and credits for every closed billing day, with recurring subscriptions from Stripe. Missing sources carry errors. Staff only; audited before the read.

Permission: `staff.read` (Owner, Admin).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `x-nexus-staff-viewer` | header | string | no | The dashboard's signed-in viewer, kept in the audit event as sent; never used for access |

### Responses

- `200` OK (application/json, StaffRevenue)
  - `scope` ("customers", required)
  - `billingFrom` (string (date), required)
  - `window` (StaffWindow, required): Whole UTC days: from inclusive, until exclusive (the end of today).
    - `from` (string (date-time), required)
    - `until` (string (date-time), required)
    - `days` (integer, required)
  - `provisional` (boolean, required)
  - `ledgerError` (object | null, required)
    - `code` (string, required)
    - `reason` (string, required)
  - `daily` (array of object, required)
    - `day` (string (date), required)
    - `feeUsd` (string | null, required): Exact USD; null on an empty or unknown financial day. [pattern ^\d+\.\d{6}$]
    - `billedUsd` (string | null, required): Exact USD; null on an empty or unknown financial day. [pattern ^\d+\.\d{6}$]
    - `creditsUsd` (string | null, required): Exact USD; null on an empty or unknown financial day. [pattern ^\d+\.\d{6}$]
    - `freeStartUsd` (string | null, required): Exact USD; null on an empty or unknown financial day. [pattern ^\d+\.\d{6}$]
    - `ledgerError` (string | null, required)
  - `recurring` (object, required)
    - `mrrUsd` (string | null, required): Exact monthly USD from mapped customer subscriptions; null when Stripe or a subscription price is unavailable. [pattern ^\d+\.\d{6}$]
    - `contractedArrUsd` (string | null, required): Exact annual USD from mapped customer subscriptions; null when Stripe, subscription prices, or signed contract prices are unavailable. [pattern ^\d+\.\d{6}$]
    - `subscriptions` (integer, required) [min 0]
    - `unpricedContracts` (integer, required) [min 0]
    - `recurringError` (string | null, required)
- `400` Query windows are unsupported (`unsupported_window`). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `403` Not a person with a platform role who is one of Nexus's own people (`staff_required`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over 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, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `502` Neither financial source succeeded (`executive_sources_failed`). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` Both money sources are unconfigured (`executive_not_configured`), audit failed (`staff_audit_unavailable`), or the read exceeded 20 s (`staff_read_timeout`). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Query windows are unsupported (`unsupported_window`). |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 429 |  | Over 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). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 502 |  | Neither financial source succeeded (`executive_sources_failed`). |
| 503 |  | Both money sources are unconfigured (`executive_not_configured`), audit failed (`staff_audit_unavailable`), or the read exceeded 20 s (`staff_read_timeout`). |

### Example

```sh
curl "$NEXUS_URL/v1/staff/revenue" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fstaff%2Frevenue)

## Get staff executive

`GET /v1/staff/executive`

Customer token, signup and company history since October 2026, and observed agent adoption. Closed UTC days; staff only; audited.

Permission: `staff.read` (Owner, Admin).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `x-nexus-staff-viewer` | header | string | no | The dashboard's signed-in viewer, kept in the audit event as sent; never used for access |

### Responses

- `200` OK (application/json, StaffExecutive)
  - `scope` ("customers", required)
  - `window` (StaffWindow, required): Whole UTC days: from inclusive, until exclusive (the end of today).
    - `from` (string (date-time), required)
    - `until` (string (date-time), required)
    - `days` (integer, required)
  - `models` (array of ExecutiveModelDays | null, required)
    - `model` (string, required)
    - `openWeights` (boolean | null, required)
    - `daily` (array of ExecutiveCountDay, required)
      - `day` (string (date), required)
      - `value` (integer, required) [min 0]
  - `tokensError` (ExecutiveSourceError | null, required)
  - `signUps` (array of ExecutiveCountDay | null, required)
    - `day` (string (date), required)
    - `value` (integer, required) [min 0]
  - `signUpsError` (ExecutiveSourceError | null, required)
  - `customersToDate` (integer, required) [min 0]
  - `organizations` (array of ExecutiveCountDay, required)
    - `day` (string (date), required)
    - `value` (integer, required) [min 0]
  - `organizationsToDate` (integer, required) [min 0]
  - `adoption` (ExecutiveAdoption | null, required)
  - `adoptionError` (ExecutiveSourceError | null, required)
  - `provisional` (boolean, required)
- `400` Custom windows or histories longer than 3660 days are unsupported. (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `403` Not a person with a platform role who is one of Nexus's own people (`staff_required`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over 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, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `502` The customer classification or organization history could not be read. (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Custom windows or histories longer than 3660 days are unsupported. |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 429 |  | Over 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). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 502 |  | The customer classification or organization history could not be read. |
| 503 |  | The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) |

### Example

```sh
curl "$NEXUS_URL/v1/staff/executive" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fstaff%2Fexecutive)

## List staff invites

`GET /v1/staff/invites`

Every campaign code for invite-only sign-up, by label, with its uses and link. Staff only; audited as `staff.list_viewed`.

Permission: `staff.invites` (Owner, Admin).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `x-nexus-staff-viewer` | header | string | no | The dashboard's signed-in viewer, kept in the audit event as sent; never used for access |

### Responses

- `200` OK (application/json, CampaignCodeList)
  - `campaigns` (array of CampaignCode, required)
    - `label` (string, required): The campaign's name: lowercase letters, digits and inner hyphens
    - `code` (string, required): `<label>-<random tail>`
    - `link` (string, required): The sign-up link that carries the code: `/r/<code>` at the site's root
    - `maxUses` (integer, required) [min 1]
    - `used` (integer, required) [min 0]
    - `paid` (integer, required): How many of the people it brought in have paid: a credit purchase in their personal organization, of any amount. A later refund does not lower it [min 0]
    - `left` (integer, required): How many more people it admits now: 0 once revoked or past its end [min 0]
    - `expiresAt` (string (date-time) | null, required): When it stops admitting people; null with no end
    - `revoked` (boolean, required)
- `403` Not a person with a platform role who is one of Nexus's own people (`staff_required`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over 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, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 429 |  | Over 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). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) |

### Example

```sh
curl "$NEXUS_URL/v1/staff/invites" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fstaff%2Finvites)

## Create staff invite

`POST /v1/staff/invites`

Make a campaign code: `<label>-<random tail>`, admitting `uses` people until `until`. It earns no referral reward. Staff only; audited as `invite.created` in the platform audit stream, with the caller as its actor.

Permission: `staff.invites` (Owner, Admin).

### Request body (application/json, required)

- `label` (string, required): The campaign's name, trimmed and lowercased: a DNS label of at most 40 characters [max length 40]
- `uses` (integer, required): How many people it admits [min 1]
- `until` (string | null): Its end: an ISO time, or a `YYYY-MM-DD` day through its end in UTC. Absent: no end

### Responses

- `201` Created (application/json, CampaignCode)
  - `label` (string, required): The campaign's name: lowercase letters, digits and inner hyphens
  - `code` (string, required): `<label>-<random tail>`
  - `link` (string, required): The sign-up link that carries the code: `/r/<code>` at the site's root
  - `maxUses` (integer, required) [min 1]
  - `used` (integer, required) [min 0]
  - `paid` (integer, required): How many of the people it brought in have paid: a credit purchase in their personal organization, of any amount. A later refund does not lower it [min 0]
  - `left` (integer, required): How many more people it admits now: 0 once revoked or past its end [min 0]
  - `expiresAt` (string (date-time) | null, required): When it stops admitting people; null with no end
  - `revoked` (boolean, required)
- `400` The body is not valid (`invalid_invite`), the label is not a lowercase DNS label of at most 40 characters, `uses` is 0, or `until` is not a time or has passed (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `403` Not a person with a platform role who is one of Nexus's own people (`staff_required`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `409` The label has a campaign code already, revoked or not (`invite_exists`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over 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, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | The body is not valid (`invalid_invite`), the label is not a lowercase DNS label of at most 40 characters, `uses` is 0, or `until` is not a time or has passed |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 409 |  | The label has a campaign code already, revoked or not (`invite_exists`) |
| 429 |  | Over 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). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/staff/invites" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "CI",
    "uses": 1
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fstaff%2Finvites)

## Get staff invite

`GET /v1/staff/invites/{label}`

One campaign code by its label, any case, with its uses and link. Staff only; audited as `staff.list_viewed` with the label.

Permission: `staff.invites` (Owner, Admin).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `label` | path | string | yes |  |
| `x-nexus-staff-viewer` | header | string | no | The dashboard's signed-in viewer, kept in the audit event as sent; never used for access |

### Responses

- `200` OK (application/json, CampaignCode)
  - `label` (string, required): The campaign's name: lowercase letters, digits and inner hyphens
  - `code` (string, required): `<label>-<random tail>`
  - `link` (string, required): The sign-up link that carries the code: `/r/<code>` at the site's root
  - `maxUses` (integer, required) [min 1]
  - `used` (integer, required) [min 0]
  - `paid` (integer, required): How many of the people it brought in have paid: a credit purchase in their personal organization, of any amount. A later refund does not lower it [min 0]
  - `left` (integer, required): How many more people it admits now: 0 once revoked or past its end [min 0]
  - `expiresAt` (string (date-time) | null, required): When it stops admitting people; null with no end
  - `revoked` (boolean, required)
- `403` Not a person with a platform role who is one of Nexus's own people (`staff_required`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `404` No campaign code has this label (`unknown_invite`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over 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, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No campaign code has this label (`unknown_invite`) |
| 429 |  | Over 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). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | The read could not be audited (`staff_audit_unavailable`) or took longer than 20 s (`staff_read_timeout`) |

### Example

```sh
curl "$NEXUS_URL/v1/staff/invites/CI" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fstaff%2Finvites%2F%7Blabel%7D)

## Revoke staff invite

`DELETE /v1/staff/invites/{label}`

Revoke a campaign code: it admits no one after. Revoking twice answers the same and writes one event. Staff only; audited as `invite.revoked` in the platform audit stream, with the caller as its actor.

Permission: `staff.invites` (Owner, Admin).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `label` | path | string | yes |  |

### Responses

- `200` The code, now revoked (application/json, CampaignCode)
  - `label` (string, required): The campaign's name: lowercase letters, digits and inner hyphens
  - `code` (string, required): `<label>-<random tail>`
  - `link` (string, required): The sign-up link that carries the code: `/r/<code>` at the site's root
  - `maxUses` (integer, required) [min 1]
  - `used` (integer, required) [min 0]
  - `paid` (integer, required): How many of the people it brought in have paid: a credit purchase in their personal organization, of any amount. A later refund does not lower it [min 0]
  - `left` (integer, required): How many more people it admits now: 0 once revoked or past its end [min 0]
  - `expiresAt` (string (date-time) | null, required): When it stops admitting people; null with no end
  - `revoked` (boolean, required)
- `403` Not a person with a platform role who is one of Nexus's own people (`staff_required`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `404` No campaign code has this label (`unknown_invite`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over 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, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): 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.
    - `code` (string): 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.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No campaign code has this label (`unknown_invite`) |
| 429 |  | Over 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). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X DELETE "$NEXUS_URL/v1/staff/invites/CI" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#delete%3A%2Fv1%2Fstaff%2Finvites%2F%7Blabel%7D)
