Skip to main content

This version of GitHub Enterprise Server will be discontinued on 2026-09-22. Discontinued releases are not supported. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features in GitHub Enterprise Server, see Overview of the upgrade process. For help with the upgrade, GitHub Enterprise Support.

The REST API is now versioned. For more information, see "About API versioning."

REST API endpoints for GitHub Actions permissions

Use the REST API to interact with permissions for GitHub Actions.

About permissions for GitHub Actions

You can use the REST API to set permissions for the enterprises, organizations and repositories that are allowed to run GitHub Actions, and the actions that are allowed to run. For more information, see Enforcing policies for GitHub Actions in your enterprise, Disabling or limiting GitHub Actions for your organization, and Managing GitHub Actions settings for a repository.

Get GitHub Actions permissions for an enterprise

Gets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

Fine-grained access tokens for "Get GitHub Actions permissions for an enterprise"

This endpoint does not work with GitHub App user access tokens, GitHub App installation access tokens, or fine-grained personal access tokens.

Parameters for "Get GitHub Actions permissions for an enterprise"

Headers
Name, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
enterprise string Required

The slug version of the enterprise name.

HTTP response status codes for "Get GitHub Actions permissions for an enterprise"

Status codeDescription
200

OK

Code samples for "Get GitHub Actions permissions for an enterprise"

Request example

get/enterprises/{enterprise}/actions/permissions
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/actions/permissions

Response

Status: 200
{ "enabled_organizations": "all", "allowed_actions": "selected", "selected_actions_url": "https://HOSTNAME/enterprises/2/actions/permissions/selected-actions" }

Set GitHub Actions permissions for an enterprise

Sets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

Fine-grained access tokens for "Set GitHub Actions permissions for an enterprise"

This endpoint does not work with GitHub App user access tokens, GitHub App installation access tokens, or fine-grained personal access tokens.

Parameters for "Set GitHub Actions permissions for an enterprise"

Headers
Name, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
enterprise string Required

The slug version of the enterprise name.

Body parameters
Name, Type, Description
enabled_organizations string Required

The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions.

Can be one of: all, none, selected

allowed_actions string

The permissions policy that controls the actions that are allowed to run.

Can be one of: all, local_only, selected

HTTP response status codes for "Set GitHub Actions permissions for an enterprise"

Status codeDescription
204

No Content

Code samples for "Set GitHub Actions permissions for an enterprise"

Request example

put/enterprises/{enterprise}/actions/permissions
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/actions/permissions \ -d '{"enabled_organizations":"all","allowed_actions":"selected"}'

Response

Status: 204

List selected organizations enabled for GitHub Actions in an enterprise

Lists the organizations that are selected to have GitHub Actions enabled in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

Fine-grained access tokens for "List selected organizations enabled for GitHub Actions in an enterprise"

This endpoint does not work with GitHub App user access tokens, GitHub App installation access tokens, or fine-grained personal access tokens.

Parameters for "List selected organizations enabled for GitHub Actions in an enterprise"

Headers
Name, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
enterprise string Required

The slug version of the enterprise name.

Query parameters
Name, Type, Description
per_page integer

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

Default: 30

page integer

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

Default: 1

HTTP response status codes for "List selected organizations enabled for GitHub Actions in an enterprise"

Status codeDescription
200

OK

Code samples for "List selected organizations enabled for GitHub Actions in an enterprise"

Request example

get/enterprises/{enterprise}/actions/permissions/organizations
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/actions/permissions/organizations

Response

Status: 200
{ "total_count": 1, "organizations": [ { "login": "octocat", "id": 161335, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "url": "https://HOSTNAME/orgs/octo-org", "repos_url": "https://HOSTNAME/orgs/octo-org/repos", "events_url": "https://HOSTNAME/orgs/octo-org/events", "hooks_url": "https://HOSTNAME/orgs/octo-org/hooks", "issues_url": "https://HOSTNAME/orgs/octo-org/issues", "members_url": "https://HOSTNAME/orgs/octo-org/members{/member}", "public_members_url": "https://HOSTNAME/orgs/octo-org/public_members{/member}", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "description": "A great organization" } ] }

Set selected organizations enabled for GitHub Actions in an enterprise

Replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

Fine-grained access tokens for "Set selected organizations enabled for GitHub Actions in an enterprise"

This endpoint does not work with GitHub App user access tokens, GitHub App installation access tokens, or fine-grained personal access tokens.

Parameters for "Set selected organizations enabled for GitHub Actions in an enterprise"

Headers
Name, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
enterprise string Required

The slug version of the enterprise name.

Body parameters
Name, Type, Description
selected_organization_ids array of integers