pat_grant_requests
Creates, updates, deletes, gets or lists a pat_grant_requests resource.
Overview
| Name | pat_grant_requests |
| Type | Resource |
| Id | github.orgs.pat_grant_requests |
Fields
The following fields are returned by SELECT queries:
- list_pat_grant_requests
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | Unique identifier of the request for access via fine-grained personal access token. The pat_request_id used to review PAT requests. |
token_id | integer | 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. |
token_name | string | The name given to the user's token. This field can also be found in an organization's settings page for Active Tokens. |
created_at | string | Date and time when the request for access was created. |
owner | object | A GitHub user. (title: Simple User) |
permissions | object | Permissions requested, categorized by type of permission. |
reason | string | Reason for requesting access. |
repositories_url | string | 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. |
repository_selection | string | Type of repository selection requested. (none, all, subset) |
token_expired | boolean | Whether the associated fine-grained personal access token has expired. |
token_expires_at | string | Date and time when the associated fine-grained personal access token expires. |
token_last_used_at | string | Date and time when the associated fine-grained personal access token was last used for authentication. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_pat_grant_requests | select | org | per_page, page, sort, direction, owner, repository, permission, last_used_before, last_used_after, token_id | Lists 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_bulk | exec | org, action | Approves 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_request | exec | org, pat_request_id, action | Approves 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.
| Name | Datatype | Description |
|---|---|---|
org | string | The organization name. The name is not case sensitive. |
pat_request_id | integer | Unique identifier of the request for access via fine-grained personal access token. |
direction | string | The direction to sort the results by. |
last_used_after | string (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_before | string (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. |
owner | array | A list of owner usernames to use to filter the results. |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
per_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
permission | string | The permission to use to filter the results. |
repository | string | The name of the repository to use to filter the results. |
sort | string | The property by which to sort the results. |
token_id | array | The ID of the token |
SELECT examples
- list_pat_grant_requests
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
- review_pat_grant_requests_in_bulk
- review_pat_grant_request
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 }}"
}'
;
Approves or denies a pending request 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_request
@org='{{ org }}' --required,
@pat_request_id='{{ pat_request_id }}' --required
@@json=
'{
"action": "{{ action }}",
"reason": "{{ reason }}"
}'
;