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

# Rename Object

> Rename or move a file within a bucket

### Path Parameters

<ParamField path="bucketName" type="string" required>
  The name of the bucket containing the file.
</ParamField>

<ParamField path="path" type="string" required>
  The current full path to the file.
</ParamField>

### Headers

<ParamField header="Content-Type" type="string" required>
  Must be set to `application/json`.
</ParamField>

### Query Parameters

<ParamField query="overwrite" type="boolean" default="false">
  If `true`, overwrite destination if it exists.
</ParamField>

### Body

You must provide either `newName` or `newKey` in the JSON body.

<ParamField body="newName" type="string">
  New filename (keeps the same folder).
</ParamField>

<ParamField body="newKey" type="string">
  Full destination path (can move across folders).
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  Indicates whether the operation was successful.
</ResponseField>

<ResponseField name="message" type="string">
  A descriptive message of the operation result.
</ResponseField>

<ResponseField name="newKey" type="string">
  The new full destination path of the file.
</ResponseField>

<RequestExample>
  ```bash theme={null}
  curl --request PATCH \
    --url https://cdn.sacul.cloud/my-bucket/old-path.txt \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
  	"newName": "new-path.txt"
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
      "success": true,
      "message": "Renamed old-path.txt to new-path.txt",
      "newKey": "new-path.txt"
  }
  ```
</ResponseExample>
