Skip to content

GitHub: Create a code security configuration for an enterprise

GitHub codeSecurity.codeSecurityCreateConfigurationForEnterprise: arguments, response, policy and SDK examples.

← Code security operations · Get started

Operation github.code_security_create_configuration_for_enterprise

Provider route: POST /enterprises/{enterprise}/code-security/configurations. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/github with npm, or alter-sdk-github with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { GitHubIntegration } from "@alter-ai/github";
async function execute(input: Parameters<GitHubIntegration["codeSecurity"]["codeSecurityCreateConfigurationForEnterprise"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new GitHubIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.codeSecurity.codeSecurityCreateConfigurationForEnterprise(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_github import GitHubIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = GitHubIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.code_security.code_security_create_configuration_for_enterprise(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.enterprisestringRequired within parent
bodyobjectRequired within parentAdditional keys: not allowed
body.advanced_securitystringOptionalThe 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
One of: enabled, disabled, code_security, secret_protection
body.code_scanning_default_setupstringOptionalThe enablement status of code scanning default setup
Default: disabled
One of: enabled, disabled, not_set
body.code_scanning_default_setup_optionsModelOptionalExpand Create a code security configuration — request body — body code scanning default setup options
body.code_scanning_delegated_alert_dismissalstringOptionalThe enablement status of code scanning delegated alert dismissal
Default: disabled
One of: enabled, disabled, not_set
body.code_scanning_optionsModelOptionalExpand Create a code security configuration — request body — body code scanning options
body.code_securitystringOptionalThe enablement status of GitHub Code Security features.
One of: enabled, disabled, not_set
body.dependabot_alertsstringOptionalThe enablement status of Dependabot alerts
Default: disabled
One of: enabled, disabled, not_set
body.dependabot_reachabilitystringOptionalThe enablement status of reachability analysis for Dependabot. Only available for enterprises with access to reachability analysis.
Requires Dependabot alerts to be enabled when set to `enabled`. Must be `disabled` when Dependabot alerts is `disabled`.
`not_set` leaves existing repository settings unchanged.
Default: disabled
One of: enabled, disabled, not_set
body.dependabot_security_updatesstringOptionalThe enablement status of Dependabot security updates
Default: disabled
One of: enabled, disabled, not_set
body.dependency_graphstringOptionalThe enablement status of Dependency Graph
Default: enabled
One of: enabled, disabled, not_set
body.dependency_graph_autosubmit_actionstringOptionalThe enablement status of Automatic dependency submission
Default: disabled
One of: enabled, disabled, not_set
body.dependency_graph_autosubmit_action_optionsobjectOptionalFeature options for Automatic dependency submission
body.dependency_graph_autosubmit_action_options.labeled_runnersbooleanOptionalWhether to use runners labeled with ‘dependency-submission’ or standard GitHub runners.
Default: false
body.descriptionstringOptionalA description of the code security configuration
Maximum length: 255
body.enforcementstringOptionalThe enforcement status for a security configuration
Default: enforced
One of: enforced, unenforced, enterprise_enforced
body.namestringRequired within parentThe name of the code security configuration. Must be unique within the enterprise.
body.private_vulnerability_reportingstringOptionalThe enablement status of private vulnerability reporting
Default: disabled
One of: enabled, disabled, not_set
body.secret_protectionstringOptionalThe enablement status of GitHub Secret Protection features.
One of: enabled, disabled, not_set
body.secret_scanningstringOptionalThe enablement status of secret scanning
Default: disabled
One of: enabled, disabled, not_set
body.secret_scanning_delegated_alert_dismissalstringOptionalThe enablement status of secret scanning delegated alert dismissal
Default: disabled
One of: enabled, disabled, not_set
body.secret_scanning_extended_metadatastringOptionalThe enablement status of secret scanning extended metadata
Default: disabled
One of: enabled, disabled, not_set
body.secret_scanning_generic_secretsstringOptionalThe enablement status of Copilot secret scanning
Default: disabled
One of: enabled, disabled, not_set
body.secret_scanning_generic_secrets_push_protectionstringOptionalThe enablement status of generic secrets push protection
Default: disabled
One of: enabled, disabled, not_set
body.secret_scanning_non_provider_patternsstringOptionalThe enablement status of secret scanning non provider patterns
Default: disabled
One of: enabled, disabled, not_set
body.secret_scanning_push_protectionstringOptionalThe enablement status of secret scanning push protection
Default: disabled
One of: enabled, disabled, not_set
body.secret_scanning_validity_checksstringOptionalThe enablement status of secret scanning validity checks
Default: disabled
One of: enabled, disabled, not_set

Referenced models: Create a code security configuration — request body — body code scanning default setup options, Create a code security configuration — request body — body code scanning options

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Get a code security configuration — response body

Referenced models: Get a code security configuration — response body

Get a code security configuration — response body
FieldTypePresenceDescription and constraints
$objectRootA code security configuration
advanced_securitystringOptionalThe enablement status of GitHub Advanced Security
Known values: enabled, disabled, code_security, secret_protection
code_scanning_default_setupstringOptionalThe enablement status of code scanning default setup
Known values: enabled, disabled, not_set
code_scanning_default_setup_optionsJSONOptional
code_scanning_default_setup_options (anyOf 1)objectAlternativeFeature options for code scanning default setup
code_scanning_default_setup_options (anyOf 1).runner_labelJSONOptional
code_scanning_default_setup_options (anyOf 1).runner_label (anyOf 1)stringAlternativeThe label of the runner to use for code scanning when runner_type is 'labeled'.
code_scanning_default_setup_options (anyOf 1).runner_label (anyOf 2)nullAlternative
code_scanning_default_setup_options (anyOf 1).runner_typeJSONOptional
code_scanning_default_setup_options (anyOf 1).runner_type (anyOf 1)stringAlternativeWhether to use labeled runners or standard GitHub runners.
Known values: standard, labeled, not_set
code_scanning_default_setup_options (anyOf 1).runner_type (anyOf 2)nullAlternative
code_scanning_default_setup_options (anyOf 2)nullAlternative
code_scanning_delegated_alert_dismissalstringOptionalThe enablement status of code scanning delegated alert dismissal
Known values: enabled, disabled, not_set
code_scanning_optionsJSONOptional
code_scanning_options (anyOf 1)objectAlternativeFeature options for code scanning
code_scanning_options (anyOf 1).allow_advancedJSONOptional
code_scanning_options (anyOf 1).allow_advanced (anyOf 1)booleanAlternativeWhether to allow repos which use advanced setup
code_scanning_options (anyOf 1).allow_advanced (anyOf 2)nullAlternative
code_scanning_options (anyOf 2)nullAlternative
created_atstringOptionalFormat: date-time
dependabot_alertsstringOptionalThe enablement status of Dependabot alerts
Known values: enabled, disabled, not_set
dependabot_delegated_alert_dismissalJSONOptional
dependabot_delegated_alert_dismissal (anyOf 1)stringAlternativeThe enablement status of Dependabot delegated alert dismissal
Known values: enabled, disabled, not_set
dependabot_delegated_alert_dismissal (anyOf 2)nullAlternative
dependabot_reachabilitystringOptionalThe enablement status of reachability analysis for Dependabot. Only returned for organizations and enterprises with access to reachability analysis.
Known values: enabled, disabled, not_set
dependabot_security_updatesstringOptionalThe enablement status of Dependabot security updates
Known values: enabled, disabled, not_set
dependency_graphstringOptionalThe enablement status of Dependency Graph
Known values: enabled, disabled, not_set
dependency_graph_autosubmit_actionstringOptionalThe enablement status of Automatic dependency submission
Known values: enabled, disabled, not_set
dependency_graph_autosubmit_action_optionsobjectOptionalFeature options for Automatic dependency submission
dependency_graph_autosubmit_action_options.labeled_runnersbooleanOptionalWhether to use runners labeled with 'dependency-submission' or standard GitHub runners.
descriptionJSONOptional
description (anyOf 1)stringAlternativeA description of the code security configuration
description (anyOf 2)nullAlternative
enforcementstringOptionalThe enforcement status for a security configuration
Known values: enforced, unenforced, enterprise_enforced
html_urlstringOptionalThe URL of the configuration
Format: uri
idJSONOptional
id (anyOf 1)integerAlternativeThe ID of the code security configuration
id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
namestringOptionalThe name of the code security configuration. Must be unique within the organization.
private_vulnerability_reportingstringOptionalThe enablement status of private vulnerability reporting
Known values: enabled, disabled, not_set
secret_scanningstringOptionalThe enablement status of secret scanning
Known values: enabled, disabled, not_set
secret_scanning_delegated_alert_dismissalstringOptionalThe enablement status of secret scanning delegated alert dismissal
Known values: enabled, disabled, not_set
secret_scanning_delegated_bypassstringOptionalThe enablement status of secret scanning delegated bypass
Known values: enabled, disabled, not_set
secret_scanning_delegated_bypass_optionsobjectOptionalFeature options for secret scanning delegated bypass
secret_scanning_delegated_bypass_options.reviewersarrayOptionalThe bypass reviewers for secret scanning delegated bypass
secret_scanning_delegated_bypass_options.reviewers[]objectEach item
secret_scanning_delegated_bypass_options.reviewers[].modestringOptionalThe bypass mode for the reviewer
Known values: ALWAYS, EXEMPT
Default: ALWAYS
secret_scanning_delegated_bypass_options.reviewers[].reviewer_idJSONRequired within parent
secret_scanning_delegated_bypass_options.reviewers[].reviewer_id (anyOf 1)integerAlternativeThe ID of the team or role selected as a bypass reviewer
secret_scanning_delegated_bypass_options.reviewers[].reviewer_id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
secret_scanning_delegated_bypass_options.reviewers[].reviewer_typestringRequired within parentThe type of the bypass reviewer
Known values: TEAM, ROLE
secret_scanning_delegated_bypass_options.reviewers[].security_configuration_idJSONOptional
secret_scanning_delegated_bypass_options.reviewers[].security_configuration_id (anyOf 1)integerAlternativeThe ID of the security configuration associated with this bypass reviewer
secret_scanning_delegated_bypass_options.reviewers[].security_configuration_id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
secret_scanning_extended_metadatastringOptionalThe enablement status of secret scanning extended metadata
Known values: enabled, disabled, not_set
secret_scanning_generic_secretsstringOptionalThe enablement status of Copilot secret scanning
Known values: enabled, disabled, not_set
secret_scanning_generic_secrets_push_protectionstringOptionalThe enablement status of generic secrets push protection
Known values: enabled, disabled, not_set
secret_scanning_non_provider_patternsstringOptionalThe enablement status of secret scanning non-provider patterns
Known values: enabled, disabled, not_set
secret_scanning_push_protectionstringOptionalThe enablement status of secret scanning push protection
Known values: enabled, disabled, not_set
secret_scanning_validity_checksstringOptionalThe enablement status of secret scanning validity checks
Known values: enabled, disabled, not_set
target_typestringOptionalThe type of the code security configuration.
Known values: global, organization, enterprise
updated_atstringOptionalFormat: date-time
urlstringOptionalThe URL of the configuration
Format: uri
Create a code security configuration — request body — body code scanning default setup options
FieldTypePresenceDescription and constraints
$JSONRoot
$ (anyOf 1)objectAlternativeFeature options for code scanning default setup
$ (anyOf 1).runner_labelJSONOptional
$ (anyOf 1).runner_label (anyOf 1)stringAlternativeThe label of the runner to use for code scanning default setup when runner_type is 'labeled'.
$ (anyOf 1).runner_label (anyOf 2)nullAlternative
$ (anyOf 1).runner_typestringOptionalWhether to use labeled runners or standard GitHub runners.
One of: standard, labeled, not_set
$ (anyOf 2)nullAlternative
Create a code security configuration — request body — body code scanning options
FieldTypePresenceDescription and constraints
$JSONRoot
$ (anyOf 1)objectAlternativeSecurity Configuration feature options for code scanning
$ (anyOf 1).allow_advancedJSONOptional
$ (anyOf 1).allow_advanced (anyOf 1)booleanAlternativeWhether to allow repos which use advanced setup
$ (anyOf 1).allow_advanced (anyOf 2)nullAlternative
$ (anyOf 2)nullAlternative

SDK function policy ID: github.code_security_create_configuration_for_enterprise. Catalog operation: code-security/create-configuration-for-enterprise. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Pinned headers: {"X-GitHub-Api-Version": "2026-03-10", "User-Agent": "Alter", "Accept": "application/vnd.github+json"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.