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

# Rename File or Folder

> Rename a file or folder in place, without changing its parent location

Renames a file or folder in place. Send the new name only, never a full path.

```
PATCH /storage/{path}
```

```bash theme={null}
curl -X PATCH https://cdn.openinary.dev/storage/photos/portrait.jpg \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{"name": "headshot.jpg"}'
```

**Auth:** API Key required

## Parameters

| Param | In | Type | Required | Description |
| - | - | - | - | - |
| `path` | path | string | yes | Path to the file or folder relative to the storage root, e.g. `photos/portrait.jpg`. Use the `path` from [List Storage](https://docs.openinary.dev/api-reference/storage/list.md). |
| `name` | body | string | yes | The new name, not a full path. Must not contain `/` or `\`. |

## Response

```json theme={null}
{
  "success": true,
  "path": "photos/new-name.jpg"
}
```

| Field | Type | Description |
| - | - | - |
| `success` | boolean | `true` if the rename succeeded |
| `path` | string | The new full path of the file or folder |

**Status codes:** `200` success · `400` invalid name · `404` not found · `409` a file or folder with that name already exists · `500` error

## Related

> [card] [Move File or Folder](https://docs.openinary.dev/api-reference/storage/move.md)
>
> Move a file or folder to a different parent folder.

> [card] [List Storage](https://docs.openinary.dev/api-reference/storage/list.md)
>
> Browse all files and folders.


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