---
title: "Update the AI Scan setting for an organization"
method: PATCH
path: "/orgs/{org}/code-scanning/ai-scan"
tags: ["code-scanning"]
---

# Update the AI Scan setting for an organization

`PATCH /orgs/{org}/code-scanning/ai-scan`

> [!NOTE]
> This endpoint is in public preview and is subject to change.

Updates the AI Scan setting stored on an organization.

The organization respects the enterprise policy, so enabling is rejected when the enterprise disallows AI Scan.

OAuth app tokens and personal access tokens (classic) need the `admin:org`, `repo`, or `write:org` scope to use this endpoint. Organization owners can use `admin:org` or `repo`; security managers need `write:org`.

## Path parameters

- `org` string, required

## Request body

- CodeScanningAiScanOrgEnablementUpdate — The AI Scan organization setting to apply
  - `pr_scan` 'enabled' | 'disabled' — Whether AI Scan is enabled for the organization. Organization respects enterprise policy. Disabled organizations prevent repositories from enabling AI Scan. Enabled organizations enable AI Scan for their repositories, but individual repositories can opt out.

## Response `200`

Response

- CodeScanningAiScanOrgSettings — The AI Scan organization setting
  - `pr_scan` 'enabled' | 'disabled', required — Whether AI Scan on pull requests is enabled for the organization. The organization setting respects enterprise policy, and repositories inherit it: when disabled, repositories cannot enable AI Scan; when enabled, repositories can still opt out.

## Other responses

- `403` — Forbidden
- `404` — Resource not found
- `422` — Validation failed, or the endpoint has been spammed.

## Changes

- **2026-09-10** `a4865748553e` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/github/apis/enterprise-cloud/changes/orgs/:org/code-scanning/ai-scan/patch.md)

---

[API](https://skmtc.dev/github/apis/enterprise-cloud.md) · [All operations](https://skmtc.dev/github/apis/enterprise-cloud/llms.txt) · [OpenAPI document](https://skmtc.dev/github/apis/enterprise-cloud/revisions/e9af1ee5b414?raw)
