Add Members (Deployment Plan)¶
POST /api/v1/workspace/member/batch_add
Overview¶
In the Deployment Plan, existing site accounts are added to the current workspace in batches and granted roles.
Prerequisites and Usage Steps¶
This endpoint is supported only in the Deployment Plan; SaaS calls are rejected. First prepare accounts that already exist but have not yet been directly added to this workspace, along with roles available in this workspace. All target accounts use the same role array, and no invitation emails are sent. If any account or role has an invalid value, an error is returned first; if the request contains members that have already been directly added, it is also rejected — this is not an idempotent authorization-update endpoint. An empty account or role array may directly return true, which does not indicate that any actual addition was completed. All operations target the workspace that owns the current DF-API-KEY; for cross-workspace operations, switch to the corresponding Key and site Endpoint. Processing of memberships, roles, tokens, and caches may be saved in multiple steps; after an exception or timeout, read the member and role status first, then decide whether to retry.
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 specify: Obtain an OpenAPI Key with this operation permission from the API Key management of the target workspace. |
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| accountUUIDs[*] | string | A single string identifier within the array. Example: acnt_exampleHow to obtain or specify: Deployment Plan only: first create or search for accounts that have not yet joined this workspace in the site account management, and obtain the acnt_ UUID; this endpoint does not create site accounts. |
|
| roleUUIDs[*] | string | A single string identifier within the array. Example: readOnlyHow to obtain or specify: Obtain roles available in the current workspace from content.data[].uuid of the role list. Built-in identifiers: wsAdmin (administrator), general (standard member), readOnly (read-only member); identifiers starting with role_ are custom roles. |
|
| accountUUIDs | array | Y | Array of UUIDs of existing site accounts to add to this workspace; duplicates are removed automatically, and identifiers identical to the current calling identity are skipped. Allows null: False Example: ["acnt_example"]How to obtain or specify: Deployment Plan only: first create or search for accounts that have not yet joined this workspace in the site account management, and obtain the acnt_ UUID; this endpoint does not create site accounts. |
| roleUUIDs | array | Y | Array of role UUIDs assigned uniformly to each new member; must not contain owner. At least one valid role is recommended. Allows null: False Example: ["readOnly"]How to obtain or specify: Obtain roles available in the current workspace from content.data[].uuid of the role list. Built-in identifiers: wsAdmin (administrator), general (standard member), readOnly (read-only member); identifiers starting with role_ are custom roles. |
Additional Parameter Notes¶
The same site account can have different roles in different workspaces. This endpoint does not return per-account results; after success, verify through the member list.
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/workspace/member/batch_add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"accountUUIDs":["acnt_example"],"roleUUIDs":["readOnly"]}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content | boolean | Returns true for the add operation; it may also be true for an empty array or when there is no valid target to add. |
{
"code": 200,
"content": true,
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | A request field is missing, or a field value violates the declared validation conditions | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | The request JSON syntax is invalid | Request JSON format error | Fix the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | The JSON top level is not an object | Some json file format errors | Submit a single JSON object. |
| 400 | ft.OnlySupportPaasVersion | This Deployment Plan endpoint is called on a SaaS site | Only paas version is supported | For SaaS, use the email invitation or console authorization flow. |
| 400 | ft.InvalidAccountUUID | The account UUID does not exist at the site or its status does not meet requirements | Invalid account UUID: {} | Obtain a valid account UUID again from the site account management. |
| 400 | ft.InvalidRoleUUID | roleUUIDs contains a role that is unavailable or deleted in the current workspace | Invalid role UUID: {} | Read the role list again and use a valid UUID. |
| 400 | ft.ForbiddenBatchAddOwner | The role array contains owner | Invalid operation, cannot batch add owners | Use the dedicated process for owner transfer. |
| 404 | ft.MemberAlreadyExistsInWorkspace | Any target account has already been directly added to this workspace | These members already exist in the workspace | Remove the existing members; to change roles, use member modification. |
| 401 | ft.WKSPNotExistOrReleased | The current workspace has been deleted or released | Workspace does not exist/or has been released | Check the Key and the workspace status. |
| 500 | ft.InternalServerError | Data saving, associated resource, or cache processing failed | Internal error | Check the current status of members and permissions first, then decide whether to retry; if the failure persists, provide the traceId and a redacted request. |