> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-community-build/instance-administration/analysis-functions/setting-new-code-definition-at-global-level.md).

# New code definition

The global-level new code definition is called *baseline for new code*:

* It applies by default to all projects. A specific new code definition can be applied to the project instead.
* If it applies to a project, the project consistently uses the baseline for new code. Consequently, any modifications to the baseline will automatically be applied to the project.

The default baseline for new code is the Previous version option. With the Administer System permission, you can change it to the Number of days option, either in the UI or via the Web API.

For more information about the new code options, see [Quality standards and new code](/sonarqube-community-build/user-guide/about-new-code.md).

## In the UI <a href="#in-the-ui" id="in-the-ui"></a>

1. In the top navigation bar, select **Administration** > **Configuration** > **General Settings** > **New Code**.
2. Select the new code option.
3. Select **Save**.

<figure><img src="/spaces/KXW79zfYFiA8incTvwZK/files/qZp7bzsWBsPybVw33oQk" alt="Configuring the new code definition for your instance"><figcaption></figcaption></figure>

## Via the Web API <a href="#via-the-web-api" id="via-the-web-api"></a>

Use the [api/new\_code\_periods/set](https://next.sonarqube.com/sonarqube/web_api/api/new_code_periods/set) endpoint without specifying a branch or a project.

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

* [Quality standards and new code](/sonarqube-community-build/user-guide/about-new-code.md)
* [Configuring new code calculation](/sonarqube-community-build/project-administration/adjusting-analysis/configuring-new-code-calculation.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-community-build/instance-administration/analysis-functions/setting-new-code-definition-at-global-level.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
