{"id":3018,"date":"2026-09-11T05:09:10","date_gmt":"2026-09-11T05:09:10","guid":{"rendered":"https:\/\/dmarketertayeeb.com\/blog\/github-ai-scan-pull-request-apis\/"},"modified":"2026-10-06T23:00:54","modified_gmt":"2026-10-06T23:00:54","slug":"github-ai-scan-pull-request-apis","status":"publish","type":"post","link":"https:\/\/dmarketertayeeb.com\/blog\/github-ai-scan-pull-request-apis\/","title":{"rendered":"GitHub AI Scan APIs: Endpoints, Permissions and a Safe Pull-Request Pilot"},"content":{"rendered":"\n<p id=\"seg-lead\"><strong>AI Scan\u2019s existing Security Overview Coverage view now includes pull-request status.<\/strong> UI: <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">enabled<\/code>\/<code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">not enabled<\/code>; CSV: <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">enabled<\/code>\/<code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">not-enabled<\/code>. Coverage shows effective repo state after policy\/settings; not-enabled rows may be ineligible, with no reason. See the <a href=\"https:\/\/github.blog\/changelog\/2026-10-06-code-scanning-ai-scan-enablement-status-in-security-overview\/\">October 6 changelog<\/a> and <a href=\"https:\/\/docs.github.com\/en\/code-security\/how-tos\/view-and-interpret-data\/analyze-organization-data\/assessing-adoption-code-security\">adoption guide<\/a>.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"seg-h2-preview\">What the preview exposes<\/h2>\n\n\n<p id=\"seg-api-overview\">The September 10 preview adds <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">GET<\/code> and <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">PATCH<\/code> controls at <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">\/orgs\/{org}\/code-scanning\/ai-scan<\/code> and <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">\/repos\/{owner}\/{repo}\/code-scanning\/ai-scan<\/code>. A repository cannot override an organization-level disabled setting. The preview is on GitHub.com for GitHub Advanced Security customers; GitHub Enterprise Server is unsupported for this release. See <a href=\"https:\/\/github.blog\/changelog\/2026-09-10-ai-scan-for-pull-request-apis-in-public-preview\/\">the API announcement<\/a>.<\/p>\n\n\n<p id=\"seg-codeql-change\">Update older setup notes: on September 16, GitHub removed CodeQL default setup as an AI Scan prerequisite. <a href=\"https:\/\/github.blog\/changelog\/2026-09-16-code-scanning-ai-scan-no-longer-requires-codeql-default-setup\/\">The dated change<\/a> documents the correction.<\/p>\n\n\n<p id=\"seg-codeql-independence\">Code scanning and the effective AI Scan setting still matter; a waiting or failed CodeQL analysis does not stop AI Scan. <a href=\"https:\/\/docs.github.com\/en\/code-security\/concepts\/code-scanning\/ai-powered-security-detections\">Current AI Scan docs<\/a> describe its independent trigger.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"seg-h2-coverage\">Use the existing Coverage view to audit AI Scan status<\/h2>\n\n\n<p id=\"seg-coverage-navigation\">Organization: <strong>Security and quality \u2192 Coverage<\/strong>; enterprise: its Security and quality area. Org access requires repository write; enterprise access is for organization owners\/security managers. See the <a href=\"https:\/\/docs.github.com\/en\/code-security\/how-tos\/view-and-interpret-data\/analyze-organization-data\/assessing-adoption-code-security\">access guide<\/a>.<\/p>\n\n\n<ol class=\"wp-block-list\">\n<li id=\"seg-audit-scope\">Save the view level, selected team or repository <a href=\"https:\/\/docs.github.com\/en\/code-security\/how-tos\/view-and-interpret-data\/analyze-organization-data\/assessing-adoption-code-security\">filters,<\/a> and export time so a later snapshot uses the same scope.<\/li>\n<li id=\"seg-coverage-filters\">Click an enabled or not enabled count to filter repository rows, or use <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">code-scanning-ai-scan-pr-scan:enabled<\/code> and <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">code-scanning-ai-scan-pr-scan:not-enabled<\/code>. <a href=\"https:\/\/github.blog\/changelog\/2026-10-06-code-scanning-ai-scan-enablement-status-in-security-overview\/\">These AI Scan filters were added to Coverage.<\/a><\/li>\n<li id=\"seg-coverage-csv\">Export the Coverage CSV and retain its <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">Code Scanning AI Scan for pull requests<\/code> column. Its values are <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">enabled<\/code> and <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">not-enabled<\/code>. <a href=\"https:\/\/github.blog\/changelog\/2026-10-06-code-scanning-ai-scan-enablement-status-in-security-overview\/\">The changelog lists the new column.<\/a><\/li>\n<li id=\"seg-not-enabled-review\">Compare intended repositories. Not enabled may include ineligible repos without a reason; investigate before changing settings. See the <a href=\"https:\/\/docs.github.com\/en\/code-security\/how-tos\/view-and-interpret-data\/analyze-organization-data\/assessing-adoption-code-security\">adoption guide<\/a>.<\/li>\n<\/ol>\n\n\n<p id=\"seg-audit-method\">For trend checks, compare like-scoped snapshots on the same reporting cadence.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"seg-h2-read-api\">Read and update the settings<\/h2>\n\n\n<p id=\"seg-org-get\">GET first. Org GET is stored state; enterprise policy applies. PATCH bodies below are illustrative, unexecuted. See <a href=\"https:\/\/docs.github.com\/en\/rest\/code-scanning\/code-scanning?apiVersion=2026-03-10\">REST docs<\/a>.<\/p>\n\n\n<pre class=\"wp-block-code\" id=\"seg-patch-bodies\" style=\"white-space:pre-wrap;overflow-wrap:anywhere;max-width:100%;\"><code style=\"white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;\">{\"pr_scan\":\"enabled\"}\n{\"pr_scan\":\"disabled\"}<\/code><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"seg-h2-permissions\">Permissions are different for read and update<\/h2>\n\n\n<p id=\"seg-permission-intro\">GitHub App user\/install tokens and fine-grained personal access tokens work; see operation scopes in <a href=\"https:\/\/docs.github.com\/en\/rest\/code-scanning\/code-scanning?apiVersion=2026-03-10\">REST permissions<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-table\" style=\"overflow:visible;\"><div aria-label=\"AI Scan API permissions\" id=\"seg-permission-table-wrap\" role=\"region\" style=\"overflow-x:auto;outline-offset:3px;\" tabindex=\"0\"><table style=\"width:100%;min-width:630px;table-layout:fixed;\">\n<thead><tr id=\"seg-permission-header\"><th scope=\"col\" style=\"white-space:normal;overflow-wrap:anywhere;\">Operation<\/th><th scope=\"col\" style=\"white-space:normal;overflow-wrap:anywhere;\">Classic token scope<\/th><th scope=\"col\" style=\"white-space:normal;overflow-wrap:anywhere;\">Fine-grained permission<\/th><\/tr><\/thead>\n<tbody>\n<tr id=\"seg-org-get-permission\"><th scope=\"row\" style=\"white-space:normal;overflow-wrap:anywhere;\">Org GET<\/th><td style=\"white-space:normal;overflow-wrap:anywhere;\"><code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">admin:org<\/code> or <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">repo<\/code> (owner); <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">write:org<\/code> (security manager)<\/td><td style=\"white-space:normal;overflow-wrap:anywhere;\">Organization Administration: read<\/td><\/tr>\n<tr id=\"seg-org-patch-permission\"><th scope=\"row\" style=\"white-space:normal;overflow-wrap:anywhere;\">Org PATCH<\/th><td style=\"white-space:normal;overflow-wrap:anywhere;\">Same role scopes as GET<\/td><td style=\"white-space:normal;overflow-wrap:anywhere;\">Organization Administration: write; policy allows AI Scan<\/td><\/tr>\n<tr id=\"seg-repo-get-permission\"><th scope=\"row\" style=\"white-space:normal;overflow-wrap:anywhere;\">Repo GET<\/th><td style=\"white-space:normal;overflow-wrap:anywhere;\"><code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">security_events<\/code> private\/public; <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">public_repo<\/code> public only<\/td><td style=\"white-space:normal;overflow-wrap:anywhere;\">Code scanning alerts: read<\/td><\/tr>\n<tr id=\"seg-repo-patch-permission\"><th scope=\"row\" style=\"white-space:normal;overflow-wrap:anywhere;\">Repo PATCH<\/th><td style=\"white-space:normal;overflow-wrap:anywhere;\"><code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">repo<\/code> private\/public; <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">public_repo<\/code> public only<\/td><td style=\"white-space:normal;overflow-wrap:anywhere;\">Repository Administration: write<\/td><\/tr>\n<\/tbody>\n<\/table><\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"seg-h2-prerequisites\">Prerequisites before a pilot<\/h2>\n\n\n<p id=\"seg-ai-prerequisites\">AI Scan requires GitHub Advanced Security and GitHub Copilot licenses plus AI credits. It triggers on pull-request creation and new commits when code scanning and effective AI Scan are enabled and an eligible PR has qualifying changes in a supported language\/framework CodeQL does not cover. See <a href=\"https:\/\/docs.github.com\/en\/code-security\/concepts\/code-scanning\/ai-powered-security-detections\">AI Scan docs<\/a>.<\/p>\n\n\n<p id=\"seg-ai-pr-exclusions\">AI Scan covers pull requests only; it does not run on fork or Dependabot pull requests. Language and framework support may change during preview. <a href=\"https:\/\/docs.github.com\/en\/code-security\/concepts\/code-scanning\/ai-powered-security-detections\">See current exclusions.<\/a><\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"seg-h2-limits\">What this does not prove<\/h2>\n\n\n<p id=\"seg-ai-limits\">Enabled status proves configuration, not a scan or detection quality. Findings appear on pull requests, not backlog alerts; they are advisory, cannot enforce merge requirements, and may be false positives. Keep existing checks and human review. <a href=\"https:\/\/docs.github.com\/en\/code-security\/concepts\/code-scanning\/ai-powered-security-detections\">See the limitations.<\/a><\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"seg-h2-errors\">Failure modes and rollback<\/h2>\n\n\n<p id=\"seg-errors-readback\">403: permission, Advanced Security, or archived repository; 404: missing; 422: invalid\/spam. See <a href=\"https:\/\/docs.github.com\/en\/rest\/code-scanning\/code-scanning?apiVersion=2026-03-10\">REST docs<\/a>.<\/p>\n\n\n<p id=\"seg-rollback\">Roll back: PATCH the prior <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">pr_scan<\/code> value to the same route; retain approval and request history. See <a href=\"https:\/\/docs.github.com\/en\/rest\/code-scanning\/code-scanning?apiVersion=2026-03-10\">REST docs<\/a>.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"seg-h2-pilot\">Record a reversible pilot<\/h2>\n\n\n<ol class=\"wp-block-list\">\n<li id=\"seg-pilot-scope\">Choose one <a href=\"https:\/\/docs.github.com\/en\/code-security\/how-tos\/view-and-interpret-data\/analyze-organization-data\/assessing-adoption-code-security\">eligible,<\/a> non-critical repository. Save the <a href=\"https:\/\/github.blog\/changelog\/2026-10-06-code-scanning-ai-scan-enablement-status-in-security-overview\/\">Coverage export<\/a> with its date, team or repository filters, and organization scope.<\/li>\n<li id=\"seg-pilot-check\"><a href=\"https:\/\/docs.github.com\/en\/rest\/code-scanning\/code-scanning?apiVersion=2026-03-10\">GET<\/a> both levels; check <a href=\"https:\/\/docs.github.com\/en\/rest\/code-scanning\/code-scanning?apiVersion=2026-03-10\">policy,<\/a> <a href=\"https:\/\/docs.github.com\/en\/code-security\/concepts\/code-scanning\/ai-powered-security-detections\">licenses, credits,<\/a> <a href=\"https:\/\/docs.github.com\/en\/code-security\/how-tos\/view-and-interpret-data\/analyze-organization-data\/assessing-adoption-code-security\">eligibility.<\/a><\/li>\n<li id=\"seg-pilot-approval\">Get <a href=\"https:\/\/docs.github.com\/en\/rest\/code-scanning\/code-scanning?apiVersion=2026-03-10\">owner<\/a> approval for one least-privilege <a href=\"https:\/\/docs.github.com\/en\/rest\/code-scanning\/code-scanning?apiVersion=2026-03-10\">PATCH;<\/a> record the prior value for rollback.<\/li>\n<li id=\"seg-pilot-review\">Review <a href=\"https:\/\/docs.github.com\/en\/code-security\/concepts\/code-scanning\/ai-powered-security-detections\">AI findings<\/a> with human checks; <a href=\"https:\/\/github.blog\/changelog\/2026-10-06-code-scanning-ai-scan-enablement-status-in-security-overview\/\">enabled status<\/a> proves configuration only.<\/li>\n<\/ol>\n\n\n<p id=\"seg-internal-links\">For the adjacent governance decisions, use the <a href=\"https:\/\/dmarketertayeeb.com\/blog\/github-copilot-september-2026-model-budget-review-changes\">Copilot model and budget review guide<\/a>. The <a href=\"https:\/\/dmarketertayeeb.com\/blog\/github-copilot-vscode-august-2026-releases\">Copilot VS Code release guide<\/a> covers the separate editor feature surface.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"seg-h2-faq\">FAQ: questions readers ask<\/h2>\n\n\n<h3 class=\"wp-block-heading\" id=\"seg-faq-hypothesis\">Why could org GET and CSV status differ?<\/h3>\n\n\n<p id=\"seg-hypothetical-case\"><strong>Hypothetical, not observed:<\/strong> org GET may be <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">enabled<\/code> while CSV is <code style=\"white-space:normal;overflow-wrap:anywhere;word-break:break-word;\">not-enabled<\/code>: stored org setting versus effective repo status. Check policy, repo setting\/opt-out, Code Scanning, and eligibility; don\u2019t auto-PATCH. See <a href=\"https:\/\/docs.github.com\/en\/rest\/code-scanning\/code-scanning?apiVersion=2026-03-10\">REST docs<\/a> and <a href=\"https:\/\/docs.github.com\/en\/code-security\/how-tos\/view-and-interpret-data\/analyze-organization-data\/assessing-adoption-code-security\">adoption guide<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use GitHub AI Scan APIs safely: exact endpoints, token permissions, eligibility failures, response handling and a reversible pull-request pilot.<\/p>\n","protected":false},"author":1,"featured_media":3017,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[183,180,178],"tags":[393,319,396,426,315,422],"class_list":["post-3018","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-in-marketing","category-ai-news","category-artificial-intelligence","tag-ai-model-releases","tag-ai-workflows","tag-coding-agents","tag-content-governance","tag-developer-tools","tag-marketing-operations","has-featured-image"],"_links":{"self":[{"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/posts\/3018","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/comments?post=3018"}],"version-history":[{"count":2,"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/posts\/3018\/revisions"}],"predecessor-version":[{"id":3222,"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/posts\/3018\/revisions\/3222"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/media\/3017"}],"wp:attachment":[{"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/media?parent=3018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/categories?post=3018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/tags?post=3018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}