API Stability Long-Term

The tokens() GraphQL query returns paginated search results for tokens.

For more information on access tokens of various types, see the Ingest Tokens documentation page.

Syntax

Below is the syntax for the tokens() query field:

graphql
tokens(
     searchFilter: string
     typeFilter: [Tokens__Type!]
     parentEntityIdFilter: [string!]
     sortBy: Tokens__SortBy!
     orderBy: OrderBy
     skip: integer
     limit: integer
   ): TokenQueryResultSet!

Below is an example of how this query field might be used:

Show:
graphql
query {
  tokens(sortBy: Name, orderBy: ASC)
        { totalResults, 
          results{name, expireAt} }
}
Example Responses
Show:
json
{
  "data": {
    "tokens": {
      "totalResults": 7,
      "results": [
        {
          "name": "Cluster Management",
          "createdAt": 1729603406707,
          "expireAt": null
        },
        {
          "name": "jenkinsAuto",
          "createdAt": 1729830704004,
          "expireAt": null
        },
        {
          "name": "Tester",
          "createdAt": 1730394131348,
          "expireAt": 1731258131010
        }
      ]
    }
  }
}

Given Datatypes

The given datatype Tokens__Type is an enumerated list of choices. They're listed below:

Table: Tokens__Type

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Apr 10, 2025
OrganizationManagementPermissionTokenboolean  Long-TermWhether the token is used for organization management access.
OrganizationPermissionTokenboolean  Long-TermWhether the token is an organization permission token.
SystemPermissionTokenboolean  Long-TermWhether the token is for system permission access.
ViewPermissionTokenboolean  Long-TermWhether the token is a view permission token.

The Tokens__SortBy is an enumerated list of choices. They're listed below:

Table: Tokens__SortBy

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Apr 10, 2025
ExpirationDateboolean  Long-TermWhether to sort tokens by expiration date.
nameboolean  Long-TermWhether to sort tokens by name.

Returned Datatypes

The returned datatype TokenQueryResultSet has its own parameters. Below is a list of them along with their datatypes and a description of each:

Table: TokenQueryResultSet

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Oct 3, 2024
results[Token]yes Long-TermThe paginated results set. See Token.
totalResultsintegeryes Long-TermThe total number of matching results.