Batch Enable/Disable Member Personal API Keys¶
POST /api/v1/workspace/member/personal_api_key/enable/modify
Overview¶
Batch enable or disable members' ability to use personal API Keys in the current workspace.
Prerequisites and Usage Steps¶
Obtain member UUIDs from the Workspace Member List, then submit non-empty accountUUIDs and the 0/1 switch. Accounts are deduplicated and null values are ignored; targets must be valid members with direct or inherited roles in the current workspace; owners cannot be disabled. The member switch is saved, and existing user and agent personal key records are enabled/disabled accordingly, with the corresponding authentication caches cleared; enabling does not create or return a key, and deleted keys are not rebuilt on this basis. The returned updated is the number of deduplicated target members in this request, not the number of keys whose state actually changed. Then query enablePersonalAPIKey in the member list to confirm the switch; actual usage must also satisfy member roles and API permissions. Processing of member relationships, roles, tokens, and caches may be saved in steps; after an exception or timeout, read the member and role status first, then decide whether to retry.
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to obtain or fill: Obtain an OpenAPI Key with this operation permission from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| accountUUIDs[*] | string | A single string identifier in the array. Example: acnt_exampleHow to obtain or fill: Obtain the account UUID of a member in the current workspace from content.data[].uuid in the Workspace Member List. This is not an API Key UUID or an email address. |
|
| accountUUIDs | array | Y | Array of target account UUIDs. Pass actual members of the same workspace as non-empty strings. Allows null: False Example: ["acnt_example"]How to obtain or fill: Obtain the account UUID of a member in the current workspace from content.data[].uuid in the Workspace Member List. This is not an API Key UUID or an email address. |
| enablePersonalAPIKey | integer | Y | Required integer; only 0 or 1 is allowed; not a JSON boolean or string. Allows null: False Allowed values: [0, 1] Example: 0How to obtain or fill: Fill in 0 to disallow target members from using personal keys in this workspace, or 1 to allow. |
Additional Parameter Notes¶
Use the integer 0/1 declared by the current public parameters. Other types supported by the controller are not part of the public call format; this endpoint does not return any key content.
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/workspace/member/personal_api_key/enable/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"accountUUIDs":["acnt_example"],"enablePersonalAPIKey":0}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.updated | integer | Number of deduplicated non-empty members processed in this request. |
| content.declaration | object or null | Workspace common declaration. |
{
"code": 200,
"content": {
"updated": 1,
"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 | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | A 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 | 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 error | Submit a single JSON object. |
| 406 | ft.MissingParameters | The account array is empty or the switch field is missing | Missing parameters | Submit at least one member UUID and provide enablePersonalAPIKey. |
| 404 | ft.NotFoundAccount | The account does not exist, its status does not meet the requirements, or no valid role is found in this workspace | Specified account not found | Obtain the account again from the current workspace member list, and check both direct and inherited roles. |
| 403 | ft.Forbidden | Attempting to disable the owner's personal API Key | You do not have permission to perform this operation | Keep the owner's switch and adjust other members. |
| 500 | ft.InternalServerError | Data saving, related 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 sanitized request. |