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

# Update a file

`PATCH /api/v1/files/{id}`

## Request

- Base URL: `https://your-deployment.example.com`
- URL: `https://your-deployment.example.com/api/v1/files/{id}`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Renames a file you can edit or changes its notes: a file you own, or one shared with you with edit (`update`) permission. Omitted fields are left unchanged. Unknown body fields are rejected. The response is the file summary, with no `download_url`: fetch the bytes from `GET /api/v1/files/{id}`, which requires `files:read`.

## Path parameters

- `id` string, required

## Request body

- UpdateFileRequest
  - `file_name` string
  - `notes` string

## Response `200`

The updated file summary.

- UpdateFileResponse200
  - `id` string, required
  - `file_name` string, required
  - `mime_type` string, required
  - `file_size` number, required
  - `moderation_status` 'pending' | 'scanning' | 'clean' | 'blocked' | 'null', nullable, required
  - `created_at` string, required

## Other responses

- `401`: Missing or invalid credentials.
- `403`: The API key lacks `files:write`.
- `404`: No file with that id is yours to edit. A file you cannot edit, one that does not exist and a malformed id are all reported as 404, so file ids cannot be probed through this endpoint.
- `405`: The path does not serve this HTTP method.
- `422`: Request body failed validation.
- `429`: Per-user rate limit exceeded.

---

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