---
title: "Update snippet"
method: PUT
path: "/api/v4/snippets/{id}"
tags: ["snippets"]
---

# Update snippet

`PUT /api/v4/snippets/{id}`

## Request

- Base URL: `https://gitlab.com`
- URL: `https://gitlab.com/api/v4/snippets/{id}`
- Auth: none declared

Updates a specified snippet.

## Path parameters

- `id` integer, required

## Request body

- PutApiV4SnippetsId: Update snippet
  - `content` string: The content of a snippet
  - `description` string: The description of a snippet
  - `file_name` string: The name of a snippet file
  - `title` string: The title of a snippet
  - `visibility` 'private' | 'internal' | 'public': The visibility of the snippet
  - `files` object[]: An array of files to update
    - `action` 'create' | 'update' | 'delete' | 'move', required: The type of action to perform on the file, must be one of: create, update, delete, move
    - `content` string: The content of a snippet
    - `file_path` string: The file path of a snippet file
    - `previous_path` string: The previous path of a snippet file

## Response `200`

Update snippet

- APIEntitiesPersonalSnippet: API_Entities_PersonalSnippet model
  - `id` integer, required
  - `title` string, required
  - `description` string, required
  - `visibility` string, required
  - `author` APIEntitiesUserBasic, required: API_Entities_UserBasic model
    - `id` integer, required
    - `username` string, required
    - `public_email` string, required
    - `name` string, required
    - `state` string, required
    - `locked` boolean, required
    - `avatar_url` string, required
    - `avatar_path` string
    - `custom_attributes` APIEntitiesCustomAttribute[]
      - `key` string, required
      - `value` string, required
    - `web_url` string, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `project_id` integer, required
  - `web_url` string, required
  - `raw_url` string, required
  - `ssh_url_to_repo` string
  - `http_url_to_repo` string
  - `file_name` string, required
  - `files` object[], required
  - `imported` boolean, required
  - `imported_from` string, required
  - `repository_storage` string

## Other responses

- `400`: Validation error
- `404`: Not found
- `422`: Unprocessable entity

---

[API](https://skmtc.dev/gitlab/apis/gitlab-api.md) - [All operations](https://skmtc.dev/gitlab/apis/gitlab-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gitlab/apis/gitlab-api/revisions/b234947ef3f2?raw)
