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

# Update Collection

> Rename a collection

Updates the name of a sub-collection. The root collection cannot be renamed (it has `parentId: null`, which this endpoint rejects).

## Path Parameters

<ParamField path="collectionId" type="string" required>
  The ID of the collection to update.
</ParamField>

## Body Parameters

<ParamField body="name" type="string" required>
  The new name for the collection. Must be a non-empty string.
</ParamField>

## Response

Returns the updated [Collection](/v8/data-models/collection) object.

## Error Responses

<AccordionGroup>
  <Accordion title="Invalid Body — 400">
    Returned when `name` is missing or an empty string. The `error` message names the offending field.

    ```json theme={null}
    { "error": "name: Invalid input: expected string, received undefined", "code": "collection/invalid-body" }
    ```
  </Accordion>

  <Accordion title="Collection Not Found — 404">
    Returned when the collection doesn't exist, doesn't belong to the user, or is the root collection (which cannot be renamed).

    ```json theme={null}
    { "error": "Collection not found", "code": "collection/not-found" }
    ```
  </Accordion>

  <Accordion title="Server Error — 500">
    ```json theme={null}
    { "error": "Server error", "code": "collection/server-error" }
    ```
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.