Access tokens API - GET all tokens
Lists all API tokens available in your environment.
You can limit the output by using the pagination:
- Specify the number of results per page in the pageSize query parameter.
- Then use the cursor from the nextPageKey field of the previous response in the nextPageKey query parameter to obtain subsequent pages.
The request produces an application/json
payload.
GET | ManagedDynatrace for Government | https://{your-domain}/e/{your-environment-id}/api/v2/apiTokens |
SaaS | https://{your-environment-id}.live.dynatrace.com/api/v2/apiTokens | |
Environment and Cluster ActiveGate (default port 9999) | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v2/apiTokens |
Authentication
To execute this request, you need an access token with apiTokens.read
scope.
To learn how to obtain and use it, see Tokens and authentication.
Parameters
Parameter | Type | Description | In | Required |
---|---|---|---|---|
nextPageKey | string | The cursor for the next page of results. You can find it in the nextPageKey field of the previous response. The first page is always returned if you don't specify the nextPageKey query parameter. When the nextPageKey is set to obtain subsequent pages, you must omit all other query parameters. | query | optional |
pageSize | integer | The amount of API tokens in a single response payload. The maximal allowed page size is 10000 and the minimal allowed page size is 100. If not set, 200 is used. | query | optional |
apiTokenSelector | string | Filters the resulting sets of tokens. Only tokens matching the specified criteria are included into response. You can set one or more of the following criteria:
To set multiple criteria, separate them with commas ( | query | optional |
fields | string | Specifies the fields to be included in the response. The following fields are included by default:
To remove fields from the response, specify them with the minus ( You can include additional fields:
To add fields to the response, specify them with the plus ( Alternatively, you can define the desired set of fields in the response. Specify the required fields as a comma-separated list, without operators (for example, The fields string must be URL-encoded. | query | optional |
from | string | Filters tokens based on the last usage time. The start of the requested timeframe. You can use one of the following formats:
| query | optional |
to | string | Filters tokens based on the last usage time. The end of the requested timeframe. You can use one of the following formats:
If not set, the current timestamp is used. | query | optional |
sort | string | The sort order of the token list. You can sort by the following properties with a sign prefix for the sort order:
If no prefix is set, + is used. If not set, tokens are sorted by creation date with newest first. | query | optional |
Response
Response codes
Code | Type | Description |
---|---|---|
200 | ApiTokenList | Success |
400 | ErrorEnvelope | Failed. The input is invalid. |
Response body objects
The ApiTokenList
object
A list of API tokens.
Element | Type | Description |
---|---|---|
apiTokens | ApiToken[] | A list of API tokens. |
nextPageKey | string | The cursor for the next page of results. Has the value of Use it in the nextPageKey query parameter to obtain subsequent pages of the result. |
pageSize | integer | The number of entries per page. |
totalCount | integer | The total number of entries in the result. |
The ApiToken
object
Metadata of an API token.
Element | Type | Description |
---|---|---|
additionalMetadata | object | Contains additional properties for specific kinds of token. Examples:
|
creationDate | string | Token creation date in ISO 8601 format ( |
enabled | boolean | The token is enabled ( |
expirationDate | string | Token expiration date in ISO 8601 format ( If not set, the token never expires. |
id | string | The ID of the token, consisting of prefix and public part of the token. |
lastUsedDate | string | Token last used date in ISO 8601 format ( |
lastUsedIpAddress | string | Token last used IP address. |
modifiedDate | string | Token last modified date in ISO 8601 format ( |
name | string | The name of the token. |
owner | string | The owner of the token. |
personalAccessToken | boolean | The token is a personal access token ( |
scopes | string[] | A list of scopes assigned to the token.
|
Response body JSON model
1{2 "apiTokens": {3 "additionalMetadata": {4 "dashboardId": "82402bab-7370-4359-924d-88ed13c8919a"5 },6 "creationDate": "2020-11-05T08:15:30.144Z",7 "disabled": "false",8 "expirationDate": "2020-11-12T08:15:30.144Z",9 "id": "dt0c01.ST2EY72KQINMH574WMNVI7YN",10 "lastUsedDate": "2020-11-12T08:15:30.144Z",11 "lastUsedIpAddress": "34.197.2.44",12 "name": "tokenName",13 "owner": "john.smith",14 "personalAccessToken": "true",15 "scopes": [16 "metrics.read"17 ]18 },19 "pageSize": "1",20 "totalCount": "1"21}