2019-12-02 07:06:45 -05:00
---
type: reference, howto
2020-07-17 11:09:13 -04:00
stage: Create
group: Editor
2020-07-30 08:09:33 -04:00
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers"
2019-12-02 07:06:45 -05:00
---
# Snippets settings **(CORE ONLY)**
Adjust the snippets' settings of your GitLab instance.
## Snippets content size limit
2020-05-21 02:08:25 -04:00
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/31133) in GitLab 12.6.
2019-12-02 07:06:45 -05:00
2020-07-17 11:09:13 -04:00
You can set a maximum content size limit for snippets. This limit can prevent
abuse of the feature. The default value is **52428800 Bytes** (50 MB).
2019-12-02 07:06:45 -05:00
### How does it work?
2020-07-17 11:09:13 -04:00
The content size limit will be applied when a snippet is created or updated.
In order not to break any existing snippets, the limit doesn't have any
effect on them until a snippet is edited again and the content changes.
2019-12-02 07:06:45 -05:00
### Snippets size limit configuration
This setting is not available through the [Admin Area settings ](../../user/admin_area/settings/index.md ).
In order to configure this setting, use either the Rails console
or the [Application settings API ](../../api/settings.md ).
NOTE: **IMPORTANT:**
2020-07-17 11:09:13 -04:00
The value of the limit **must** be in bytes.
2019-12-02 07:06:45 -05:00
#### Through the Rails console
The steps to configure this setting through the Rails console are:
1. Start the Rails console:
2020-01-30 10:09:15 -05:00
```shell
2019-12-02 07:06:45 -05:00
# For Omnibus installations
sudo gitlab-rails console
# For installations from source
2020-02-28 01:09:19 -05:00
sudo -u git -H bundle exec rails console -e production
2019-12-02 07:06:45 -05:00
```
1. Update the snippets maximum file size:
```ruby
ApplicationSetting.first.update!(snippet_size_limit: 50.megabytes)
```
To retrieve the current value, start the Rails console and run:
```ruby
Gitlab::CurrentSettings.snippet_size_limit
```
#### Through the API
The process to set the snippets size limit through the Application Settings API is
exactly the same as you would do to [update any other setting ](../../api/settings.md#change-application-settings ).
2020-01-30 10:09:15 -05:00
```shell
2019-12-02 07:06:45 -05:00
curl --request PUT --header "PRIVATE-TOKEN: < your_access_token > " https://gitlab.example.com/api/v4/application/settings?snippet_size_limit=52428800
```
You can also use the API to [retrieve the current value ](../../api/settings.md#get-current-application-settings ).
2020-01-30 10:09:15 -05:00
```shell
2019-12-02 07:06:45 -05:00
curl --header "PRIVATE-TOKEN: < your_access_token > " https://gitlab.example.com/api/v4/application/settings
```