Skip to content

Rotate



POST /api/v1/workspace/accesskey/{ak_uuid}/rotate

Overview

Rotate an API Key for a workspace.

Route Parameters

Parameter Name Type Required Description
ak_uuid string Y UUID of the API Key to rotate

Supplemental Notes

Generate a new ak/sk pair for the specified workspace API Key, retaining the name, description, and role configuration. The old ak/sk pair becomes invalid immediately after success. The new ak/sk plaintext is returned only in this response; the caller must save it securely immediately.

When calling the rotate endpoint on the current API Key itself, the current request can complete normally. After the response is returned, use the returned new credentials to continue calling the OpenAPI.

Request Example

curl 'https://openapi.guance.com/api/v1/workspace/accesskey/wsak_xxxxx/rotate' \
  -H 'Content-Type: application/json;charset=UTF-8' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  --data-raw '{}' \
  --compressed

Response

{
    "code": 200,
    "content": {
        "uuid": "wsak_xxxxx",
        "name": "sdk-ak",
        "ak": "new-ak",
        "sk": "new-sk",
        "workspaceUUID": "wksp_xxx",
        "roleInfo": [
            {
                "uuid": "readOnly",
                "name": "Read-only"
            }
        ]
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-XXXX"
}

Feedback

Is this page helpful?