Skip to main content

pat_grant_requests

Creates, updates, deletes, gets or lists a pat_grant_requests resource.

Overview

Namepat_grant_requests
TypeResource
Idgithub.orgs.pat_grant_requests

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idintegerUnique identifier of the request for access via fine-grained personal access token. The pat_request_id used to review PAT requests.
token_idintegerUnique 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.
token_namestringThe name given to the user's token. This field can also be found in an organization's settings page for Active Tokens.
created_atstringDate and time when the request for access was created.
ownerobjectA GitHub user. (title: Simple User)
permissionsobjectPermissions requested, categorized by type of permission.
reasonstringReason for requesting access.
repositories_urlstringURL to the list of repositories requested to be accessed via fine-grained personal access token. Should only be followed when repository_selection is subset.
repository_selectionstringType of repository selection requested. (none, all, subset)
token_expiredbooleanWhether the associated fine-grained personal access token has expired.
token_expires_atstringDate and time when the associated fine-grained personal access token expires.
token_last_used_atstringDate and time when the associated fine-grained personal access token was last used for authentication.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_pat_grant_requestsselectorgper_page, page, sort, direction, owner, repository, permission, last_used_before, last_used_after, token_idLists requests from organization members to access organization resources with a fine-grained personal access token.

Only GitHub Apps can use this endpoint.
review_pat_grant_requests_in_bulkexecorg, actionApproves or denies multiple pending requests to access organization resources via a fine-grained personal access token.

Only GitHub Apps can use this endpoint.
review_pat_grant_requestexecorg, pat_request_id, actionApproves or denies a pending request to access organization resources via a fine-grained personal access token.

Only GitHub Apps can use this endpoint.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
orgstringThe organization name. The name is not case sensitive.
pat_request_idintegerUnique identifier of the request for access via fine-grained personal access token.
directionstringThe direction to sort the results by.
last_used_afterstring (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.
last_used_beforestring (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.
ownerarrayA list of owner usernames to use to filter the results.
pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
permissionstringThe permission to use to filter the results.
repositorystringThe name of the repository to use to filter the results.
sortstringThe property by which to sort the results.
token_idarrayThe ID of the token

SELECT examples

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

Only GitHub Apps can use this endpoint.

SELECT
id,
token_id,
token_name,
created_at,
owner,
permissions,
reason,
repositories_url,
repository_selection,
token_expired,
token_expires_at,
token_last_used_at
FROM github.orgs.pat_grant_requests
WHERE org = '{{ org }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
AND sort = '{{ sort }}'
AND direction = '{{ direction }}'
AND owner = '{{ owner }}'
AND repository = '{{ repository }}'
AND permission = '{{ permission }}'
AND last_used_before = '{{ last_used_before }}'
AND last_used_after = '{{ last_used_after }}'
AND token_id = '{{ token_id }}'
;

Lifecycle Methods

Approves or denies multiple pending requests to access organization resources via a fine-grained personal access token.

Only GitHub Apps can use this endpoint.

EXEC github.orgs.pat_grant_requests.review_pat_grant_requests_in_bulk 
@org='{{ org }}' --required
@@json=
'{
"pat_request_ids": "{{ pat_request_ids }}",
"action": "{{ action }}",
"reason": "{{ reason }}"
}'
;