Share via


Pats - List

Gets a paged list of personal access tokens (PATs) created in this organization. Subsequent calls to the API require the same filtering options to be supplied.

GET https://vssps.dev.azure.com/{organization}/_apis/tokens/pats?api-version=7.1-preview.1
GET https://vssps.dev.azure.com/{organization}/_apis/tokens/pats?displayFilterOption={displayFilterOption}&sortByOption={sortByOption}&isSortAscending={isSortAscending}&continuationToken={continuationToken}&$top={$top}&api-version=7.1-preview.1

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

api-version
query True

string

Version of the API to use. This should be set to '7.1-preview.1' to use this version of the api.

$top
query

integer (int32)

(Optional) How many tokens to return, limit of 100

continuationToken
query

string

(Optional) Where to start returning tokens from

displayFilterOption
query

DisplayFilterOptions

(Optional) Refers to the status of the personal access token (PAT)

isSortAscending
query

boolean

(Optional) Ascending or descending

sortByOption
query

SortByOptions

(Optional) Which field to sort by

Responses

Name Type Description
200 OK

PagedPatTokens

successful operation

Security

accessToken

Personal access token. Use any value for the user name and the token as the password.

Type: basic

Examples

List personal access tokens

Sample request

GET https://vssps.dev.azure.com/{organization}/_apis/tokens/pats?api-version=7.1-preview.1

Sample response

{
  "continuationToken": "",
  "patTokens": [
    {
      "displayName": "all_access_token",
      "validTo": "2020-11-23T04:04:38.5233333Z",
      "scope": "app_token",
      "targetAccounts": null,
      "validFrom": "2020-10-24T03:04:57.52Z",
      "authorizationId": "4c60c9ed-a378-4883-af16-d655ca025b11",
      "token": null
    },
    {
      "displayName": "work_token",
      "validTo": "2020-11-23T04:03:55.8033333Z",
      "scope": "vso.work_full",
      "targetAccounts": [
        "38aaa865-2c70-4bf7-a308-0c6539c38c1a"
      ],
      "validFrom": "2020-10-24T03:04:19.1466667Z",
      "authorizationId": "eabb38b2-48ef-440b-959b-b9e6cb37a64e",
      "token": null
    },
    {
      "displayName": "new_token",
      "validTo": "2020-12-01T23:46:23.32Z",
      "scope": "app_token",
      "targetAccounts": [
        "38aaa865-2c70-4bf7-a308-0c6539c38c1a"
      ],
      "validFrom": "2020-11-02T22:56:52.1033333Z",
      "authorizationId": "4ab5764f-4193-4f1d-b995-64144880b7d7",
      "token": null
    },
    {
      "displayName": "analytics_token",
      "validTo": "2020-12-01T23:46:23.32Z",
      "scope": "vso.analytics",
      "targetAccounts": [
        "38aaa865-2c70-4bf7-a308-0c6539c38c1a"
      ],
      "validFrom": "2020-10-29T17:26:46.72Z",
      "authorizationId": "3d3aca0c-9ad3-4b07-8334-08ec8b1ddc32",
      "token": null
    }
  ]
}

Definitions

Name Description
DisplayFilterOptions

(Optional) Refers to the status of the personal access token (PAT)

PagedPatTokens

Returned by the List method; contains a list of personal access tokens (PATs) and the continuation token to get the next page of results

PatToken

Represents a personal access token (PAT) used to access Azure DevOps resources

SortByOptions

(Optional) Which field to sort by

DisplayFilterOptions

(Optional) Refers to the status of the personal access token (PAT)

Value Description
active

Token is active (e.g. has not been revoked and has not expired).

all

Includes all tokens.

expired

Token has expired and is no longer usable unless updated with a new expiration date.

revoked

Token has been revoked and is no longer usable.

PagedPatTokens

Returned by the List method; contains a list of personal access tokens (PATs) and the continuation token to get the next page of results

Name Type Description
continuationToken

string

Used to access the next page of results in successive API calls to list personal access tokens (PATs)

patTokens

PatToken[]

The list of personal access tokens (PATs)

PatToken

Represents a personal access token (PAT) used to access Azure DevOps resources

Name Type Description
authorizationId

string (uuid)

Unique guid identifier

displayName

string

The token name

scope

string

The token scopes for accessing Azure DevOps resources

targetAccounts

string[] (uuid)

The organizations for which the token is valid; null if the token applies to all of the user's accessible organizations

token

string

The unique token string generated at creation

validFrom

string (date-time)

The token creation date

validTo

string (date-time)

The token expiration date

SortByOptions

(Optional) Which field to sort by

Value Description
displayDate

Sort by display date

displayName

Sort by display name

status

Sort by status