List fine-grained personal access tokens with access to organization resources
Lists approved fine-grained personal access tokens owned by organization members that can access organization resources.
Only GitHub Apps can use this endpoint.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”The organization name. The name is not case sensitive.
Query Parameters
Section titled “ Query Parameters ”The number of results per page (max 100). For more information, see “Using pagination in the REST API.”
The page number of the results to fetch. For more information, see “Using pagination in the REST API.”
The property by which to sort the results.
The direction to sort the results by.
Example
owner[]=octocat1,owner[]=octocat2A list of owner usernames to use to filter the results.
Example
Hello-WorldThe name of the repository to use to filter the results.
Example
issues_readThe permission to use to filter the results.
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.
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.
Example
token_id[]=1,token_id[]=2The ID of the token
Responses
Section titled “ Responses ”Response
Minimal representation of an organization programmatic access grant for enumerations
object
Unique identifier of the fine-grained personal access token grant. The pat_id used to get details about an approved fine-grained personal access token.
A GitHub user.
object
Type of repository selection requested.
URL to the list of repositories the fine-grained personal access token can access. Only follow when repository_selection is subset.
Permissions requested, categorized by type of permission.
object
object
object
object
Date and time when the fine-grained personal access token was approved to access the organization.
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.
The name given to the user’s token. This field can also be found in an organization’s settings page for Active Tokens.
Whether the associated fine-grained personal access token has expired.
Date and time when the associated fine-grained personal access token expires.
Date and time when the associated fine-grained personal access token was last used for authentication.
Examples
[ { "id": 25381, "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-tokens/25381/repositories", "permissions": { "organization": { "members": "read" }, "repository": { "metadata": "read" } }, "access_granted_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 }]Headers
Section titled “ Headers ”Example
<https://api.github.com/resource?page=2>; rel="next", <https://api.github.com/resource?page=5>; rel="last"Forbidden
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Resource not found
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Validation failed, or the endpoint has been spammed.
Validation Error
object
object
Example generated
{ "message": "example", "documentation_url": "example", "errors": [ { "resource": "example", "field": "example", "message": "example", "code": "example", "index": 1, "value": [ "example" ] } ]}Internal Error
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}