Skip to content
Niu DocsNiu 牛元文档
Dashboard控制台

Change a scoped customer member role

Generated from the checked-in source. Do not edit this reference by hand.

PATCH /api/v1/operators/{operator}

Current scoped Owner management permission or installation administrator required. Admin and Viewer cannot manage user roles. Preserves the original member organization/workspace, credentials, sessions, session expiries and Provider memberships. Rejects self role changes, revoked/noncustomer/platform actors and role-update demotion of the last applicable active Owner. expected_role is a compare-and-set precondition; stale input returns 409 and requires reloading. Organization-scoped serialization and current actor/session validation protect the mutation transaction. A same-role request with a matching precondition returns unchanged metadata without an audit event. Changed roles apply to the original token on its next authenticated request; no replacement token or renewed session is issued. A future immutable role_changed journal records exact before/after roles and actor attribution; historical roles are never inferred. No credentials or commercial data returned.

Operation: updateOperatorRole.

Use the credential and permission scope described above. Each object below is an alternative; schemes within one object are required together.

JSON
[
{
"bearerAuth": []
}
]

Set NIU_ORIGIN to your installation origin (without /v1). Replace path, query and header placeholders with the required values. Query examples use curl 7.87 or newer to encode values with --url-query. Use the credential scope described above; a bearer token must have the authority required by this operation.

Shell
curl --fail-with-body -X PATCH "$NIU_ORIGIN/api/v1/operators/{operator}" \
-H "Authorization: Bearer $NIU_BEARER_TOKEN" \
-H 'Content-Type: application/json' \
--data @request.json

Location: path. Required. Scoped Niu user routing reference; never display as a product label.

JSON
{
"type": "string",
"format": "uuid"
}

Required.

JSON
{
"type": "object",
"additionalProperties": false,
"required": [
"role",
"expected_role"
],
"properties": {
"role": {
"type": "string",
"enum": [
"owner",
"admin",
"viewer"
]
},
"expected_role": {
"type": "string",
"enum": [
"owner",
"admin",
"viewer"
]
}
}
}

Current scoped user metadata; no credential or session renewal

Response headers:

JSON
{
"Cache-Control": {
"schema": {
"type": "string"
},
"description": "no-store"
}
}

Content type: application/json.

JSON
{
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"type": "object",
"required": [
"id",
"name",
"role",
"organization_id",
"project_id",
"revoked"
],
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"name": {
"type": "string"
},
"role": {
"type": "string",
"enum": [
"owner",
"admin",
"viewer"
]
},
"organization_id": {
"type": [
"string",
"null"
],
"format": "uuid"
},
"project_id": {
"type": [
"string",
"null"
],
"format": "uuid"
},
"revoked": {
"type": "boolean"
}
}
}
}
}

Invalid role/input or protected customer actor

Invalid, expired or concurrently revoked management session

Manage-users permission denied or self role change

User outside the actor scope or not a customer user

Stale expected role, revoked user or last Owner protection

Body exceeds bounded request size

Storage unavailable

Current scoped Owner management permission or installation administrator required. Admin and Viewer cannot manage user roles. Preserves the original member organization/workspace, credentials, sessions, session expiries and Provider memberships. Rejects self role changes, revoked/noncustomer/platform actors and role-update demotion of the last applicable active Owner. expected_role is a compare-and-set precondition; stale input returns 409 and requires reloading. Organization-scoped serialization and current actor/session validation protect the mutation transaction. A same-role request with a matching precondition returns unchanged metadata without an audit event. Changed roles apply to the original token on its next authenticated request; no replacement token or renewed session is issued. A future immutable role_changed journal records exact before/after roles and actor attribution; historical roles are never inferred. No credentials or commercial data returned.

Supported scope: implemented