Skip to content

List all personal access tokens

GET
/api/v4/personal_access_tokens

Lists all personal access tokens accessible by the authenticated user. For administrators, returns all personal access tokens in the instance. For non-administrators, returns all of their personal access tokens.

user_id
integer
nullable

Filter PATs by User ID

Example
2
revoked
boolean
nullable

Filter tokens where revoked state matches parameter

Example
false
state
string
nullable
Allowed values: active inactive

Filter tokens which are either active or not

Example
active
created_before
string format: date-time
nullable

Filter tokens which were created before given datetime

Example
2022-01-01T00:00:00Z
created_after
string format: date-time
nullable

Filter tokens which were created after given datetime

Example
2021-01-01T00:00:00Z
last_used_before
string format: date-time
nullable

Filter tokens which were used before given datetime

Example
2021-01-01T00:00:00Z
last_used_after
string format: date-time
nullable

Filter tokens which were used after given datetime

Example
2022-01-01T00:00:00Z
expires_before
string format: date
nullable

Filter tokens which expire before given datetime

Example
2022-01-01
expires_after
string format: date
nullable

Filter tokens which expire after given datetime

Example
2021-01-01
search
string
nullable

Filters tokens by name

Example
token
sort
string
nullable

Sort tokens

Example
created_at_desc
page
integer
default: 1 nullable

Current page number

Example
1
per_page
integer
default: 20 nullable

Number of items per page

Example
20

OK

Media type application/json
object
id
integer format: int64
name
string
revoked
boolean
created_at
string format: date-time
description
string
scopes
array
user_id
integer format: int64
last_used_at
string format: date-time
active
boolean
granular
boolean
expires_at
string format: date-time
last_used_ips

The five most recent unique IP addresses that have authenticated with this token. When the limit is reached, the oldest IP address is removed. The list updates once per minute per token.

Array<string>
granular_scopes
Array<object>
object
access
string
permissions
array
project_id
integer format: int64
group_id
integer format: int64
Example
{
"id": 2,
"name": "John Doe",
"description": "Token to manage api",
"scopes": [
"api"
],
"user_id": 3,
"last_used_at": "2020-08-31T15:53:00.073Z",
"expires_at": "2020-08-31T15:53:00.073Z",
"last_used_ips": [
"127.0.0.1",
"127.0.0.2",
"127.0.0.3"
],
"granular_scopes": [
{
"access": "personal_projects",
"permissions": [
"read_job"
],
"project_id": 3,
"group_id": 5
}
]
}

Bad Request

Unauthorized