> ## 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.

# Copy File

> Duplicate a file inside its own folder

Duplicates a file inside its own folder. The endpoint takes no request body, and there is no way to copy into a different folder in one call: copy the file, then [move](https://docs.openinary.dev/api-reference/storage/move.md) it.

```
POST /storage/{path}/copy
```

```bash theme={null}
curl -X POST https://cdn.openinary.dev/storage/photos/portrait.jpg/copy \
  -H "Authorization: Bearer <api_key>"
```

```json theme={null}
{ "success": true, "path": "photos/portrait copy.jpg" }
```

Only files can be copied. A folder path returns `404`, so copy a folder's files one by one.

**Auth:** API key required. A dashboard session cookie also works.

## Path parameters

| Param | Type | Required | Description |
| - | - | - | - |
| `path` | string | yes | Path to the file relative to the storage root, e.g. `photos/portrait.jpg`. Use the `path` of a file returned by [List Storage](https://docs.openinary.dev/api-reference/storage/list.md). |

## Response

| Field | Type | Description |
| - | - | - |
| `success` | boolean | `true` if the copy succeeded |
| `path` | string | Path of the new copy. The name is the source name with ` copy` appended before the extension. If that name is taken, a counter is added: `portrait copy.jpg`, then `portrait copy (1).jpg`, `portrait copy (2).jpg`, and so on |

| Code | Meaning |
| - | - |
| `200` | Copy created |
| `400` | Path is missing |
| `404` | File not found, or the path is a folder |
| `500` | Storage backend failed to copy |

## Related

> [card] [Move File or Folder](https://docs.openinary.dev/api-reference/storage/move.md)
>
> Move instead of duplicating, and the one endpoint that does take a
> `destination`.

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


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