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

API reference

Teams

Teams, the levels between the organization and the person, kept in Gateway (the sign-in provider has no teams). Teams nest: a team may have a parent team (no cycles, at most 10 levels) and a level, a free-text label each organization chooses. Someone added by an email not in the organization yet is a pending member until they join it. An organization can load its whole tree from a file (POST /v1/teams/import). Owners and admins create, rename and delete teams and manage their members; every member reads them and sets their own default team. Spend is attributed to the team named with x-nexus-team (or a team field), else the caller's default team. Team caps and person budgets are built: see Budgets. Team model policies are built: see Models.

View as Markdown

List teams

get/v1/teams

The organization's teams, with member counts, your role in each and your default team (every member). With tree=1: the teams nested under their parents, with leads and headcount. The list (not the tree) pages with limit and cursor.

teams.useEvery memberTry it in the API Explorer

Parameters

  • treequery · "1"

    1: return tree (nested) instead of teams

  • depthquery · integer

    With tree=1: how many levels to return

  • limitquery · integer

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

  • cursorquery · string

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

Responses

200OKapplication/json

  • teamsarray of Team
    • idstringrequired
    • slugstringrequired
    • namestringrequired
    • descriptionstring
    • createdAtstring (date-time)required
    • membersintegerrequired
    • myRole"lead" | "member"

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

    • isDefaultboolean
    • parentIdstring

      The parent team's id; absent for a top-level team.

    • parentstring

      The parent team's slug.

    • levelstring

      The organization's own label for the team's level (e.g. department).

    • depthintegerrequired

      1 for a top-level team.

    • pendingintegerrequired

      People added by email who have not joined the organization yet.

    • childCountintegerrequired
  • defaultstring | null
  • treearray of TeamNode

    With tree=1: the top-level teams.

    • idstringrequired
    • slugstringrequired
    • namestringrequired
    • descriptionstring
    • createdAtstring (date-time)required
    • membersintegerrequired
    • myRole"lead" | "member"

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

    • isDefaultboolean
    • parentIdstring

      The parent team's id; absent for a top-level team.

    • parentstring

      The parent team's slug.

    • levelstring

      The organization's own label for the team's level (e.g. department).

    • depthintegerrequired

      1 for a top-level team.

    • pendingintegerrequired

      People added by email who have not joined the organization yet.

    • leadsarray of object
      • userIdstring
      • emailstring
      • namestring
      • pendingboolean
    • headcountinteger

      Distinct people in the team and every team under it, pending ones included.

    • childrenarray of TeamNode

      Each has the same shape as TeamNode.

  • nextCursorstring

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

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

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

Errors

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

Example

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

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

Create team

post/v1/teams

Create a team (owners and admins), optionally under a parent team and with a level label. The slug is unique in the organization and follows the org slug rule (pending and import are reserved). An organization holds at most 2,000 teams: the next is refused with 409 team_limit.

teams.manageOwner, AdminTry it in the API Explorer

Parameters

  • Idempotency-Keyheader · string

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

Request body · application/json

  • slugstringrequired
  • namestring
  • descriptionstring
  • parentstring | null

    The parent team's slug or id; absent or null for a top-level team.

  • levelstring

    A short label of the organization's choosing: 1 to 32 lower-case letters, digits or dashes.

Responses

201Createdapplication/json

  • idstringrequired
  • slugstringrequired
  • namestringrequired
  • descriptionstring
  • createdAtstring (date-time)required
  • membersintegerrequired
  • myRole"lead" | "member"

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

  • isDefaultboolean
  • parentIdstring

    The parent team's id; absent for a top-level team.

  • parentstring

    The parent team's slug.

  • levelstring

    The organization's own label for the team's level (e.g. department).

  • depthintegerrequired

    1 for a top-level team.

  • pendingintegerrequired

    People added by email who have not joined the organization yet.

  • childCountintegerrequired
  • memberListarray of TeamMember
    • userIdstringrequired
    • emailstring
    • namestring
    • role"lead" | "member"required

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

    • isDefaultbooleanrequired
    • joinedAtstring (date-time)required
  • pendingListarray of PendingMember
    • idstringrequired
    • teamIdstringrequired
    • teamstringrequired

      The team's slug.

    • emailstringrequired
    • role"lead" | "member"required

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

    • homebooleanrequired

      Becomes their default team when they join.

    • addedBystring
    • createdAtstring (date-time)required
  • patharray of TeamLink

    The team's ancestors, top level first; the last is its parent.

    • idstringrequired
    • slugstringrequired
    • namestringrequired
    • levelstring
  • childrenarray of TeamLink & object
    • idstringrequired
    • slugstringrequired
    • namestringrequired
    • levelstring
    • membersinteger
    • pendinginteger
    • childCountinteger

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

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

Errors

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

Example

curl
curl -X POST "$NEXUS_URL/v1/teams" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "web",
    "name": "Web",
    "parent": "engineering",
    "level": "department"
  }'
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.createTeam({ slug: "platform", name: "Platform", parent: "engineering", level: "team" });

List pending team members

get/v1/teams/pending

Pending team members: people added by an email not in the organization yet (owners and admins). With by=person, one row per email with all their teams and their home team, and whether Gateway can invite them.

teams.manageOwner, AdminTry it in the API Explorer

Parameters

  • teamquery · string

    Only this team (slug)

  • byquery · "entry" | "person"

    person: group by email (people); default: one row per pending membership (pending)

Responses

200OKapplication/json

object | object

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

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

Errors

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

Example

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

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

Cancel pending team members

DEL/v1/teams/pending

Cancel pending team members (owners and admins): one by id, or every one for an email (optionally in one team).

teams.manageOwner, AdminTry it in the API Explorer

Parameters

  • idquery · string
  • emailquery · string
  • teamquery · string
  • Idempotency-Keyheader · string

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

Responses

200OKapplication/json

  • cancelledarray of PendingMember
    • idstringrequired
    • teamIdstringrequired
    • teamstringrequired

      The team's slug.

    • emailstringrequired
    • role"lead" | "member"required

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

    • homebooleanrequired

      Becomes their default team when they join.

    • addedBystring
    • createdAtstring (date-time)required

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

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

Errors

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

Example

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

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.cancelPendingTeamMembers({ email: "new-hire@example.com" });

Import teams

post/v1/teams/import

Load the organization's teams from a file, in one transaction (owners and admins). Teams are matched by slug: missing ones are created, existing ones moved, renamed and relabelled; leads and members are set by email (pending for emails not in the organization yet) and home sets default teams. Idempotent: the same file twice changes nothing the second time. dryRun returns the same diff and changes nothing; prune also removes what the file does not list (never spend). A dry run returns a plan (a hash of the diff): apply with plan set to it and Gateway refuses (409 plan_changed) if the organization changed since, so exactly the reviewed changes apply. An import that would leave more than 2,000 teams in the organization, and adds any, is refused with 409 team_limit.

teams.manageOwner, AdminTry it in the API Explorer

Parameters

  • Idempotency-Keyheader · string

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

Request body · application/json

  • unitsarray of objectrequired
    • slugstringrequired
    • namestring
    • levelstring | null
    • parentstring | null

      The parent team's slug; absent or null for a top-level team.

    • descriptionstring | null
    • leadsarray of string (email) | object
    • membersarray of string (email) | object
  • dryRunboolean

    Report the diff and change nothing.

  • pruneboolean

    Also remove memberships and pending entries the file does not list from its teams, and delete teams it does not list (their spend stays).

  • planstring

    A dry run's plan: apply only if the result is still exactly that (else 409 plan_changed).

    pattern ^[0-9a-f]{16}$

Responses

200OKapplication/json

  • dryRunbooleanrequired
  • prunebooleanrequired
  • createdarray of stringrequired
  • movedarray of objectrequired
    • slugstring
    • fromstring
    • tostring
  • renamedarray of objectrequired
    • slugstring
    • fromstring
    • tostring
  • relevelledarray of objectrequired
    • slugstring
    • fromstring
    • tostring
  • membershipsAddedarray of objectrequired
    • teamstring
    • emailstring
    • rolestring
  • rolesChangedarray of objectrequired
    • teamstring
    • emailstring
    • fromstring
    • tostring
  • membershipsRemovedarray of objectrequired
    • teamstring
    • emailstring
    • rolestring
  • pendingarray of objectrequired
    • teamstring
    • emailstring
    • rolestring
  • pendingRemovedarray of objectrequired
    • teamstring
    • emailstring
  • defaultsarray of objectrequired
    • emailstring
    • teamstring
    • pendingboolean
  • deletedarray of stringrequired
  • warningsarray of stringrequired
  • totalsobjectrequired
    • teamsinteger
    • membershipsinteger
    • pendinginteger
  • planstringrequired

    A short hash of this diff; pass it back as plan to apply exactly what a dry run showed.

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

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409plan_changedApply with `plan` set to it and Gateway refuses (409 `plan_changed`) if the organization changed since, so exactly the reviewed changes apply
409team_limitAn import that would leave more than 2,000 teams in the organization, and adds any, is refused with 409 `team_limit`
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl -X POST "$NEXUS_URL/v1/teams/import" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "units": [
      {
        "slug": "engineering",
        "level": "department",
        "leads": [
          {
            "email": "lead@example.com"
          }
        ]
      },
      {
        "slug": "platform",
        "parent": "engineering",
        "level": "team",
        "members": [
          {
            "email": "dev@example.com",
            "home": true
          }
        ]
      }
    ],
    "dryRun": true
  }'
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.importTeams({ units: [{ slug: "platform", parent: "engineering", members: ["ada@example.com"] }], dryRun: true });

Get team

get/v1/teams/{slug}

A team, its members, pending members, path (ancestors) and child teams (every member).

teams.useEvery memberTry it in the API Explorer

Parameters

  • slugpath · stringrequired

Responses

200OKapplication/json

  • idstringrequired
  • slugstringrequired
  • namestringrequired
  • descriptionstring
  • createdAtstring (date-time)required
  • membersintegerrequired
  • myRole"lead" | "member"

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

  • isDefaultboolean
  • parentIdstring

    The parent team's id; absent for a top-level team.

  • parentstring

    The parent team's slug.

  • levelstring

    The organization's own label for the team's level (e.g. department).

  • depthintegerrequired

    1 for a top-level team.

  • pendingintegerrequired

    People added by email who have not joined the organization yet.

  • childCountintegerrequired
  • memberListarray of TeamMember
    • userIdstringrequired
    • emailstring
    • namestring
    • role"lead" | "member"required

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

    • isDefaultbooleanrequired
    • joinedAtstring (date-time)required
  • pendingListarray of PendingMember
    • idstringrequired
    • teamIdstringrequired
    • teamstringrequired

      The team's slug.

    • emailstringrequired
    • role"lead" | "member"required

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

    • homebooleanrequired

      Becomes their default team when they join.

    • addedBystring
    • createdAtstring (date-time)required
  • patharray of TeamLink

    The team's ancestors, top level first; the last is its parent.

    • idstringrequired
    • slugstringrequired
    • namestringrequired
    • levelstring
  • childrenarray of TeamLink & object
    • idstringrequired
    • slugstringrequired
    • namestringrequired
    • levelstring
    • membersinteger
    • pendinginteger
    • childCountinteger

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

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

Errors

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

Example

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

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

Update team

patch/v1/teams/{slug}

Change a team (owners and admins): its slug, name, description or level, or move it under another parent (parent: null makes it top-level; no cycles, at most 10 levels). Past spend keeps the slug it had; a moved team keeps its history and rollups follow the current tree.

teams.manageOwner, AdminTry it in the API Explorer

Parameters

  • slugpath · stringrequired
  • Idempotency-Keyheader · string

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

Request body · application/json

  • slugstring
  • namestring
  • descriptionstring | null
  • parentstring | null

    The new parent's slug or id, or null for the top level.

  • levelstring | null

    The level label; null clears it.

Responses

200OKapplication/json

  • idstringrequired
  • slugstringrequired
  • namestringrequired
  • descriptionstring
  • createdAtstring (date-time)required
  • membersintegerrequired
  • myRole"lead" | "member"

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

  • isDefaultboolean
  • parentIdstring

    The parent team's id; absent for a top-level team.

  • parentstring

    The parent team's slug.

  • levelstring

    The organization's own label for the team's level (e.g. department).

  • depthintegerrequired

    1 for a top-level team.

  • pendingintegerrequired

    People added by email who have not joined the organization yet.

  • childCountintegerrequired
  • memberListarray of TeamMember
    • userIdstringrequired
    • emailstring
    • namestring
    • role"lead" | "member"required

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

    • isDefaultbooleanrequired
    • joinedAtstring (date-time)required
  • pendingListarray of PendingMember
    • idstringrequired
    • teamIdstringrequired
    • teamstringrequired

      The team's slug.

    • emailstringrequired
    • role"lead" | "member"required

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

    • homebooleanrequired

      Becomes their default team when they join.

    • addedBystring
    • createdAtstring (date-time)required
  • patharray of TeamLink

    The team's ancestors, top level first; the last is its parent.

    • idstringrequired
    • slugstringrequired
    • namestringrequired
    • levelstring
  • childrenarray of TeamLink & object
    • idstringrequired
    • slugstringrequired
    • namestringrequired
    • levelstring
    • membersinteger
    • pendinginteger
    • childCountinteger

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

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

Errors

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

Example

curl
curl -X PATCH "$NEXUS_URL/v1/teams/platform" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "parent": "engineering",
    "level": "team"
  }'
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.updateTeam("platform", { parent: "engineering", level: "team" });

Delete team

DEL/v1/teams/{slug}

Delete a team and its memberships (owners and admins). A team with child teams is refused (409 has_children) unless cascade=1, which deletes the whole subtree. Spend attributed to any of them keeps the team's id and slug.

teams.manageOwner, AdminTry it in the API Explorer

Parameters

  • slugpath · stringrequired
  • cascadequery · "1"

    1: also delete every team under it

  • Idempotency-Keyheader · string

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

Responses

200OKapplication/json

  • deletedboolean
  • idstring
  • slugstring
  • teamsarray of string

    Every team deleted (slugs).

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

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

Errors

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

Example

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

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

Add team member

post/v1/teams/{slug}/members

Add someone to a team, by userId or email (owners and admins). An email of someone not in the organization yet is kept as a pending membership (202) until they join it. The first team someone joins becomes their default, unless home makes this one it.

teams.manageOwner, AdminTry it in the API Explorer

Parameters

  • slugpath · stringrequired
  • Idempotency-Keyheader · string

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

Request body · application/json

  • userIdstring
  • emailstring
  • role"lead" | "member"

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

  • homeboolean

    Make this their default (home) team; for a pending member, when they join.

Responses

201Createdapplication/json

  • teamstring
  • memberTeamMember
    • userIdstringrequired
    • emailstring
    • namestring
    • role"lead" | "member"required

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

    • isDefaultbooleanrequired
    • joinedAtstring (date-time)required
  • pendingfalse

202Pending: not in the organization yetapplication/json

  • pendingtrue
  • teamstring
  • entryPendingMember

    Someone added to a team by an email not in the organization yet; they join the team when they join the organization.

    • idstringrequired
    • teamIdstringrequired
    • teamstringrequired

      The team's slug.

    • emailstringrequired
    • role"lead" | "member"required

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

    • homebooleanrequired

      Becomes their default team when they join.

    • addedBystring
    • createdAtstring (date-time)required

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

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

Errors

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

Example

curl
curl -X POST "$NEXUS_URL/v1/teams/platform/members" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "ada@example.com",
    "role": "member",
    "home": true
  }'
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.addTeamMember("platform", { email: "ada@example.com", role: "member", home: true });

Remove team member

DEL/v1/teams/{slug}/members/{userId}

Take someone out of a team (owners and admins). If it was their default, another of their teams becomes it.

teams.manageOwner, AdminTry it in the API Explorer

Parameters

  • slugpath · stringrequired
  • userIdpath · stringrequired
  • Idempotency-Keyheader · string

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

Responses

200OKapplication/json

object

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

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

Errors

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

Example

curl
curl -X DELETE "$NEXUS_URL/v1/teams/platform/members/user_123" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

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

Set default team

put/v1/people/{userId}/default-team

Set a default team: your own (me), among the teams you are in; anyone's for owners and admins. {"team": null} clears it.

teams.useEvery memberTry it in the API Explorer

Parameters

  • userIdpath · stringrequired

    A user id, or me

  • Idempotency-Keyheader · string

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

Request body · application/json

  • teamstring | nullrequired

Responses

200OKapplication/json

object

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

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

Errors

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

Example

curl
curl -X PUT "$NEXUS_URL/v1/people/user_123/default-team" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "team": "web"
  }'
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

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

Get team budget

get/v1/teams/{slug}/budget

A team's cap, as the caller may see it. An owner or admin gets the cap on that team and nothing from the teams above it (scope: cap): its limit, period, mode, spent, reserved, what is left and when it resets. A member of the team gets only what is left for them along the team's path, with the period and reset of the cap that binds (scope: own); the limit, spent and reserved of a team above theirs are never shown. budget is null when no cap applies. 404 unknown_team; 403 not_in_team for a member who is not in the team.

teams.useEvery memberTry it in the API Explorer

Parameters

  • slugpath · stringrequired

Responses

200OKapplication/json

  • teamobjectrequired
    • slugstringrequired
    • namestringrequired
  • scope"cap" | "own"required

    cap: an owner or admin reads the cap on this team. own: a member reads what is left for them.

  • budgetobject | nullrequired

    The cap on this team (cap), or the cap that binds along the team's path (own); null when none applies

    • remainingUsdnumberrequired

      What is left for the period, never below 0. Deprecated: read remainingUsdDecimal, the exact decimal string (root rule 9).

    • remainingUsdDecimalstring

      remainingUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to remainingUsd.

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

      How often the cap resets

    • resetsAtstring (date-time)required
    • limitUsdnumber

      Owners and admins only (scope: cap). Deprecated: read limitUsdDecimal, the exact decimal string (root rule 9).

    • limitUsdDecimalstring

      limitUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to limitUsd.

    • mode"hard_stop"

      Owners and admins only

    • spentUsdnumber

      Owners and admins only: settled this period, in the team and the teams under it. Deprecated: read spentUsdDecimal, the exact decimal string (root rule 9).

    • spentUsdDecimalstring

      spentUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to spentUsd.

    • reservedUsdnumber

      Owners and admins only: held by calls in progress. Deprecated: read reservedUsdDecimal, the exact decimal string (root rule 9).

    • reservedUsdDecimalstring

      reservedUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to reservedUsd.

    • updatedAtstring (date-time)

      Owners and admins only

  • canManagebooleanrequired

    Whether the caller may set the cap (owners and admins)

403A member who is not in the team (`not_in_team`)application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

404No such team (`unknown_team`)application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

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

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

Errors

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

Example

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

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

Set team budget

put/v1/teams/{slug}/budget

Set a team's cap (owners and admins): an amount in US dollars per day, week or month, counted for the team and every team under it, and a stop mode. hard_stop refuses the call; warn and approval answer 400 mode_not_available until they are built. Cutting a cap below what the team used refuses the next call and leaves calls in progress alone. Audited as budget.team_changed, before and after. With dryRun: true it checks and answers the same, and changes nothing. The amount is amountUsd (a number, deprecated, or a decimal string) or amountUsdDecimal, read exactly. 400 invalid_amount, too_many_decimals, amount_mismatch, invalid_period, invalid_mode; 404 unknown_team.

budgets.manageOwner, AdminTry it in the API Explorer

Parameters

  • slugpath · stringrequired
  • Idempotency-Keyheader · string

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

Request body · application/json

  • amountUsdnumber | string

    The cap for the period; 0 refuses every call. The cap for the period in US dollars: a JSON number (deprecated) or a decimal string with at most 6 decimals ("12.245"), read exactly. Send amountUsdDecimal instead to send only a string.

    min 0 · max 1000000

  • amountUsdDecimalstring

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

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

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

    UTC calendar day, ISO week (from Monday) or month

  • mode"hard_stop" | "warn" | "approval"

    Only hard_stop is available; the others answer 400 mode_not_available

    default "hard_stop"

  • warnAtPercentnumber

    For mode warn, which is not available yet

  • dryRunboolean

    Check the cap and answer what would change; change nothing

Responses

200OKapplication/json

  • dryRunbooleanrequired
  • teamobjectrequired
    • slugstringrequired
    • namestringrequired
  • beforeobject | nullrequired
    • limitUsdnumberrequired

      Deprecated: read limitUsdDecimal, the exact decimal string (root rule 9).

    • limitUsdDecimalstring

      limitUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to limitUsd.

    • period"day" | "week" | "month"required
    • mode"hard_stop"required
  • afterobjectrequired
    • limitUsdnumberrequired

      Deprecated: read limitUsdDecimal, the exact decimal string (root rule 9).

    • limitUsdDecimalstring

      limitUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to limitUsd.

    • period"day" | "week" | "month"required
    • mode"hard_stop"required

400Not a valid cap (`invalid_amount`, `too_many_decimals`, `amount_mismatch`, `invalid_period`, `invalid_mode`, `mode_not_available`)application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

403Only owners and admins set a cap (`role_required`): a member without `budgets.manage`application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

404No such team (`unknown_team`)application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

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

  • errorobject
    • messagestringrequired
    • typestringrequired

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

    • codestring

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

    • paramstring

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

    • nexusobject

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

    • minimumstring

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

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400Not a valid cap (`invalid_amount`, `too_many_decimals`, `amount_mismatch`, `invalid_period`, `invalid_mode`, `mode_not_available`)
400mode_not_available`hard_stop` refuses the call; `warn` and `approval` answer 400 `mode_not_available` until they are built
400invalid_amount400 `invalid_amount`, `too_many_decimals`, `amount_mismatch`, `invalid_period`, `invalid_mode`; 404 `unknown_team`
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such team (`unknown_team`)
404unknown_team400 `invalid_amount`, `too_many_decimals`, `amount_mismatch`, `invalid_period`, `invalid_mode`; 404 `unknown_team`
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl -X PUT "$NEXUS_URL/v1/teams/platform/budget" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"