---
title: "Update a file"
method: PATCH
path: "/v1/files/{file_id}"
tags: ["Files"]
---

# Update a file

`PATCH /v1/files/{file_id}`

## Request

- Base URL: `https://api.capacity.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.capacity.com/v1/files/{file_id}`
- Auth: one of:
  - API key in header `x-capacity-id`
  - HTTP bearer

Update a file

## Path parameters

- `file_id` string, required

## Request body

- object
  - `name` string, required: The new name of the file
  - `folder_id` string: ID of the folder that the file needs to be moved to
  - `is_public` boolean: Whether the file is public
  - `replace_duplicate` boolean: Whether to replace the existing file if there is one with the same name under the same folder that the file is being moved to
  - `tag_ids` string[]: IDs of global tags to associate with file. Any existing tags not provided will be removed.
  - `tag_names` string[]: Names of global tags to associate with file. Any existing tags not provided will be removed.

## Response `200`

The updated file

- object
  - `body` object: Json body data in the request
  - `parameters` object: Query parameters in the request
  - `result` FolderSchema
    - `id` string: ID of the folder
    - `name` string: Name of the folder

## Other responses

- `400`: The request contains malformed data or violates data integrity
- `404`: The requested resource could not be found
- `422`: The request was well-formed but was unable to be followed due to semantic errors. This is usually due to the request data failing to pass validations.

---

[API](https://skmtc.dev/capacity/apis/capacity-api-docs.md) - [All operations](https://skmtc.dev/capacity/apis/capacity-api-docs/llms.txt) - [OpenAPI document](https://skmtc.dev/capacity/apis/capacity-api-docs/revisions/74c85bb61004?raw)
