> ## Documentation Index
> Fetch the complete documentation index at: https://docs.diversion.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Rename a shelf

> Renames an existing shelf by updating its name.

**Parameters:**
- `shelf_name` (required) - will be stripped of whitespace

**Requirements:**
Requires WRITE access to the repository.

**Returns:**
- `400 Bad Request` if the name is empty after stripping
- `409 Conflict` if a shelf with the new name already exists
- `204 No Content` on success




## OpenAPI

````yaml patch /repos/{repo_id}/shelves/{shelf_id}
openapi: 3.0.3
info:
  title: Diversion Core API
  description: >-
    Definition of the Core API used to access low-level functionality of
    Diversion
  version: 0.2.0
servers:
  - url: https://api.diversion.dev/v0
    description: Base endpoint
security: []
paths:
  /repos/{repo_id}/shelves/{shelf_id}:
    parameters:
      - $ref: '#/components/parameters/RepoParam'
      - $ref: '#/components/parameters/ShelfIdParam'
    patch:
      tags:
        - Repository Shelves Manipulation
      summary: Rename a shelf
      description: |
        Renames an existing shelf by updating its name.

        **Parameters:**
        - `shelf_name` (required) - will be stripped of whitespace

        **Requirements:**
        Requires WRITE access to the repository.

        **Returns:**
        - `400 Bad Request` if the name is empty after stripping
        - `409 Conflict` if a shelf with the new name already exists
        - `204 No Content` on success
      operationId: src.handlersv2.shelf.patch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                shelf_name:
                  type: string
                  minLength: 1
                  maxLength: 60
              required:
                - shelf_name
      responses:
        '204':
          $ref: '#/components/responses/OKEmpty'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Shelf with the same name already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        default:
          $ref: '#/components/responses/Error'
      security:
        - OAuth2:
            - coreapi/write
components:
  parameters:
    RepoParam:
      in: path
      name: repo_id
      required: true
      schema:
        type: string
        example: example_id
        minLength: 3
        maxLength: 128
      description: >-
        The repo ID of the repository. Repo _name_ can be used instead of the
        ID, but usage of ID for permanent linking and API requests is preferred.
    ShelfIdParam:
      in: path
      name: shelf_id
      description: Shelf identifier
      schema:
        type: string
        example: dv.shelf.12a37e91-bfc4-4e03-a330-13b5b84ab7cb
        minLength: 3
        maxLength: 128
      required: true
  responses:
    OKEmpty:
      description: Request completed successfully
    BadRequest:
      description: The request does not meet the required conditions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The specified resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error:
      description: An error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        status:
          type: integer
          description: HTTP status code
        detail:
          type: string
        title:
          type: string
        type:
          type: string
      required:
        - status
        - detail
  securitySchemes:
    OAuth2:
      type: oauth2
      x-tokenInfoFunc: src.token_info.token_auth
      description: This API uses OAuth 2 with the implicit grant flow
      flows:
        implicit:
          authorizationUrl: https://auth.diversion.dev/oauth2/authorize
          scopes:
            coreapi/read: Operations with no possible side-effects
            coreapi/write: Modifying operations
            coreapi/admin: >-
              Organizational operations like adding a repo or changing repo
              properties

````