ListPersonalAccessTokens
users.pats.list(PatListParams**kwargs) -> SyncPersonalAccessTokensPage[PersonalAccessToken]
POST/gitpod.v1.UserService/ListPersonalAccessTokens
Lists personal access tokens with optional filtering.
Use this method to:
- View all active tokens
- Audit token usage
- Manage token lifecycle
Examples
-
List user tokens:
Shows all tokens for specific users.
filter: userIds: ["f53d2330-3795-4c5d-a1f3-453121af9c60"] pagination: pageSize: 20
ListPersonalAccessTokens
import os
from gitpod import Gitpod
client = Gitpod(
bearer_token=os.environ.get("GITPOD_API_KEY"), # This is the default and can be omitted
)
page = client.users.pats.list(
filter={
"user_ids": ["f53d2330-3795-4c5d-a1f3-453121af9c60"]
},
pagination={
"page_size": 20
},
)
page = page.personal_access_tokens[0]
print(page.id){
"pagination": {
"nextToken": "nextToken"
},
"personalAccessTokens": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"description": "description",
"expiresAt": "2019-12-27T18:11:19.117Z",
"lastUsed": "2019-12-27T18:11:19.117Z",
"readOnly": true,
"userId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
]
}Returns Examples
{
"pagination": {
"nextToken": "nextToken"
},
"personalAccessTokens": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"description": "description",
"expiresAt": "2019-12-27T18:11:19.117Z",
"lastUsed": "2019-12-27T18:11:19.117Z",
"readOnly": true,
"userId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
]
}