---
title: "Copy a file to a new path"
method: POST
path: "/api/storage/{project_id}/copy"
tags: ["Storage"]
---

# Copy a file to a new path

`POST /api/storage/{project_id}/copy`

## Request

- Base URL: `https://core.blink.new`
- URL: `https://core.blink.new/api/storage/{project_id}/copy`
- Auth: HTTP bearer

Copies a file from `fromPath` to `toPath` within the same project bucket.
The original file is preserved. Returns the `FileObject` of the newly
created copy including its metadata.

Compatible with the Supabase Storage `copy` API.

**Server only**: requires the project's secret key (or service token). End-user
tokens and publishable keys get 403 — a copy could plant a file at any path.

## Path parameters

- `project_id` string, required

## Request body

- object
  - `fromPath` string, required: Source file path relative to the project bucket root
  - `toPath` string, required: Destination file path relative to the project bucket root

## Response `200`

File copied successfully

- StorageResponse
  - `data` union
    - FileObject
      - `id` string, uuid
      - `name` string
      - `bucket_id` string
      - `owner` string, nullable
      - `owner_id` string, nullable
      - `version` string, nullable
      - `created_at` string, date-time
      - `updated_at` string, date-time
      - `last_accessed_at` string, date-time
      - `metadata` object
        - `size` integer
        - `mimetype` string
        - `cacheControl` string
      - `user_metadata` object
    - FileObject[]
      - `id` string, uuid
      - `name` string
      - `bucket_id` string
      - `owner` string, nullable
      - `owner_id` string, nullable
      - `version` string, nullable
      - `created_at` string, date-time
      - `updated_at` string, date-time
      - `last_accessed_at` string, date-time
      - `metadata` object
        - `size` integer
        - `mimetype` string
        - `cacheControl` string
      - `user_metadata` object
    - object
  - `error` object, nullable
    - `message` string
    - `statusCode` string

## Other responses

- `400`: Missing fromPath or toPath
- `401`: Authentication required or invalid API key
- `403`: Caller is not the project's server (code STORAGE_SERVER_ONLY)
- `404`: Source file not found
- `409`: A file already exists at the destination path
- `500`: Storage error

---

[API](https://skmtc.dev/blink/apis/blink-apis.md) - [All operations](https://skmtc.dev/blink/apis/blink-apis/llms.txt) - [OpenAPI document](https://skmtc.dev/blink/apis/blink-apis/revisions/4c59c706078e?raw)
