ListPersonalAccessTokens
client.users.pats.list(PatListParams { token, pageSize, filter, pagination } params, RequestOptionsoptions?): PersonalAccessTokensPage<PersonalAccessToken { id, createdAt, creator, 5 more } >
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 Gitpod from '@gitpod/sdk';
const client = new Gitpod({
bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const personalAccessToken of client.users.pats.list({
filter: { userIds: ['f53d2330-3795-4c5d-a1f3-453121af9c60'] },
pagination: { pageSize: 20 },
})) {
console.log(personalAccessToken.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"
}
]
}