This API is deprecated. Use the Access tokens API instead.
Creates a new Dynatrace API authentication token. The response contains the newly created token.
The new token is owned by the same user who owns the token used to authenticate the call.
The request consumes an application/json
payload.
The request produces one of the following payload types:
application/json
text/plain
text/csv
Use the Accept header to set the required response type.
POST | SaaS | https://{your-environment-id}.live.dynatrace.com/api/v1/tokens |
Environment ActiveGate | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v1/tokens |
To execute this request, you need an access token with TenantTokenManagement
scope.
To learn how to obtain and use it, see Tokens and authentication.
Parameter | Type | Description | In | Required |
---|---|---|---|---|
body | Create | The JSON body of the request. Contains parameters of the new token. | body | required |
CreateToken
objectElement | Type | Description | Required |
---|---|---|---|
expiresIn | Duration | Defines a period of time. | optional |
name | string | The name of the token. | required |
scopes | string[] | The list of scopes to be assigned to the token.
| required |
Duration
objectDefines a period of time.
Element | Type | Description | Required |
---|---|---|---|
unit | string | The unit of time. If not set, millisecond is used.
| optional |
value | integer | The amount of time. | required |
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.
{"expiresIn": {"unit": "DAYS","value": 1},"name": "string","scopes": ["InstallerDownload"]}
application/json
text/plain
accept: text/csv; header=present; charset=utf-8
accept: text/csv; header=absent; charset=utf-8
Code | Type | Description |
---|---|---|
201 | Token | Success. The token has been created. The response body contains the token itself. |
400 | Error | Failed. The input is invalid. Response body provides details. |
4XX | Error | Client side error. |
5XX | Error | Server side error. |
Token
objectElement | Type | Description |
---|---|---|
token | string | Dynatrace API authentication token. |
{"token": "abcdefjhij1234567890"}
In this example, the request creates a new token named REST example. It is valid for 24 hours and has the following scopes:
The Accept header sets the response content type as text/plain
.
The response code of 201 indicates that the creation was successful. The response contains the new token as plain text.
The API token is passed in the Authorization header.
You can download or copy the example request body to try it out on your own.
curl -X POST \https://mySampleEnv.live.dynatrace.com/api/v1/tokens/ \-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \-H 'Content-Type: application/json' \-H 'Accept: text/plain'-d '{"name": "REST example","scopes": ["WriteConfig","ReadConfig","DataExport"],"expiresIn": {"value": 24,"unit": "HOURS"}}'
{"name": "REST example","scopes": ["WriteConfig", "ReadConfig", "DataExport"],"expiresIn": {"value": 24,"unit": "HOURS"}}
0987654321jihgfedcba
201
The new token looks like this in the Dynatrace interface: