Skip to content

Rotate Current Workspace Token



POST /api/v1/workspace/token/rotate

Overview

Rotate the token of the workspace to which the current API Key belongs, and return the new token.

Notes:

  • This interface only operates on the token in the workspace properties, not cliToken.
  • Batch operations are not supported.
  • ttl is the delayed expiration duration for the old token, supporting custom input from the caller.

Body Request Parameters

Parameter Name Type Required Description
ttl string Y The remaining validity period of the old token, supports custom duration string, maximum not exceeding 1 day.
Example: 24h
Allow Empty: False
$matchRegExp: ^(0s

Parameter Additional Notes

Request Example

curl 'https://openapi.truewatch.com/api/v1/workspace/token/rotate' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"ttl":"24h"}' \
--compressed

Response

{
    "code": 200,
    "content": {
        "token": "tkn_xxxxx",
        "openDataQuery": true
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-2956247345653191101"
}