Use the REST API to create and manage security configurations for your organization.
Note
Most endpoints use Authorization: Bearer <YOUR-TOKEN> and Accept: application/vnd.github+json headers, plus X-GitHub-Api-Version: 2026-03-10. Curl examples below omit these standard headers for brevity.
GET /enterprises/{enterprise}/code-security/configurations
Lists all code security configurations available in an enterprise.
The authenticated user must be an administrator of the enterprise in order to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the read:enterprise scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.enterprise (string) (required)
The slug version of the enterprise name.
per_page (integer)
The number of results per page (max 100). For more information, see "Using pagination in the REST API."
Default: 30
before (string)
A cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."
after (string)
A cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."
200 - OK
403 - Forbidden
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/enterprises/ENTERPRISE/code-security/configurations
Response schema (Status: 200):
Array of objects:
id: integername: stringtarget_type: string, enum: global, organization, enterprisedescription: string or nulladvanced_security: string, enum: enabled, disabled, code_security, secret_protectiondependency_graph: string, enum: enabled, disabled, not_setdependency_graph_autosubmit_action: string, enum: enabled, disabled, not_setdependency_graph_autosubmit_action_options: object:
labeled_runners: booleandependabot_alerts: string, enum: enabled, disabled, not_setdependabot_security_updates: string, enum: enabled, disabled, not_setdependabot_delegated_alert_dismissal: string or null, enum: enabled, disabled, not_set, nullcode_scanning_options: object or null:
allow_advanced: boolean or nullcode_scanning_default_setup: string, enum: enabled, disabled, not_setcode_scanning_default_setup_options: object or null:
runner_type: string or null, enum: standard, labeled, not_set, nullrunner_label: string or nullcode_scanning_delegated_alert_dismissal: string, enum: enabled, disabled, not_setsecret_scanning: string, enum: enabled, disabled, not_setsecret_scanning_push_protection: string, enum: enabled, disabled, not_setsecret_scanning_delegated_bypass: string, enum: enabled, disabled, not_setsecret_scanning_delegated_bypass_options: object:
reviewers: array of objects:
reviewer_id: required, integerreviewer_type: required, string, enum: TEAM, ROLEmode: string, enum: ALWAYS, EXEMPT, default: "ALWAYS"security_configuration_id: integersecret_scanning_validity_checks: string, enum: enabled, disabled, not_setsecret_scanning_non_provider_patterns: string, enum: enabled, disabled, not_setsecret_scanning_generic_secrets: string, enum: enabled, disabled, not_setsecret_scanning_delegated_alert_dismissal: string, enum: enabled, disabled, not_setsecret_scanning_extended_metadata: string, enum: enabled, disabled, not_setprivate_vulnerability_reporting: string, enum: enabled, disabled, not_setenforcement: string, enum: enforced, unenforced, enterprise_enforcedurl: string, format: urihtml_url: string, format: uricreated_at: string, format: date-timeupdated_at: string, format: date-timePOST /enterprises/{enterprise}/code-security/configurations
Creates a code security configuration in an enterprise.
The authenticated user must be an administrator of the enterprise in order to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.enterprise (string) (required)name (string) (required)
The name of the code security configuration. Must be unique within the enterprise.
description (string)
A description of the code security configuration
advanced_security (string)
The enablement status of GitHub Advanced Security features. enabled will enable both Code Security and Secret Protection features.
Warning
code_security and secret_protection are deprecated values for this field. Prefer the individual code_security and secret_protection fields to set the status of these features.
Default: disabled
Can be one of: enabled, disabled, code_security, secret_protection
code_security (string)
The enablement status of GitHub Code Security features.
Can be one of: enabled, disabled, not_set
dependency_graph (string)
The enablement status of Dependency Graph
Default: enabled
Can be one of: enabled, disabled, not_set
dependency_graph_autosubmit_action (string)
The enablement status of Automatic dependency submission
Default: disabled
Can be one of: enabled, disabled, not_set
dependency_graph_autosubmit_action_options (object)
Feature options for Automatic dependency submission
labeled_runners (boolean)falsedependabot_alerts (string)
The enablement status of Dependabot alerts
Default: disabled
Can be one of: enabled, disabled, not_set
dependabot_security_updates (string)
The enablement status of Dependabot security updates
Default: disabled
Can be one of: enabled, disabled, not_set
code_scanning_options (object or null)
Security Configuration feature options for code scanning
allow_advanced (boolean or null)code_scanning_default_setup (string)
The enablement status of code scanning default setup
Default: disabled
Can be one of: enabled, disabled, not_set
code_scanning_default_setup_options (object or null)
Feature options for code scanning default setup
runner_type (string)standard, labeled, not_setrunner_label (string or null)code_scanning_delegated_alert_dismissal (string)
The enablement status of code scanning delegated alert dismissal
Default: disabled
Can be one of: enabled, disabled, not_set
secret_protection (string)
The enablement status of GitHub Secret Protection features.
Can be one of: enabled, disabled, not_set
secret_scanning (string)
The enablement status of secret scanning
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_push_protection (string)
The enablement status of secret scanning push protection
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_validity_checks (string)
The enablement status of secret scanning validity checks
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_non_provider_patterns (string)
The enablement status of secret scanning non provider patterns
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_generic_secrets (string)
The enablement status of Copilot secret scanning
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_delegated_alert_dismissal (string)
The enablement status of secret scanning delegated alert dismissal
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_extended_metadata (string)
The enablement status of secret scanning extended metadata
Default: disabled
Can be one of: enabled, disabled, not_set
private_vulnerability_reporting (string)
The enablement status of private vulnerability reporting
Default: disabled
Can be one of: enabled, disabled, not_set
enforcement (string)
The enforcement status for a security configuration
Default: enforced
Can be one of: enforced, unenforced, enterprise_enforced
201 - Successfully created code security configuration
400 - Bad Request because security product settings conflict, are unsupported by your plan, or required products are not enabled in the configuration.
403 - Forbidden
404 - Resource not found
422 - Validation failed because of unavailable security products, invalid feature dependencies, or an invalid configuration.
Request:
curl -L \
-X POST \
https://api.github.com/enterprises/ENTERPRISE/code-security/configurations \
-d '{
"name": "High rish settings",
"description": "This is a code security configuration for octo-enterprise",
"advanced_security": "enabled",
"dependabot_alerts": "enabled",
"dependabot_security_updates": "not_set",
"secret_scanning": "enabled"
}'
Response schema (Status: 201):
id: integername: stringtarget_type: string, enum: global, organization, enterprisedescription: string or nulladvanced_security: string, enum: enabled, disabled, code_security, secret_protectiondependency_graph: string, enum: enabled, disabled, not_setdependency_graph_autosubmit_action: string, enum: enabled, disabled, not_setdependency_graph_autosubmit_action_options: object:
labeled_runners: booleandependabot_alerts: string, enum: enabled, disabled, not_setdependabot_security_updates: string, enum: enabled, disabled, not_setdependabot_delegated_alert_dismissal: string or null, enum: enabled, disabled, not_set, nullcode_scanning_options: object or null:
allow_advanced: boolean or nullcode_scanning_default_setup: string, enum: enabled, disabled, not_setcode_scanning_default_setup_options: object or null:
runner_type: string or null, enum: standard, labeled, not_set, nullrunner_label: string or nullcode_scanning_delegated_alert_dismissal: string, enum: enabled, disabled, not_setsecret_scanning: string, enum: enabled, disabled, not_setsecret_scanning_push_protection: string, enum: enabled, disabled, not_setsecret_scanning_delegated_bypass: string, enum: enabled, disabled, not_setsecret_scanning_delegated_bypass_options: object:
reviewers: array of objects:
reviewer_id: required, integerreviewer_type: required, string, enum: TEAM, ROLEmode: string, enum: ALWAYS, EXEMPT, default: "ALWAYS"security_configuration_id: integersecret_scanning_validity_checks: string, enum: enabled, disabled, not_setsecret_scanning_non_provider_patterns: string, enum: enabled, disabled, not_setsecret_scanning_generic_secrets: string, enum: enabled, disabled, not_setsecret_scanning_delegated_alert_dismissal: string, enum: enabled, disabled, not_setsecret_scanning_extended_metadata: string, enum: enabled, disabled, not_setprivate_vulnerability_reporting: string, enum: enabled, disabled, not_setenforcement: string, enum: enforced, unenforced, enterprise_enforcedurl: string, format: urihtml_url: string, format: uricreated_at: string, format: date-timeupdated_at: string, format: date-timeGET /enterprises/{enterprise}/code-security/configurations/defaults
Lists the default code security configurations for an enterprise.
The authenticated user must be an administrator of the enterprise in order to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the read:enterprise scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.enterprise (string) (required)Request:
curl -L \
-X GET \
https://api.github.com/enterprises/ENTERPRISE/code-security/configurations/defaults
Response schema (Status: 200):
Array of objects:
default_for_new_repos: enum: public, private_and_internal, allconfiguration: object:
id: integername: stringtarget_type: string, enum: global, organization, enterprisedescription: string or nulladvanced_security: string, enum: enabled, disabled, code_security, secret_protectiondependency_graph: string, enum: enabled, disabled, not_setdependency_graph_autosubmit_action: string, enum: enabled, disabled, not_setdependency_graph_autosubmit_action_options: object:
labeled_runners: booleandependabot_alerts: string, enum: enabled, disabled, not_setdependabot_security_updates: string, enum: enabled, disabled, not_setdependabot_delegated_alert_dismissal: string or null, enum: enabled, disabled, not_set, nullcode_scanning_options: object or null:
allow_advanced: boolean or nullcode_scanning_default_setup: string, enum: enabled, disabled, not_setcode_scanning_default_setup_options: object or null:
runner_type: string or null, enum: standard, labeled, not_set, nullrunner_label: string or nullcode_scanning_delegated_alert_dismissal: string, enum: enabled, disabled, not_setsecret_scanning: string, enum: enabled, disabled, not_setsecret_scanning_push_protection: string, enum: enabled, disabled, not_setsecret_scanning_delegated_bypass: string, enum: enabled, disabled, not_setsecret_scanning_delegated_bypass_options: object:
reviewers: array of objects:
reviewer_id: required, integerreviewer_type: required, string, enum: TEAM, ROLEmode: string, enum: ALWAYS, EXEMPT, default: "ALWAYS"security_configuration_id: integersecret_scanning_validity_checks: string, enum: enabled, disabled, not_setsecret_scanning_non_provider_patterns: string, enum: enabled, disabled, not_setsecret_scanning_generic_secrets: string, enum: enabled, disabled, not_setsecret_scanning_delegated_alert_dismissal: string, enum: enabled, disabled, not_setsecret_scanning_extended_metadata: string, enum: enabled, disabled, not_setprivate_vulnerability_reporting: string, enum: enabled, disabled, not_setenforcement: string, enum: enforced, unenforced, enterprise_enforcedurl: string, format: urihtml_url: string, format: uricreated_at: string, format: date-timeupdated_at: string, format: date-timeGET /enterprises/{enterprise}/code-security/configurations/{configuration_id}
Gets a code security configuration available in an enterprise.
The authenticated user must be an administrator of the enterprise in order to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the read:enterprise scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.enterprise (string) (required)
The slug version of the enterprise name.
configuration_id (integer) (required)
The unique identifier of the code security configuration.
200 - OK
304 - Not modified
403 - Forbidden
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/enterprises/ENTERPRISE/code-security/configurations/CONFIGURATION_ID
Response schema (Status: 200):
Same response schema as Create a code security configuration for an enterprise.
PATCH /enterprises/{enterprise}/code-security/configurations/{configuration_id}
Updates a code security configuration in an enterprise.
The authenticated user must be an administrator of the enterprise in order to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.enterprise (string) (required)
The slug version of the enterprise name.
configuration_id (integer) (required)
The unique identifier of the code security configuration.
name (string)
The name of the code security configuration. Must be unique across the enterprise.
description (string)
A description of the code security configuration
advanced_security (string)
The enablement status of GitHub Advanced Security features. enabled will enable both Code Security and Secret Protection features.
Warning
code_security and secret_protection are deprecated values for this field. Prefer the individual code_security and secret_protection fields to set the status of these features.
Can be one of: enabled, disabled, code_security, secret_protection
code_security (string)
The enablement status of GitHub Code Security features.
Can be one of: enabled, disabled, not_set
dependency_graph (string)
The enablement status of Dependency Graph
Can be one of: enabled, disabled, not_set
dependency_graph_autosubmit_action (string)
The enablement status of Automatic dependency submission
Can be one of: enabled, disabled, not_set
dependency_graph_autosubmit_action_options (object)
Feature options for Automatic dependency submission
labeled_runners (boolean)dependabot_alerts (string)
The enablement status of Dependabot alerts
Can be one of: enabled, disabled, not_set
dependabot_security_updates (string)
The enablement status of Dependabot security updates
Can be one of: enabled, disabled, not_set
code_scanning_default_setup (string)
The enablement status of code scanning default setup
Can be one of: enabled, disabled, not_set
code_scanning_default_setup_options (object or null)
Feature options for code scanning default setup
runner_type (string)standard, labeled, not_setrunner_label (string or null)code_scanning_options (object or null)
Security Configuration feature options for code scanning
allow_advanced (boolean or null)code_scanning_delegated_alert_dismissal (string)
The enablement status of code scanning delegated alert dismissal
Default: disabled
Can be one of: enabled, disabled, not_set
secret_protection (string)
The enablement status of GitHub Secret Protection features.
Can be one of: enabled, disabled, not_set
secret_scanning (string)
The enablement status of secret scanning
Can be one of: enabled, disabled, not_set
secret_scanning_push_protection (string)
The enablement status of secret scanning push protection
Can be one of: enabled, disabled, not_set
secret_scanning_validity_checks (string)
The enablement status of secret scanning validity checks
Can be one of: enabled, disabled, not_set
secret_scanning_non_provider_patterns (string)
The enablement status of secret scanning non-provider patterns
Can be one of: enabled, disabled, not_set
secret_scanning_generic_secrets (string)
The enablement status of Copilot secret scanning
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_delegated_alert_dismissal (string)
The enablement status of secret scanning delegated alert dismissal
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_extended_metadata (string)
The enablement status of secret scanning extended metadata
Default: disabled
Can be one of: enabled, disabled, not_set
private_vulnerability_reporting (string)
The enablement status of private vulnerability reporting
Can be one of: enabled, disabled, not_set
enforcement (string)
The enforcement status for a security configuration
Can be one of: enforced, unenforced, enterprise_enforced
200 - OK
304 - Not modified
400 - Bad Request because of a global configuration, incompatible parameters, or invalid enforcement changes.
403 - Forbidden
404 - Resource not found
409 - Conflict because security configuration work is already in progress.
422 - Validation failed because the configuration is invalid.
Request:
curl -L \
-X PATCH \
https://api.github.com/enterprises/ENTERPRISE/code-security/configurations/CONFIGURATION_ID \
-d '{
"name": "octo-enterprise recommended settings v2",
"secret_scanning": "disabled",
"code_scanning_default_setup": "enabled"
}'
Response schema (Status: 200):
Same response schema as Create a code security configuration for an enterprise.
DELETE /enterprises/{enterprise}/code-security/configurations/{configuration_id}
Deletes a code security configuration from an enterprise.
Repositories attached to the configuration will retain their settings but will no longer be associated with
the configuration.
The authenticated user must be an administrator for the enterprise to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.enterprise (string) (required)
The slug version of the enterprise name.
configuration_id (integer) (required)
The unique identifier of the code security configuration.
204 - A header with no content is returned.
400 - Bad Request
403 - Forbidden
404 - Resource not found
409 - Conflict
Request:
curl -L \
-X DELETE \
https://api.github.com/enterprises/ENTERPRISE/code-security/configurations/CONFIGURATION_ID
Response schema (Status: 204):
POST /enterprises/{enterprise}/code-security/configurations/{configuration_id}/attach
Attaches an enterprise code security configuration to repositories. If the repositories specified are already attached to a configuration, they will be re-attached to the provided configuration.
If insufficient GHAS licenses are available to attach the configuration to a repository, only free features will be enabled.
The authenticated user must be an administrator for the enterprise to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.enterprise (string) (required)
The slug version of the enterprise name.
configuration_id (integer) (required)
The unique identifier of the code security configuration.
scope (string) (required)all, all_without_configurations202 - Accepted
403 - Forbidden
404 - Resource not found
409 - Conflict because security configuration work is already in progress.
422 - Validation failed because the request does not match the request schema.
Request:
curl -L \
-X POST \
https://api.github.com/enterprises/ENTERPRISE/code-security/configurations/CONFIGURATION_ID/attach \
-d '{
"scope": "all"
}'
Response schema (Status: 202):
object
PUT /enterprises/{enterprise}/code-security/configurations/{configuration_id}/defaults
Sets a code security configuration as a default to be applied to new repositories in your enterprise.
This configuration will be applied by default to the matching repository type when created, but only for organizations within the enterprise that do not already have a default code security configuration set.
The authenticated user must be an administrator for the enterprise to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.enterprise (string) (required)
The slug version of the enterprise name.
configuration_id (integer) (required)
The unique identifier of the code security configuration.
default_for_new_repos (string)all, none, private_and_internal, public200 - Default successfully changed.
403 - Forbidden
404 - Resource not found
422 - Validation failed because a public default is not supported in the current environment.
Request:
curl -L \
-X PUT \
https://api.github.com/enterprises/ENTERPRISE/code-security/configurations/CONFIGURATION_ID/defaults \
-d '{
"default_for_new_repos": "all"
}'
Response schema (Status: 200):
default_for_new_repos: string, enum: all, none, private_and_internal, publicconfiguration: object:
id: integername: stringtarget_type: string, enum: global, organization, enterprisedescription: string or nulladvanced_security: string, enum: enabled, disabled, code_security, secret_protectiondependency_graph: string, enum: enabled, disabled, not_setdependency_graph_autosubmit_action: string, enum: enabled, disabled, not_setdependency_graph_autosubmit_action_options: object:
labeled_runners: booleandependabot_alerts: string, enum: enabled, disabled, not_setdependabot_security_updates: string, enum: enabled, disabled, not_setdependabot_delegated_alert_dismissal: string or null, enum: enabled, disabled, not_set, nullcode_scanning_options: object or null:
allow_advanced: boolean or nullcode_scanning_default_setup: string, enum: enabled, disabled, not_setcode_scanning_default_setup_options: object or null:
runner_type: string or null, enum: standard, labeled, not_set, nullrunner_label: string or nullcode_scanning_delegated_alert_dismissal: string, enum: enabled, disabled, not_setsecret_scanning: string, enum: enabled, disabled, not_setsecret_scanning_push_protection: string, enum: enabled, disabled, not_setsecret_scanning_delegated_bypass: string, enum: enabled, disabled, not_setsecret_scanning_delegated_bypass_options: object:
reviewers: array of objects:
reviewer_id: required, integerreviewer_type: required, string, enum: TEAM, ROLEmode: string, enum: ALWAYS, EXEMPT, default: "ALWAYS"security_configuration_id: integersecret_scanning_validity_checks: string, enum: enabled, disabled, not_setsecret_scanning_non_provider_patterns: string, enum: enabled, disabled, not_setsecret_scanning_generic_secrets: string, enum: enabled, disabled, not_setsecret_scanning_delegated_alert_dismissal: string, enum: enabled, disabled, not_setsecret_scanning_extended_metadata: string, enum: enabled, disabled, not_setprivate_vulnerability_reporting: string, enum: enabled, disabled, not_setenforcement: string, enum: enforced, unenforced, enterprise_enforcedurl: string, format: urihtml_url: string, format: uricreated_at: string, format: date-timeupdated_at: string, format: date-timeGET /enterprises/{enterprise}/code-security/configurations/{configuration_id}/repositories
Lists the repositories associated with an enterprise code security configuration in an organization.
The authenticated user must be an administrator of the enterprise in order to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the read:enterprise scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.enterprise (string) (required)
The slug version of the enterprise name.
configuration_id (integer) (required)
The unique identifier of the code security configuration.
per_page (integer)
The number of results per page (max 100). For more information, see "Using pagination in the REST API."
Default: 30
before (string)
A cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."
after (string)
A cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."
status (string)
A comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned.
Can be: all, attached, attaching, removed, enforced, failed, updating, removed_by_enterprise, enterprise_enforced
Default: all
200 - OK
400 - Bad Request because of unsupported attachment statuses.
403 - Forbidden
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/enterprises/ENTERPRISE/code-security/configurations/CONFIGURATION_ID/repositories
Response schema (Status: 200):
Array of objects:
status: string, enum: attached, attaching, detached, removed, enforced, failed, updating, removed_by_enterprise, enterprise_enforcedrepository: Simple Repository:
id: required, integer, format: int64node_id: required, stringname: required, stringfull_name: required, stringowner: required, Simple User:
name: string or nullemail: string or nulllogin: required, stringid: required, integer, format: int64node_id: required, stringavatar_url: required, string, format: urigravatar_id: required, string or nullurl: required, string, format: urihtml_url: required, string, format: urifollowers_url: required, string, format: urifollowing_url: required, stringgists_url: required, stringstarred_url: required, stringsubscriptions_url: required, string, format: uriorganizations_url: required, string, format: urirepos_url: required, string, format: urievents_url: required, stringreceived_events_url: required, string, format: uritype: required, stringsite_admin: required, booleanstarred_at: stringuser_view_type: stringprivate: required, booleanhtml_url: required, string, format: uridescription: required, string or nullfork: required, booleanurl: required, string, format: uriarchive_url: required, stringassignees_url: required, stringblobs_url: required, stringbranches_url: required, stringcollaborators_url: required, stringcomments_url: required, stringcommits_url: required, stringcompare_url: required, stringcontents_url: required, stringcontributors_url: required, string, format: urideployments_url: required, string, format: uridownloads_url: required, string, format: urievents_url: required, string, format: uriforks_url: required, string, format: urigit_commits_url: required, stringgit_refs_url: required, stringgit_tags_url: required, stringissue_comment_url: required, stringissue_events_url: required, stringissues_url: required, stringkeys_url: required, stringlabels_url: required, stringlanguages_url: required, string, format: urimerges_url: required, string, format: urimilestones_url: required, stringnotifications_url: required, stringpulls_url: required, stringreleases_url: required, stringstargazers_url: required, string, format: uristatuses_url: required, stringsubscribers_url: required, string, format: urisubscription_url: required, string, format: uritags_url: required, string, format: uriteams_url: required, string, format: uritrees_url: required, stringhooks_url: required, string, format: uriGET /orgs/{org}/code-security/configurations
Lists all code security configurations available in an organization.
The authenticated user must be an administrator or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the read:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
target_type (string)
The target type of the code security configuration
Default: all
Can be one of: global, all
per_page (integer)
The number of results per page (max 100). For more information, see "Using pagination in the REST API."
Default: 30
before (string)
A cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."
after (string)
A cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."
200 - OK
403 - Forbidden
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/orgs/ORG/code-security/configurations
Response schema (Status: 200):
Same response schema as Get code security configurations for an enterprise.
POST /orgs/{org}/code-security/configurations
Creates a code security configuration in an organization.
The authenticated user must be an administrator or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.org (string) (required)name (string) (required)
The name of the code security configuration. Must be unique within the organization.
description (string)
A description of the code security configuration
advanced_security (string)
The enablement status of GitHub Advanced Security features. enabled will enable both Code Security and Secret Protection features.
Warning
code_security and secret_protection are deprecated values for this field. Prefer the individual code_security and secret_protection fields to set the status of these features.
Default: disabled
Can be one of: enabled, disabled, code_security, secret_protection
code_security (string)
The enablement status of GitHub Code Security features.
Can be one of: enabled, disabled, not_set
dependency_graph (string)
The enablement status of Dependency Graph
Default: enabled
Can be one of: enabled, disabled, not_set
dependency_graph_autosubmit_action (string)
The enablement status of Automatic dependency submission
Default: disabled
Can be one of: enabled, disabled, not_set
dependency_graph_autosubmit_action_options (object)
Feature options for Automatic dependency submission
labeled_runners (boolean)falsedependabot_alerts (string)
The enablement status of Dependabot alerts
Default: disabled
Can be one of: enabled, disabled, not_set
dependabot_security_updates (string)
The enablement status of Dependabot security updates
Default: disabled
Can be one of: enabled, disabled, not_set
dependabot_delegated_alert_dismissal (string)
The enablement status of Dependabot delegated alert dismissal. Requires Dependabot alerts to be enabled.
Default: disabled
Can be one of: enabled, disabled, not_set
code_scanning_options (object or null)
Security Configuration feature options for code scanning
allow_advanced (boolean or null)code_scanning_default_setup (string)
The enablement status of code scanning default setup
Default: disabled
Can be one of: enabled, disabled, not_set
code_scanning_default_setup_options (object or null)
Feature options for code scanning default setup
runner_type (string)standard, labeled, not_setrunner_label (string or null)code_scanning_delegated_alert_dismissal (string)
The enablement status of code scanning delegated alert dismissal
Default: not_set
Can be one of: enabled, disabled, not_set
secret_protection (string)
The enablement status of GitHub Secret Protection features.
Can be one of: enabled, disabled, not_set
secret_scanning (string)
The enablement status of secret scanning
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_push_protection (string)
The enablement status of secret scanning push protection
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_delegated_bypass (string)
The enablement status of secret scanning delegated bypass
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_delegated_bypass_options (object)
Feature options for secret scanning delegated bypass
reviewers (array of objects)reviewer_id (integer) (required)reviewer_type (string) (required)TEAM, ROLEmode (string)ALWAYSALWAYS, EXEMPTsecret_scanning_validity_checks (string)
The enablement status of secret scanning validity checks
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_non_provider_patterns (string)
The enablement status of secret scanning non provider patterns
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_generic_secrets (string)
The enablement status of Copilot secret scanning
Default: disabled
Can be one of: enabled, disabled, not_set
secret_scanning_delegated_alert_dismissal (string)
The enablement status of secret scanning delegated alert dismissal
Can be one of: enabled, disabled, not_set
secret_scanning_extended_metadata (string)
The enablement status of secret scanning extended metadata
Can be one of: enabled, disabled, not_set
private_vulnerability_reporting (string)
The enablement status of private vulnerability reporting
Default: disabled
Can be one of: enabled, disabled, not_set
enforcement (string)
The enforcement status for a security configuration
Default: enforced
Can be one of: enforced, unenforced
201 - Successfully created code security configuration
400 - Bad Request because security product settings conflict, are unsupported by your plan, or required products are not enabled in the configuration.
403 - Forbidden
404 - Resource not found
422 - Validation failed because of unavailable security products, invalid feature dependencies, or an invalid configuration.
Request:
curl -L \
-X POST \
https://api.github.com/orgs/ORG/code-security/configurations \
-d '{
"name": "octo-org recommended settings",
"description": "This is a code security configuration for octo-org",
"advanced_security": "enabled",
"dependabot_alerts": "enabled",
"dependabot_security_updates": "not_set",
"secret_scanning": "enabled"
}'
Response schema (Status: 201):
Same response schema as Create a code security configuration for an enterprise.
GET /orgs/{org}/code-security/configurations/defaults
Lists the default code security configurations for an organization.
The authenticated user must be an administrator or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the read:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.org (string) (required)200 - OK
304 - Not modified
403 - Forbidden
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/orgs/ORG/code-security/configurations/defaults
Response schema (Status: 200):
Same response schema as Get default code security configurations for an enterprise.
DELETE /orgs/{org}/code-security/configurations/detach
Detach code security configuration(s) from a set of repositories.
Repositories will retain their settings but will no longer be associated with the configuration.
The authenticated user must be an administrator or security manager for the organization to use this endpoint.
Repositories with active enterprise-enforced attachments are skipped unless the authenticated user can manage the enterprise's code security settings; the rest are detached. Inactive enterprise-enforced attachments, such as failed attachments, are detached. The request still returns 204 if every repository is skipped.
OAuth app tokens and classic PATs require the write:org scope. Managing enterprise-enforced configurations also requires admin:enterprise and is not supported by fine-grained PATs or GitHub App access tokens.
accept (string)application/vnd.github+json is recommended.org (string) (required)selected_repository_ids (array of integers) (required)204 - A header with no content is returned.
400 - Bad Request
403 - Forbidden
404 - Resource not found
409 - Conflict
Request:
curl -L \
-X DELETE \
https://api.github.com/orgs/ORG/code-security/configurations/detach \
-d '{
"selected_repository_ids": [
32,
91
]
}'
Response schema (Status: 204):
GET /orgs/{org}/code-security/configurations/{configuration_id}
Gets a code security configuration available in an organization.
The authenticated user must be an administrator or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
configuration_id (integer) (required)
The unique identifier of the code security configuration.
200 - OK
304 - Not modified
403 - Forbidden
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/orgs/ORG/code-security/configurations/CONFIGURATION_ID
Response schema (Status: 200):
Same response schema as Create a code security configuration for an enterprise.
PATCH /orgs/{org}/code-security/configurations/{configuration_id}
Updates a code security configuration in an organization.
The authenticated user must be an administrator or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
configuration_id (integer) (required)
The unique identifier of the code security configuration.
name (string)
The name of the code security configuration. Must be unique within the organization.
description (string)
A description of the code security configuration
advanced_security (string)
The enablement status of GitHub Advanced Security features. enabled will enable both Code Security and Secret Protection features.
Warning
code_security and secret_protection are deprecated values for this field. Prefer the individual code_security and secret_protection fields to set the status of these features.
Can be one of: enabled, disabled, code_security, secret_protection
code_security (string)
The enablement status of GitHub Code Security features.
Can be one of: enabled, disabled, not_set
dependency_graph (string)
The enablement status of Dependency Graph
Can be one of: enabled, disabled, not_set
dependency_graph_autosubmit_action (string)
The enablement status of Automatic dependency submission
Can be one of: enabled, disabled, not_set
dependency_graph_autosubmit_action_options (object)
Feature options for Automatic dependency submission
labeled_runners (boolean)dependabot_alerts (string)
The enablement status of Dependabot alerts
Can be one of: enabled, disabled, not_set
dependabot_security_updates (string)
The enablement status of Dependabot security updates
Can be one of: enabled, disabled, not_set
dependabot_delegated_alert_dismissal (string)
The enablement status of Dependabot delegated alert dismissal. Requires Dependabot alerts to be enabled.
Can be one of: enabled, disabled, not_set
code_scanning_default_setup (string)
The enablement status of code scanning default setup
Can be one of: enabled, disabled, not_set
code_scanning_default_setup_options (object or null)
Feature options for code scanning default setup
runner_type (string)standard, labeled, not_setrunner_label (string or null)code_scanning_options (object or null)
Security Configuration feature options for code scanning
allow_advanced (boolean or null)code_scanning_delegated_alert_dismissal (string)
The enablement status of code scanning delegated alert dismissal
Default: disabled
Can be one of: enabled, disabled, not_set
secret_protection (string)
The enablement status of GitHub Secret Protection features.
Can be one of: enabled, disabled, not_set
secret_scanning (string)
The enablement status of secret scanning
Can be one of: enabled, disabled, not_set
secret_scanning_push_protection (string)
The enablement status of secret scanning push protection
Can be one of: enabled, disabled, not_set
secret_scanning_delegated_bypass (string)
The enablement status of secret scanning delegated bypass
Can be one of: enabled, disabled, not_set
secret_scanning_delegated_bypass_options (object)
Feature options for secret scanning delegated bypass
reviewers (array of objects)reviewer_id (integer) (required)reviewer_type (string) (required)TEAM, ROLEmode (string)ALWAYSALWAYS, EXEMPTsecret_scanning_validity_checks (string)
The enablement status of secret scanning validity checks
Can be one of: enabled, disabled, not_set
secret_scanning_non_provider_patterns (string)
The enablement status of secret scanning non-provider patterns
Can be one of: enabled, disabled, not_set
secret_scanning_generic_secrets (string)
The enablement status of Copilot secret scanning
Can be one of: enabled, disabled, not_set
secret_scanning_delegated_alert_dismissal (string)
The enablement status of secret scanning delegated alert dismissal
Can be one of: enabled, disabled, not_set
secret_scanning_extended_metadata (string)
The enablement status of secret scanning extended metadata
Can be one of: enabled, disabled, not_set
private_vulnerability_reporting (string)
The enablement status of private vulnerability reporting
Can be one of: enabled, disabled, not_set
enforcement (string)
The enforcement status for a security configuration
Can be one of: enforced, unenforced
200 - Response when a configuration is updated
204 - Response when no new updates are made
400 - Bad Request because of a global configuration, incompatible parameters, or an attempt to update attributes of an enterprise-owned configuration.
403 - Forbidden
404 - Resource not found
409 - Conflict because security configuration work is already in progress.
422 - Validation failed because of invalid enforcement values, unavailable security products, an attempt to change enterprise-enforced enforcement, or an invalid configuration.
Request:
curl -L \
-X PATCH \
https://api.github.com/orgs/ORG/code-security/configurations/CONFIGURATION_ID \
-d '{
"name": "octo-org recommended settings v2",
"secret_scanning": "disabled",
"code_scanning_default_setup": "enabled"
}'
Response schema (Status: 200):
Same response schema as Create a code security configuration for an enterprise.
DELETE /orgs/{org}/code-security/configurations/{configuration_id}
Deletes the desired code security configuration from an organization.
Repositories attached to the configuration will retain their settings but will no longer be associated with
the configuration.
The authenticated user must be an administrator or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
configuration_id (integer) (required)
The unique identifier of the code security configuration.
204 - A header with no content is returned.
400 - Bad Request
403 - Forbidden
404 - Resource not found
409 - Conflict
Request:
curl -L \
-X DELETE \
https://api.github.com/orgs/ORG/code-security/configurations/CONFIGURATION_ID
Response schema (Status: 204):
POST /orgs/{org}/code-security/configurations/{configuration_id}/attach
Attach a code security configuration to a set of repositories. If the repositories specified are already attached to a configuration, they will be re-attached to the provided configuration.
If insufficient GHAS licenses are available to attach the configuration to a repository, only free features will be enabled.
The authenticated user must be an administrator or security manager for the organization to use this endpoint.
Directly applying an enterprise-enforced configuration also requires permission to manage the enterprise's code security settings. Without it, the request returns 403 and no repositories change.
When applying a different configuration, repositories with active enterprise-enforced attachments are skipped unless the authenticated user can manage the enterprise's code security settings; the remaining repositories are updated. The request still returns 202 if every repository is skipped.
OAuth app tokens and classic PATs require the write:org scope. Directly applying an enterprise-enforced configuration also requires admin:enterprise and is not supported by fine-grained PATs or GitHub App access tokens.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
configuration_id (integer) (required)
The unique identifier of the code security configuration.
scope (string) (required)
The type of repositories to attach the configuration to. selected means the configuration will be attached to only the repositories specified by selected_repository_ids
Can be one of: all, all_without_configurations, public, private_or_internal, selected
selected_repository_ids (array of integers)
An array of repository IDs to attach the configuration to. You can only provide a list of repository ids when the scope is set to selected.
202 - Accepted
400 - Bad Request
403 - Forbidden
404 - Resource not found
409 - Conflict because security configuration work is already in progress for the
organization, security configuration changes are blocked for the organization,
or another organization in the same enterprise is applying security configurations.
422 - Validation failed because the body does not match the request schema, scope
is selected but selected_repository_ids is missing or empty, or a non-empty
selected_repository_ids array is provided for another scope.
Request:
curl -L \
-X POST \
https://api.github.com/orgs/ORG/code-security/configurations/CONFIGURATION_ID/attach \
-d '{
"scope": "selected",
"selected_repository_ids": [
32,
91
]
}'
Response schema (Status: 202):
Same response schema as Attach an enterprise configuration to repositories.
PUT /orgs/{org}/code-security/configurations/{configuration_id}/defaults
Sets a code security configuration as a default to be applied to new repositories in your organization.
This configuration will be applied to the matching repository type (all, none, public, private and internal) by default when they are created.
The authenticated user must be an administrator or security manager for the organization to use this endpoint. Setting an enterprise-enforced configuration as the default also requires permission to manage the enterprise's code security settings.
A default set with this endpoint is an organization default, even if the configuration is owned or enforced by the enterprise. An enterprise-enforced configuration set as an enterprise-level default for the same repository visibility takes precedence.
OAuth app tokens and classic PATs require the write:org scope; setting an enterprise-enforced configuration as the default also requires admin:enterprise. Fine-grained PATs and GitHub App access tokens cannot perform that action.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
configuration_id (integer) (required)
The unique identifier of the code security configuration.
default_for_new_repos (string)all, none, private_and_internal, public200 - Default successfully changed.
403 - Forbidden
404 - Resource not found
422 - Validation failed because a public default is not supported in the current environment.
Request:
curl -L \
-X PUT \
https://api.github.com/orgs/ORG/code-security/configurations/CONFIGURATION_ID/defaults \
-d '{
"default_for_new_repos": "all"
}'
Response schema (Status: 200):
Same response schema as Set a code security configuration as a default for an enterprise.
GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories
Lists the repositories associated with a code security configuration in an organization.
The authenticated user must be an administrator or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the read:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
configuration_id (integer) (required)
The unique identifier of the code security configuration.
per_page (integer)
The number of results per page (max 100). For more information, see "Using pagination in the REST API."
Default: 30
before (string)
A cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."
after (string)
A cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."
status (string)
A comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned.
Can be: all, attached, attaching, detached, removed, enforced, failed, updating, removed_by_enterprise, enterprise_enforced
Default: all
200 - OK
400 - Bad Request because of unsupported attachment statuses.
403 - Forbidden
404 - Resource not found
422 - Validation failed because removed and detached are requested together.
Request:
curl -L \
-X GET \
https://api.github.com/orgs/ORG/code-security/configurations/CONFIGURATION_ID/repositories
Response schema (Status: 200):
Same response schema as Get repositories associated with an enterprise code security configuration.
GET /repos/{owner}/{repo}/code-security-configuration
Get the code security configuration that manages a repository's code security settings.
The authenticated user must be an administrator or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
200 - OK
204 - A header with no content is returned.
304 - Not modified
403 - Forbidden
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/repos/OWNER/REPO/code-security-configuration
Response schema (Status: 200):
status: string, enum: attached, attaching, detached, removed, enforced, failed, updating, removed_by_enterprise, enterprise_enforcedconfiguration: object:
id: integername: stringtarget_type: string, enum: global, organization, enterprisedescription: string or nulladvanced_security: string, enum: enabled, disabled, code_security, secret_protectiondependency_graph: string, enum: enabled, disabled, not_setdependency_graph_autosubmit_action: string, enum: enabled, disabled, not_setdependency_graph_autosubmit_action_options: object:
labeled_runners: booleandependabot_alerts: string, enum: enabled, disabled, not_setdependabot_security_updates: string, enum: enabled, disabled, not_setdependabot_delegated_alert_dismissal: string or null, enum: enabled, disabled, not_set, nullcode_scanning_options: object or null:
allow_advanced: boolean or nullcode_scanning_default_setup: string, enum: enabled, disabled, not_setcode_scanning_default_setup_options: object or null:
runner_type: string or null, enum: standard, labeled, not_set, nullrunner_label: string or nullcode_scanning_delegated_alert_dismissal: string, enum: enabled, disabled, not_setsecret_scanning: string, enum: enabled, disabled, not_setsecret_scanning_push_protection: string, enum: enabled, disabled, not_setsecret_scanning_delegated_bypass: string, enum: enabled, disabled, not_setsecret_scanning_delegated_bypass_options: object:
reviewers: array of objects:
reviewer_id: required, integerreviewer_type: required, string, enum: TEAM, ROLEmode: string, enum: ALWAYS, EXEMPT, default: "ALWAYS"security_configuration_id: integersecret_scanning_validity_checks: string, enum: enabled, disabled, not_setsecret_scanning_non_provider_patterns: string, enum: enabled, disabled, not_setsecret_scanning_generic_secrets: string, enum: enabled, disabled, not_setsecret_scanning_delegated_alert_dismissal: string, enum: enabled, disabled, not_setsecret_scanning_extended_metadata: string, enum: enabled, disabled, not_setprivate_vulnerability_reporting: string, enum: enabled, disabled, not_setenforcement: string, enum: enforced, unenforced, enterprise_enforcedurl: string, format: urihtml_url: string, format: uricreated_at: string, format: date-timeupdated_at: string, format: date-time