• Home
  • Dynatrace API
  • Environment
  • Tokens v2
  • Access tokens
  • GET all tokens

Access tokens API - GET all tokens

Lists all API tokens available in your environment.

You can limit the output by using the pagination:

  1. Specify the number of results per page in the pageSize query parameter.
  2. 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.

GETManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/v2/apiTokens
SaaShttps://{your-environment-id}.live.dynatrace.com/api/v2/apiTokens
Environment ActiveGatehttps://{your-activegate-domain}/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

ParameterTypeDescriptionInRequired
nextPageKeystring

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.

queryoptional
pageSizeinteger

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.

queryoptional
apiTokenSelectorstring

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:

  • Owner: owner("value"). The user that owns the token. Case-sensitive.
  • Personal access token: personalAccessToken(false). Set to true to include only personal access tokens or to false to include only API tokens.
  • Token scope: scope("scope1","scope2"). If several values are specified, the OR logic applies.

To set multiple criteria, separate them with commas (,). Only results matching all criteria are included into response.

queryoptional
fieldsstring

Specifies the fields to be included in the response.

The following fields are included by default:

  • id
  • name
  • enabled
  • owner
  • creationDate

To remove fields from the response, specify them with the minus (-) operator as a comma-separated list (for example, -creationDate,-owner).

You can include additional fields:

  • personalAccessToken

  • expirationDate

  • lastUsedDate

  • lastUsedIpAddress

  • modifiedDate

  • scopes

  • additionalMetadata

To add fields to the response, specify them with the plus (+) operator as a comma-separated list (for example, +expirationDate,+scopes). You can combine adding and removing of fields (for example, +scopes,-creationDate).

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, creationDate,expirationDate,owner). The ID is always included in the response.

The fields string must be URL-encoded.

queryoptional
fromstring

Filters tokens based on the last usage time. The start of the requested timeframe.

You can use one of the following formats:

  • Timestamp in UTC milliseconds.
  • Human-readable format of 2021-01-25T05:57:01.123+01:00. If no time zone is specified, UTC is used. You can use a space character instead of the T. Seconds and fractions of a second are optional.
  • Relative timeframe, back from now. The format is now-NU/A, where N is the amount of time, U is the unit of time, and A is an alignment. The alignment rounds all the smaller values to the nearest zero in the past. For example, now-1y/w is one year back, aligned by a week. You can also specify relative timeframe without an alignment: now-NU. Supported time units for the relative timeframe are:
    • m: minutes
    • h: hours
    • d: days
    • w: weeks
    • M: months
    • y: years
queryoptional
tostring

Filters tokens based on the last usage time. The end of the requested timeframe.

You can use one of the following formats:

  • Timestamp in UTC milliseconds.
  • Human-readable format of 2021-01-25T05:57:01.123+01:00. If no time zone is specified, UTC is used. You can use a space character instead of the T. Seconds and fractions of a second are optional.
  • Relative timeframe, back from now. The format is now-NU/A, where N is the amount of time, U is the unit of time, and A is an alignment. The alignment rounds all the smaller values to the nearest zero in the past. For example, now-1y/w is one year back, aligned by a week. You can also specify relative timeframe without an alignment: now-NU. Supported time units for the relative timeframe are:
    • m: minutes
    • h: hours
    • d: days
    • w: weeks
    • M: months
    • y: years

If not set, the current timestamp is used.

queryoptional
sortstring

The sort order of the token list.

You can sort by the following properties with a sign prefix for the sort order:

  • name: token name (+ a...z or - z...a)
  • lastUsedDate last used (+ never used tokens first - most recently used tokens first)
  • creationDate (+ oldest tokens first - newest tokens first)
  • expirationDate (+ tokens that expire soon first - unlimited tokens first)
  • modifiedDate last modified (+ never modified tokens first - most recently modified tokens first)

If no prefix is set, + is used.

If not set, tokens are sorted by creation date with newest first.

queryoptional

Response

Response codes

CodeTypeDescription
200ApiTokenList

Success

400ErrorEnvelope

Failed. The input is invalid.

Response body objects

The ApiTokenList object

A list of API tokens.

ElementTypeDescription
apiTokensApiToken[]

A list of API tokens.

totalCountinteger

The total number of entries in the result.

nextPageKeystring

The cursor for the next page of results. Has the value of null on the last page.

Use it in the nextPageKey query parameter to obtain subsequent pages of the result.

pageSizeinteger

The number of entries per page.

The ApiToken object

Metadata of an API token.

ElementTypeDescription
lastUsedIpAddressstring

Token last used IP address.

modifiedDatestring

Token last modified date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z'). Updating scopes or name counts as modification, enabling or disabling a token does not.

additionalMetadataobject

Contains additional properties for specific kinds of token. Examples:

  • A dashboardId property for dashboard sharing tokens.
  • A reportId property for report sharing tokens
expirationDatestring

Token expiration date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z').

If not set, the token never expires.

personalAccessTokenboolean

The token is a personal access token (true) or an API token (false).

lastUsedDatestring

Token last used date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')

creationDatestring

Token creation date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')

namestring

The name of the token.

idstring

The ID of the token, consisting of prefix and public part of the token.

ownerstring

The owner of the token.

enabledboolean

The token is enabled (true) or disabled (false).

scopesstring[]

A list of scopes assigned to the token.

The element can hold these values
  • ActiveGateCertManagement
  • AdvancedSyntheticIntegration
  • CaptureRequestData
  • DTAQLAccess
  • DataExport
  • DataImport
  • DataPrivacy
  • Davis
  • DiagnosticExport
  • DssFileManagement
  • ExternalSyntheticIntegration
  • InstallerDownload
  • LogExport
  • MemoryDump
  • Mobile
  • PluginUpload
  • ReadConfig
  • ReadSyntheticData
  • RestRequestForwarding
  • RumBrowserExtension
  • RumJavaScriptTagManagement
  • SupportAlert
  • TenantTokenManagement
  • UserSessionAnonymization
  • ViewDashboard
  • ViewReport
  • WriteConfig
  • WriteSyntheticData
  • activeGateTokenManagement.create
  • activeGateTokenManagement.read
  • activeGateTokenManagement.write
  • activeGates.read
  • activeGates.write
  • apiTokens.read
  • apiTokens.write
  • auditLogs.read
  • credentialVault.read
  • credentialVault.write
  • entities.read
  • entities.write
  • events.ingest
  • events.read
  • extensionConfigurations.read
  • extensionConfigurations.write
  • extensionEnvironment.read
  • extensionEnvironment.write
  • extensions.read
  • extensions.write
  • geographicRegions.read
  • hub.read
  • hub.write
  • logs.ingest
  • logs.read
  • metrics.ingest
  • metrics.read
  • metrics.write
  • networkZones.read
  • networkZones.write
  • oneAgents.read
  • oneAgents.write
  • openTelemetryTrace.ingest
  • problems.read
  • problems.write
  • releases.read
  • securityProblems.read
  • securityProblems.write
  • settings.read
  • settings.write
  • slo.read
  • slo.write
  • syntheticExecutions.read
  • syntheticExecutions.write
  • syntheticLocations.read
  • syntheticLocations.write
  • tenantTokenRotation.write
  • traces.lookup

Response body JSON model

json
{ "pageSize": "1", "totalCount": "1", "apiTokens": { "id": "dt0c01.ST2EY72KQINMH574WMNVI7YN", "name": "tokenName", "disabled": "false", "personalAccessToken": "true", "owner": "john.smith", "creationDate": "2020-11-05T08:15:30.144Z", "expirationDate": "2020-11-12T08:15:30.144Z", "lastUsedDate": "2020-11-12T08:15:30.144Z", "lastUsedIpAddress": "34.197.2.44", "scopes": [ "metrics.read" ], "additionalMetadata": { "dashboardId": "82402bab-7370-4359-924d-88ed13c8919a" } } }
Related topics
  • Access tokens

    Learn the concept of an access token and its scopes.