# Autodetect AI code

Knowing if your project contains AI-generated code helps raise awareness of code ownership and code security. To help build this awareness, SonarQube Server can autodetect AI-generated code in projects using GitHub Copilot. If turned on, the feature alerts Project Admins when project contributors recently used GitHub Copilot so that such projects can be protected with Sonar’s [ai-code-assurance](https://docs.sonarsource.com/sonarqube-server/2025.3/ai-capabilities/ai-code-assurance "mention").

**Autodetect AI-Generated Code** is turned on by default in SonarQube Server, but your GitHub App must have the appropriate permissions in order to allow communication with SonarQube Server.

For full details about the feature including instructions and requirements, see [autodetect-ai-code](https://docs.sonarsource.com/sonarqube-server/2025.3/instance-administration/ai-features/autodetect-ai-code "mention").

If you’re a GitHub Admin and want more information about the required permission levels in GitHub, see [permissions-for-ai-autodetect](https://docs.sonarsource.com/sonarqube-server/2025.3/instance-administration/ai-features/permissions-for-ai-autodetect "mention").

## Related pages <a href="#related-pages" id="related-pages"></a>

* [overview](https://docs.sonarsource.com/sonarqube-server/2025.3/ai-capabilities/overview "mention") of AI capabiliites
* Learning about [ai-codefix](https://docs.sonarsource.com/sonarqube-server/2025.3/ai-capabilities/ai-codefix "mention") to get AI-generated fix suggestions
* An [overview](https://docs.sonarsource.com/sonarqube-server/2025.3/instance-administration/ai-features/overview "mention") to setup AI features for instance administration


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-server/2025.3/ai-capabilities/autodetect-ai-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
