Skip to content

List requests to access organization resources with fine-grained personal access tokens

GET
/orgs/{org}/personal-access-token-requests

Lists requests from organization members to access organization resources with a fine-grained personal access token.

Only GitHub Apps can use this endpoint.

API method documentation

org
required
string

The organization name. The name is not case sensitive.

per_page
integer
default: 30

The number of results per page (max 100). For more information, see “Using pagination in the REST API.”

page
integer
default: 1

The page number of the results to fetch. For more information, see “Using pagination in the REST API.”

sort
string
default: created_at
Allowed values: created_at

The property by which to sort the results.

direction
string
default: desc
Allowed values: asc desc

The direction to sort the results by.

owner
Array<string>
<= 10 items
Example
owner[]=octocat1,owner[]=octocat2

A list of owner usernames to use to filter the results.

repository
string
Example
Hello-World

The name of the repository to use to filter the results.

permission
string
Example
issues_read

The permission to use to filter the results.

last_used_before
string format: date-time

Only show fine-grained personal access tokens used before the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

last_used_after
string format: date-time

Only show fine-grained personal access tokens used after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

token_id
Array<string>
<= 50 items
Example
token_id[]=1,token_id[]=2

The ID of the token

Response

Media type application/json
Array<object>
Simple Organization Programmatic Access Grant Request

Minimal representation of an organization programmatic access grant request for enumerations

object
id
required

Unique identifier of the request for access via fine-grained personal access token. The pat_request_id used to review PAT requests.

integer
reason
required

Reason for requesting access.

string
nullable
owner
required
Simple User

A GitHub user.

object
name
string
nullable
email
string
nullable
login
required
string
id
required
integer format: int64
node_id
required
string
avatar_url
required
string format: uri
gravatar_id
required
string
nullable
url
required
string format: uri
html_url
required
string format: uri
followers_url
required
string format: uri
following_url
required
string
gists_url
required
string
starred_url
required
string
subscriptions_url
required
string format: uri
organizations_url
required
string format: uri
repos_url
required
string format: uri
events_url
required
string
received_events_url
required
string format: uri
type
required
string
site_admin
required
boolean
starred_at
string
user_view_type
string
repository_selection
required

Type of repository selection requested.

string
Allowed values: none all subset
repositories_url
required

URL to the list of repositories requested to be accessed via fine-grained personal access token. Should only be followed when repository_selection is subset.

string
permissions
required

Permissions requested, categorized by type of permission.

object
organization
object
key
additional properties
string
repository
object
key
additional properties
string
other
object
key
additional properties
string
created_at
required

Date and time when the request for access was created.

string
token_id
required

Unique identifier of the user’s token. This field can also be found in audit log events and the organization’s settings for their PAT grants.

integer
token_name
required

The name given to the user’s token. This field can also be found in an organization’s settings page for Active Tokens.

string
token_expired
required

Whether the associated fine-grained personal access token has expired.

boolean
token_expires_at
required

Date and time when the associated fine-grained personal access token expires.

string
nullable
token_last_used_at
required

Date and time when the associated fine-grained personal access token was last used for authentication.

string
nullable
Examples
Example default
[
{
"id": 25381,
"reason": "I need to access the GitHub API",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"repository_selection": "all",
"repositories_url": "https://api.github.com/organizations/652551/personal-access-token-requests/25381/repositories",
"permissions": {
"organization": {
"members": "read"
},
"repository": {
"metadata": "read"
}
},
"created_at": "2023-05-16T08:47:09.000-07:00",
"token_id": 98716,
"token_name": "Some Token",
"token_expired": false,
"token_expires_at": "2023-11-16T08:47:09.000-07:00",
"token_last_used_at": null
}
]
Link
string
Example
<https://api.github.com/resource?page=2>; rel="next", <https://api.github.com/resource?page=5>; rel="last"

Forbidden

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Resource not found

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Validation failed, or the endpoint has been spammed.

Media type application/json
Validation Error

Validation Error

object
message
required
string
documentation_url
required
string
errors
Array<object>
object
resource
string
field
string
message
string
code
required
string
index
integer
value
One of:
string
nullable
Example generated
{
"message": "example",
"documentation_url": "example",
"errors": [
{
"resource": "example",
"field": "example",
"message": "example",
"code": "example",
"index": 1,
"value": [
"example"
]
}
]
}

Internal Error

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}