Skip to content

Create



POST /api/v1/workspace/member_group/add

Overview

Create a workspace team and its member and role associations.

Prerequisites and Usage Steps

First, prepare workspace members through Workspace Member List, and select roles assignable to the team through Role List. Team roles can be inherited by members. After changes, the alert cache is cleared and permissions are asynchronously refreshed. Do not treat a successful response as indicating that all logged-in sessions have been refreshed immediately. Creation does not automatically filter out invalid members or arbitrary custom role UUIDs; you must use actual values from the preceding lists. Deduplicating member UUIDs is recommended. Database and subsequent cache/task processing are performed in separate steps. After a timeout or 500, first check the list or details to confirm the result to avoid duplicate creation or overwriting new configurations.

Request Headers

Parameter Name Type Required Description
DF-API-KEY string Y OpenAPI authentication credential for the workspace.
Example: <DF-API-KEY>
How to obtain or enter: Obtain an OpenAPI Key with permission for this operation from API Key Management in the target workspace.

Body Request Parameters

Parameter Name Type Required Description
accountUUIDs[*] string A single workspace member account UUID string. During modification, UUIDs outside the current member scope are filtered out; during creation, this API does not verify that members actually exist.
Example: acnt_example
How to obtain or enter: Obtain from the member uuid returned by Workspace Member List.
roleUUIDs[*] string A single role UUID string. Creation does not guarantee that any custom UUID is valid; use actual values from the list.
Example: role_example
How to obtain or enter: Copy from the role uuid in Role List, excluding owner and wsAdmin.
name string Y Team name, up to 48 characters; active teams in the same workspace cannot have duplicate names.
Null allowed: False
Maximum length: 48
Example: 生产运维
How to obtain or enter: Use Team List to check existing names in the workspace and enter a non-empty name.
accountUUIDs array Complete member UUID array. Omitting it or setting it to null during creation does not add members; during modification, it is required and fully replaces members. [] clears members; null causes an internal error and cannot replace [].
Null allowed: True
Example: ["acnt_example"]
How to obtain or enter: Obtain the actual member UUIDs of this workspace from Workspace Member List; membersNotInGroup in details can also provide candidates.
roleUUIDs array Complete array of roles associated with the team. Omitting it or setting it to null during creation does not add roles; during modification, it is required and fully replaces roles. [] or null clears roles; explicitly using [] is recommended. Owner or administrator roles cannot be granted through teams.
Null allowed: True
Example: ["role_example"]
How to obtain or enter: Obtain assignable role UUIDs from Role List; owner or wsAdmin cannot be used.

Additional Parameter Notes

The creation response provides only the uuid and does not return the complete team entity; the modification response is true. Read the actual members and roles through the list or details.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/workspace/member_group/add' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"name":"生产运维","accountUUIDs":["acnt_example"],"roleUUIDs":["role_example"]}'

Response

HTTP 200, application/json. The example below shows the main fields that can be read directly.

Field Type Description
content object Creation result.
content.uuid string UUID of the newly created team.
content.declaration object or null Workspace common declaration.
{
  "code": 200,
  "content": {
    "uuid": "group_example",
    "declaration": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Response

For authentication, rate limiting, and common request errors, see Common Error Definitions.

HTTP Status errorCode Trigger Condition Message or Response Description Resolution
406 ft.ParameterValidationFailed Request field is missing, or the field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
400 ft.RequestJsonFormatError Invalid request JSON syntax Request JSON format error Fix the JSON according to content.reason, line, and column.
400 ft.JsonFormatError The top level of JSON is not an object Some JSON file format error Use a single JSON object.
400 ft.MemberGroupNameExists An active team with the same name already exists in this workspace A team with the same name already exists Query existing names and choose an unused team name.
400 ft.TeamRoleAddPermissionError roleUUIDs contains owner or wsAdmin Team roles cannot be administrator or owner Remove the owner/administrator identifiers and use only allowed roles; this API cannot bypass team authorization restrictions.
406 ft.MissingParameters Team name is empty Parameter missing Provide a non-empty name.
500 ft.InternalServerError Database, notification cache cleanup, asynchronous permission refresh submission, or audit failure Internal error First check whether the team configuration has taken effect, and decide whether to retry after confirmation; record traceId. In modify, accountUUIDs=null may also cause this error; use an explicit array.

Feedback

Is this page helpful?