---
title: "Copy a file as a new file (charges 1 credit)"
method: POST
path: "/api/v1/files/{id}/copy"
tags: ["workspace"]
---

# Copy a file as a new file (charges 1 credit)

`POST /api/v1/files/{id}/copy`

## Request

- Base URL: `https://mdtidy.com`
- URL: `https://mdtidy.com/api/v1/files/{id}/copy`
- Auth: HTTP bearer

## Headers

- `Idempotency-Key` string

## Response `201`

File copied.

- File
  - `id` string, uuid, required
  - `type` 'file', required
  - `project_id` string, uuid, required
  - `folder_id` string, uuid, nullable, required
  - `folder_path` object[]: Top-down folder ancestry (excludes project + file); [] at the project root. Returned by GET /v1/files/{id} and POST /v1/files.
    - `id` string, uuid, required
    - `name` string, required
  - `name` string, required
  - `archived` boolean, required
  - `version` integer, required
  - `etag` string, required: Quoted version; mirrors the ETag header.
  - `last_opened_at` string, nullable, required
  - `created_at` string, required
  - `updated_at` string, required
  - `credits_remaining` integer
  - `content` string: Markdown body; returned by GET /v1/files/{id}.
  - `after_md_gcs` string, nullable
  - `rendered_html_gcs` string, nullable

## Other responses

- `401`: X-API-KEY is malformed, unknown, or revoked.
- `402`: Wallet has insufficient credits to satisfy the request.
- `404`: Resource not found, or not owned by the caller (IDOR-safe).
- `409`: Name collision, stale write, or a resource limit was reached.
- `422`: Request body failed validation.
- `429`: Per-key rate limit (60/min) exceeded.

---

[API](https://skmtc.dev/mdtidy/apis/markdown-tidy-api.md) · [All operations](https://skmtc.dev/mdtidy/apis/markdown-tidy-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mdtidy/apis/markdown-tidy-api/revisions/caeec6fad155?raw)
