Create new Cluster token
This page will soon be available only on the dedicated Dynatrace Managed Documentation site. Update your bookmarks.
This API call creates a new cluster token.
Authentication
To execute this request, you need the Cluster token management (ClusterTokenManagement
) permission assigned to your API token. Generate your API token via Cluster Management Console (CMC). To learn how to obtain and use it, see Cluster API - Authentication.
Creates a new Dynatrace Cluster token. The response contains the newly created token.
The request consumes and produces an application/json
payload.
Endpoint
/api/cluster/v2/tokens
Parameters
Parameter | Type | Description | In | Required |
---|---|---|---|---|
body | CreateToken | The JSON body of the request. Contains parameters of the new token. | body | required |
Request body objects
The CreateToken
object
Element | Type | Description | Required |
---|---|---|---|
name | string | The name of the token. | required |
expiresIn | Duration | Defines a period of time. | optional |
scopes | string[] | The list of scopes to be assigned to the token.
| required |
The Duration
object
Defines a period of time.
Element | Type | Description | Required |
---|---|---|---|
value | integer | The amount of time. | required |
unit | string | The unit of time. If not set, millisecond is used.
| optional |
Request body JSON model
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.
1{2 "name": "string",3 "expiresIn": {4 "value": 1,5 "unit": "DAYS"6 },7 "scopes": [8 "DiagnosticExport"9 ]10}
Response
Response codes
Code | Type | Description |
---|---|---|
201 | Token | Success. The token has been created. The response body contains the token itself. |
400 | ErrorEnvelope | Failed. The input is invalid. Response body provides details. |
Response body objects
The Token
object
Element | Type | Description |
---|---|---|
token | string | Dynatrace API authentication token. |
Response body JSON model
1{2 "token": "abcdefjhij1234567890"3}
Example
In this example, the request creates a new token named Mytoken
that is valid for 24 hours. With this token you will be able to perform a diagnostic export (DiagnosticExport
) and unattended install (UnattendedInstall
).
Curl
1curl -X POST "https://myManaged.cluster.com/api/cluster/v2/tokens"2 -H "accept: application/json; charset=utf-8"3 -H "Content-Type: application/json; charset=utf-8"4 -d "{ \"name\": \"MyToken\", \"scopes\": [ \"DiagnosticExport\", \"UnattendedInstall\" ], \"expiresIn\": { \"value\": 24, \"unit\": \"HOURS\" }}"
Request URL
1https://myManaged.cluster.com/api/cluster/v2/tokens
Request body
1{2 "name": "MyToken",3 "scopes": ["DiagnosticExport", "UnattendedInstall"],4 "expiresIn": {5 "value": 24,6 "unit": "HOURS"7 }8}
Response body
1{2 "token": "abcdefjhij1234567890"3}
Response code
201