GitHub adds REST API controls for AI Scan of repositories
GitHub announced on November 13, 2026 that code scanning's AI Scan for repositories can now be turned on or off through the REST API at the organization and repository levels. The public preview adds a repository_scan setting to the existing AI Scan enablement endpoints.
The setting is enabled or disabled through GET and PATCH requests on /orgs/{org}/code-scanning/ai-scan and /repos/{owner}/{repo}/code-scanning/ai-scan. GitHub says it works like the existing pr_scan setting for pull requests, and both can be updated in one request.
Inheritance follows the organization. If an organization disables AI Scan for repositories, its repositories cannot enable it. If the organization enables it, repositories inherit the setting and can opt out individually.
If an enterprise policy does not allow AI Scan, requests to enable it return a 422 error. When one change in a combined request is blocked, the request returns 422 and neither setting changes.
Turning the setting on does not start a scan. Users with write access still run scans on demand, and each scan consumes GitHub Code Security AI credits. The announcement does not give a per-scan credit amount.
Organization owners and security managers can manage the organization setting, and repository administrators can opt individual repositories out. AI Scan for repositories is available for public repositories owned by organizations and for private or internal repositories with GitHub Code Security or GitHub Advanced Security. Enterprise owners must first allow it in enterprise policy. GitHub Enterprise Server is not supported.