Create new Cluster token

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

ParameterTypeDescriptionInRequired
bodyCreateToken

The JSON body of the request. Contains parameters of the new token.

bodyrequired

Request body objects

The CreateToken object

ElementTypeDescriptionRequired
namestring

The name of the token.

required
expiresInDuration

Defines a period of time.

optional
scopesstring[]

The list of scopes to be assigned to the token.

  • DiagnosticExport: DiagnosticExport.
  • ControlManagement: ControlManagement.
  • UnattendedInstall: UnattendedInstall.
  • ServiceProviderAPI: Service Provider API.
  • ExternalSyntheticIntegration: Create and read synthetic monitors, locations, and nodes.
  • ClusterTokenManagement: Cluster token management.
  • ReadSyntheticData: Read synthetic monitors, locations, and nodes.
  • Nodekeeper: Nodekeeper access for node management.
  • EnvironmentTokenManagement: "Token Management" Token creation for existing environments.
  • activeGateTokenManagement.read: Read ActiveGate tokens.
  • activeGateTokenManagement.create: Create ActiveGate tokens.
  • activeGateTokenManagement.write: Write ActiveGate tokens.
  • settings.read: Read settings.
  • settings.write: Write settings.
  • apiTokens.read: Read API tokens.
  • apiTokens.write: Write API tokens.
  • DiagnosticExport
  • ControlManagement
  • UnattendedInstall
  • ServiceProviderAPI
  • ExternalSyntheticIntegration
  • ClusterTokenManagement
  • ReadSyntheticData
  • Nodekeeper
  • EnvironmentTokenManagement
  • activeGateTokenManagement.read
  • activeGateTokenManagement.create
  • activeGateTokenManagement.write
  • settings.read
  • settings.write
  • apiTokens.read
  • apiTokens.write
required

The Duration object

Defines a period of time.

ElementTypeDescriptionRequired
valueinteger

The amount of time.

required
unitstring

The unit of time.

If not set, millisecond is used.

  • DAYS
  • HOURS
  • MILLIS
  • MINUTES
  • SECONDS
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.

{
"name": "string",
"expiresIn": {
"value": 1,
"unit": "DAYS"
},
"scopes": [
"DiagnosticExport"
]
}

Response

Response codes

CodeTypeDescription
201Token

Success. The token has been created. The response body contains the token itself.

400ErrorEnvelope

Failed. The input is invalid. Response body provides details.

Response body objects

The Token object

ElementTypeDescription
tokenstring

Dynatrace API authentication token.

Response body JSON model

{
"token": "abcdefjhij1234567890"
}

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

curl -X POST "https://myManaged.cluster.com/api/cluster/v2/tokens"
-H "accept: application/json; charset=utf-8"
-H "Content-Type: application/json; charset=utf-8"
-d "{ \"name\": \"MyToken\", \"scopes\": [ \"DiagnosticExport\", \"UnattendedInstall\" ], \"expiresIn\": { \"value\": 24, \"unit\": \"HOURS\" }}"

Request URL

https://myManaged.cluster.com/api/cluster/v2/tokens

Request body

{
"name": "MyToken",
"scopes": ["DiagnosticExport", "UnattendedInstall"],
"expiresIn": {
"value": 24,
"unit": "HOURS"
}
}

Response body

{
"token": "abcdefjhij1234567890"
}

Response code

201