---
title: "Update code security and analysis features for an enterprise"
method: PATCH
path: "/enterprises/{enterprise}/code_security_and_analysis"
tags: ["enterprise-admin"]
deprecated: true
---

# Update code security and analysis features for an enterprise

`PATCH /enterprises/{enterprise}/code_security_and_analysis`

> **Deprecated.**

> [!WARNING]
> **Closing down notice:** The ability to update code security and analysis settings for an enterprise is closing down. Please use [code security configurations](https://docs.github.com/enterprise-cloud@latest/rest/code-security/configurations) instead. For more information, see the [changelog](https://github.blog/changelog/2024-09-27-upcoming-replacement-of-enterprise-code-security-enablement-ui-and-apis).

Updates the settings for advanced security, Dependabot alerts, secret scanning, and push protection for new repositories in an enterprise.

The authenticated user must be an administrator of the enterprise to use this endpoint.

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

## Path parameters

- `enterprise` string, required

## Request body

- object
  - `advanced_security_enabled_for_new_repositories` boolean — Whether GitHub Advanced Security is automatically enabled for new repositories. For more information, see "[About GitHub Advanced Security](https://docs.github.com/enterprise-cloud@latest/get-started/learning-about-github/about-github-advanced-security)."
  - `advanced_security_enabled_new_user_namespace_repos` boolean — Whether GitHub Advanced Security is automatically enabled for new user namespace repositories. For more information, see "[About GitHub Advanced Security](https://docs.github.com/enterprise-cloud@latest/get-started/learning-about-github/about-github-advanced-security)."
  - `dependabot_alerts_enabled_for_new_repositories` boolean — Whether Dependabot alerts are automatically enabled for new repositories. For more information, see "[About Dependabot alerts](https://docs.github.com/enterprise-cloud@latest/code-security/dependabot/dependabot-alerts/about-dependabot-alerts)."
  - `secret_scanning_enabled_for_new_repositories` boolean — Whether secret scanning is automatically enabled for new repositories. For more information, see "[About secret scanning](https://docs.github.com/enterprise-cloud@latest/code-security/secret-scanning/about-secret-scanning)."
  - `secret_scanning_push_protection_enabled_for_new_repositories` boolean — Whether secret scanning push protection is automatically enabled for new repositories. For more information, see "[Protecting pushes with secret scanning](https://docs.github.com/enterprise-cloud@latest/code-security/secret-scanning/protecting-pushes-with-secret-scanning)."
  - `secret_scanning_push_protection_custom_link` string, nullable — The URL that will be displayed to contributors who are blocked from pushing a secret. For more information, see "[Protecting pushes with secret scanning](https://docs.github.com/enterprise-cloud@latest/code-security/secret-scanning/protecting-pushes-with-secret-scanning)." To disable this functionality, set this field to `null`.
  - `secret_scanning_non_provider_patterns_enabled_for_new_repositories` boolean, nullable — Whether secret scanning of non-provider patterns is enabled for new repositories under this enterprise.

## Response `204`

Action started

## Other responses

- `404` — Resource not found
- `422` — The action could not be taken due to an in progress enablement, or a policy is preventing enablement

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-2.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-2/versions/8ae6d0c8716e/schema)
