Skip to content

GitHub adds a per-repository API toggle for its AI code-vulnerability scanner

· by

The short version

GitHub added a repository_scan setting to its AI Scan REST endpoints on November 13, 2026, so admins can script rollout and opt-out across thousands of repositories instead of clicking through settings one at a time.

GitHub adds a per-repository API toggle for its AI code-vulnerability scanner

GitHub can now turn its AI-powered vulnerability scanner on or off for individual repositories through the REST API instead of the web UI, a change aimed at security teams rolling the feature out across large organizations.

What

GitHub added a repository_scan setting to its AI Scan REST endpoints on November 13, 2026: PATCH /orgs/{org}/code-scanning/ai-scan and PATCH /repos/{owner}/{repo}/code-scanning/ai-scan, per GitHub's changelog post. When an organization enables the setting, its repositories inherit it but repository admins can opt individual repos back out; when an organization disables it, repositories cannot turn it on themselves. Both pr_scan and repository_scan can be set in one request, and if an enterprise policy blocks the change, the whole request fails with a 422 and neither setting moves. Flipping the switch does not start a scan on its own. Each actual run still consumes GitHub Code Security AI credits, and private or internal repositories need GitHub Code Security or Advanced Security to use the feature at all.

Security teams can now script rollout instead of clicking through it

For platform and AppSec teams managing hundreds or thousands of repositories, this closes a real gap: AI Scan for whole repositories only reached public preview on October 28, 2026, and until this week the only lever for repository-level control was the GitHub UI. A REST endpoint means the setting can go into Terraform, a provisioning script, or a repo-creation pipeline, so a new repo lands with the organization's AI Scan policy already applied rather than waiting on someone to toggle it by hand. The combined 422 behavior on pr_scan and repository_scan also matters operationally: a bad bulk update rolls back cleanly rather than leaving some repos half-configured. Because each scan burns Code Security AI credits, the same API now doubles as a budget lever. Teams that want AI Scan's broader coverage but not its spend everywhere can default an org to on and opt out specific repos (say, low-risk forks or archived projects) through the same scripted path used for enablement.

Context

GitHub shipped the first version of this API pattern for pull-request scanning back on September 10, 2026, and extended the whole-repository scan itself to public preview on October 28, 2026, before closing the loop with repository-level API control this week. GitHub's own announcement describes the repository scan as catching issues "across your whole repository, not just in pull request changes," covering languages and frameworks CodeQL does not support. That framing is GitHub's own, not an independent benchmark.

What to watch next

AI Scan for repositories is still in public preview, so pricing beyond the credit-consumption model has not been finalized. Watch for GitHub to publish a GA date and a clearer per-scan or per-credit cost breakdown, and for whether this cascade-with-opt-out API pattern spreads to other GitHub Advanced Security features that currently only toggle through the UI.

Sources