repository_scan setting alongside the existing pr_scan setting. Anyone who has already scripted a pull request rollout can reuse the same calls for the full-repository scan.
What changed
The setting sits on the same endpoints as before:
GETandPATCH /orgs/{org}/code-scanning/ai-scanGETandPATCH /repos/{owner}/{repo}/code-scanning/ai-scan
Set repository_scan to enabled or disabled. GitHub's documentation shows an organization-level PATCH that sets both properties in one body. The examples use the X-GitHub-Api-Version: 2026-03-10 header, which is the version shown in the docs. The documented example is -d '{"pr_scan":"enabled","repository_scan":"enabled"}'. The response returns both values.
The docs show the same two properties on the repository-level endpoints. Not every doc rendering has caught up, though. A search snippet from the Enterprise Cloud docs page still listed only pr_scan for the repository PATCH. If your script depends on repository_scan, test it against a non-critical repository first. This is preview functionality and GitHub says it may change.
How the hierarchy works
The rules match the pull request setting, so existing assumptions carry over:
- Organization disabled: repositories cannot enable the feature themselves.
- Organization enabled: repositories inherit the setting. Repository administrators can opt individual repositories out.
- Enterprise policy: if the enterprise does not allow AI Scan, a request to enable it returns a
422error. GitHub's docs say the enterprise policy is "Not allowed" by default. Allowing it does not switch it on. - Combined updates: you can send
pr_scanandrepository_scanin one request. If either change is blocked, the request returns422and neither setting changes.
The all-or-nothing behavior matters for automation. A script that sends both settings can't end up half-configured. If an enterprise policy blocks one of the two, you also won't get a partial result. A script should treat a 422 as "nothing changed" and read the settings back before retrying.
Enabling is not scanning
Turning on repository_scan does not start a scan. Users with write access run scans on demand. GitHub's documentation says each scan consumes Code Security AI credits. That usage is separate from active-committer licensing.
Some documented behavior to know before a broad rollout:
- Scope: scans cover the default branch only. They are triggered manually, with no scheduled or on-push scans. Self-hosted runners are not supported.
- Languages: AI Scan supports all languages, including those CodeQL already covers. It runs independently of CodeQL.
- Results: findings appear in the code scanning alert list alongside CodeQL alerts. You can filter them by the AI Scan tool.
- Accuracy: matching against existing CodeQL alerts is best effort, so duplicates can occur. GitHub also warns that AI-generated findings can be inaccurate and says a scan does not guarantee it finds every vulnerability.
- Limits: detection steps are capped at 30 minutes and 150,000 AI credits.
- Billing: usage is billed to the account responsible for the organization's billing. Included AI credits from a Copilot entitlement are used first. After that, usage is metered under your budgets. A hard budget that leaves no credits means scans can't produce findings.
Enabling the setting across an entire organization therefore sets up the option to spend credits. It does not spend them by itself. Check budgets before you encourage teams to start scans.
Who can call these endpoints
Per GitHub's API reference:
Organization endpoints
- The caller must be an organization owner or security manager.
- Fine-grained tokens need organization Administration permission: read for GET, write for PATCH.
- Classic tokens need
admin:org,repo, orwrite:org. Owners can useadmin:orgorrepo. Security managers needwrite:org.
Repository endpoints
- Fine-grained tokens need Code scanning alerts (read) for GET. GitHub's reference lists repository Administration (write) for PATCH.
- Classic tokens use
security_eventsorpublic_repofor GET. For PATCH they userepoorpublic_repo. - GET returns
403if GitHub Advanced Security is not enabled for the repository.
Eligibility
- Organization-owned public repositories: available without an active-committer license.
- Organization-owned private or internal repositories: need GitHub Code Security or GitHub Advanced Security.
- Personal-account repositories: public ones are available. Private ones are not.
- Copilot: a GitHub Copilot license is not required.
- GitHub Enterprise Server: not supported. Tech Times noted the same exclusion for the earlier pull request API, with no roadmap date given.
Suggested rollout approach
This is general practice, not GitHub guidance:
- Confirm the enterprise policy allows AI Scan.
- Set budgets for Code Security AI credits.
- Use a GET on the organization endpoint to record the current
pr_scanandrepository_scanvalues. - PATCH the organization setting, then read it back to verify.
- Opt out repositories that shouldn't participate, using the repository endpoint with a token scoped for repository administration.
- Store the calls in your infrastructure-as-code pipeline so the configuration can be reviewed and audited.
The bottom line
The new repository_scan property is a small API addition, but it closes a real gap. Teams managing many organizations and repositories can now handle the full-repository AI Scan setting the way they already handle the pull request one. The preview label, the manual scan trigger, and the credit-based billing are the details to plan around. AI findings also still need human review.
References
- Manage AI Scan for repositories using the REST API GitHub Changelog · 2026-11-13T12:22:41+00:00
- AI Scan for a repository's backlog - GitHub Docs docs.github.com
- REST API endpoints for code scanning - GitHub Docs docs.github.com