Sample - GitHub REST API
POST/orgs/{org}/{security_product}/{enablement}Deprecated

Enable or disable a security feature for an organization

[!WARNING] Closing down notice: The ability to enable or disable a security feature for all eligible repositories in an organization is closing down. Please use code security configurations instead. For more information, see the changelog.

Enables or disables the specified security feature for all eligible repositories in an organization. For more information, see "Managing security managers in your organization."

The authenticated user must be an organization owner or be member of a team with the security manager role to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:org, write:org, or repo scopes to use this endpoint.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

3 parameters · 1 body field
orgstringrequired
The organization name. The name is not case sensitive.
security_productstringrequired
The security feature to enable or disable.
Allowed:dependency_graphdependabot_alertsdependabot_security_updatesadvanced_securitycode_scanning_default_setupsecret_scanningsecret_scanning_push_protection
enablementstringrequired
The action to take. `enable_all` means to enable the specified security feature for all repositories in the organization. `disable_all` means to disable the specified security feature for all repositories in the organization.
Allowed:enable_alldisable_all
query_suitestringoptional
CodeQL query suite to be used. If you specify the `query_suite` parameter, the default setup will be configured with this query suite only on all repositories that didn't have default setup already configured. It will not change the query suite on repositories that already have default setup configured. If you don't specify any `query_suite` in your request, the preferred query suite of the organization will be applied.
Allowed:defaultextended

2 status codes
204Action started
422The action could not be taken due to an in progress enablement, or a policy is preventing enablement

Error handling

A 422 is returned: The action could not be taken due to an in progress enablement, or a policy is preventing enablement.