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

# Rename File

> Renames a file or folder within a specific directory.

## Path Parameters

<ParamField path="id" type="string" required>
  UUID of the bot.
</ParamField>

## Body

<ParamField body="dir" type="string">
  Parent directory of the file. Use `""` for the bot root. Example: `src`.
</ParamField>

<ParamField body="old_name" type="string" required>
  Current name of the file or folder. Example: `index.js`.
</ParamField>

<ParamField body="new_name" type="string" required>
  New name to assign. Example: `main.js`.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.phanomcloud.online/bots/3fa85f64-5717-4562-b3fc-2c963f66afa6/files/rename \
    -H "Authorization: Bearer sess_..." \
    -H "Content-Type: application/json" \
    -d '{
      "dir": "src",
      "old_name": "index.js",
      "new_name": "main.js"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "data": {
      "dir": "src",
      "old_name": "index.js",
      "new_name": "main.js"
    },
    "message": "Renamed \"index.js\" → \"main.js\""
  }
  ```
</ResponseExample>
