Free · Daily brief + weekly playbookDaily 60-sec AI Voice Brief + Weekly Production AI Agent PlaybookGet the brief →
ReleaseAPI / Product · ActionableGitHub Changelog→ original

GitHub Lets You Turn On AI Scan for Repositories via REST API

GitHub has added management of AI Scan for repositories to its REST API, so you can turn the feature on or off with a script at the organization or repository level. The organization sets the default, repositories inherit it, and they can opt out. Enabling the setting does not start any scans: checks run manually and consume Code Security AI credits. That makes it practical to build the rollout into scripts and infrastructure as code.

AI-processed from GitHub Changelog; edited by Hamidun News
GitHub Lets You Turn On AI Scan for Repositories via REST API
Source: GitHub Changelog. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceGitHub Changelog ↗
Editor-in-Chief
Two PATCH endpointsone for the organization level and one for an individual repository
Key metric #2If an enterprise policy prohibits AI Scan, the request to enable it returns an error
Key metric #3GitHub Enterprise Server is not supported

When a company has hundreds of repositories, any security setting turns into routine work: find the right toggle, click it, repeat. GitHub is removing that routine for AI Scan in code scanning. The feature can now be turned on and off through the REST API, both for an entire organization and for a single repository. It is currently in public preview.

What exactly was added

A new parameter was added to the existing AI Scan management endpoints. You work with it through two requests:

  • PATCH /orgs/{org}/code-scanning/ai-scan — setting at the organization level;
  • PATCH /repos/{owner}/{repo}/code-scanning/ai-scan — setting for a specific repository.

This means the AI Scan rollout across repositories can be described in a script or in infrastructure as code (for example, in a Terraform-style pipeline), with no need to change settings manually one organization or one repository at a time. For platform engineering and security teams, this is the main practical benefit: the configuration becomes reproducible, can be stored in a repository, and can be reviewed like any other change.

How inheritance works

The logic matches the existing AI Scan setting for pull requests:

  • if an organization has disabled AI Scan for repositories, individual repositories cannot enable it;
  • if the organization has enabled the feature, repositories inherit that value, but each of them can opt out;
  • if the enterprise policy does not allow AI Scan, the request to enable it fails with an error.

GitHub also describes the case where two settings are changed in a single request. If at least one of the changes is blocked, the API returns an error and none of the changes are applied. For automation this is useful: you cannot accidentally end up in a half-applied state where one value changed and the other did not.

For example, a security team wants to enable AI Scan across all of the company's organizations except a few repositories with legacy code, where scanning would only generate noise. Now this takes two steps: enable the feature at the organization level with a script, then turn it off selectively for the repositories in question.

What to keep in mind

Enabling the setting does not scan anything by itself. Users with write access still run scans manually, on demand, and each scan consumes GitHub Code Security AI credits. So a mass enablement will not cause a sudden bill: usage appears only when someone actually runs a scan. But if you plan to roll the feature out widely, think in advance about who will run scans and how often, and monitor credit consumption.

Management rights are distributed as follows:

  • organization owners and security managers change the organization setting;
  • repository administrators can turn it off for their individual repositories;
  • enterprise owners must first allow AI Scan in the enterprise policy.

There are also availability limits. AI Scan for repositories works for public repositories owned by organizations, and for private and internal repositories if GitHub Code Security or GitHub Advanced Security is in place. GitHub Enterprise Server is not supported.

What to do in practice

If you are responsible for developer tooling or AppSec in a large organization, review the REST API documentation for code scanning and check which organizations meet the conditions. First make sure the enterprise policy allows AI Scan, otherwise enablement requests will return errors. Then describe the configuration in code and set up exceptions for repositories where scanning is not needed.

While this is a preview, response formats and API behavior may change. For a pilot that is enough, but for critical processes it is better to build the feature into your workflows with room for adjustments.

Story

Key Questions Answered

What exactly was added?

A new parameter was added to the existing AI Scan management endpoints. You work with it through two requests: PATCH /orgs/{org}/code-scanning/ai-scan — setting at the organization level; PATCH /repos/{owner}/{repo}/code-scanning/ai-scan — setting for a specific repository. This means the AI Scan rollout across repositories can be described in a script or in infrastructure as code (for example, in a Terraform-style pipeline), with no need to change settings manually one organization or one repository at a time.

How inheritance works?

The logic matches the existing AI Scan setting for pull requests: if an organization has disabled AI Scan for repositories, individual repositories cannot enable it; if the organization has enabled the feature, repositories inherit that value, but each of them can opt out; if the enterprise policy does not allow AI Scan, the request to enable it fails with an error. GitHub also describes the case where two settings are changed in a single request.

What to keep in mind?

Enabling the setting does not scan anything by itself. Users with write access still run scans manually, on demand, and each scan consumes GitHub Code Security AI credits. So a mass enablement will not cause a sudden bill: usage appears only when someone actually runs a scan. But if you plan to roll the feature out widely, think in advance about who will run scans and how often, and monitor credit consumption.

ZK
Zhemal Khamidun — Head of AI at Alpina Digital · MIPT (academic supervisor of the Tech Entrepreneurship department). Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
Jemal Hamidun

Editor-in-chief · Cite this analysis

Jemal Hamidun

Head of AI at Alpina Digital · Academic Supervisor of the Tech Entrepreneurship Department at MIPT

Head of AI & CPO of AlpinaGPT at Alpina Digital, Academic Lead of Tech Entrepreneurship at MIPT. Founder of Hamidun News and Vibe Academy.

Ready-to-paste citation for journalists, blogs and Telegram channels

Source: Hamidun News — GitHub Lets You Turn On AI Scan for Repositories via REST API https://news.hamidun.com/en/news/17398/github-lets-you-turn-on-ai-scan-for-repositories-via-rest-ap

What do you think?
Loading comments…