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 on cliToken - Batch operations are not supported - ttl is the delay duration for the old token to become invalid, 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 strings, maximum not exceeding 1 day
Example: 24h
Allow empty: False
$matchRegExp: ^(0s

Parameter Supplementary 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"
}