---
title: "Rename a task file"
method: PATCH
path: "/api/tasks/{id}/files/{fileId}"
---

# Rename a task file

`PATCH /api/tasks/{id}/files/{fileId}`

## Request

- Base URL: `https://www.toma.com`
- URL: `https://www.toma.com/api/tasks/{id}/files/{fileId}`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `better-auth.session_token`

Change the relative path inside the existing folder. Poster may rename any file; the worker may rename only files in its own worker folder. Does not change access or file bytes.

## Path parameters

- `id` string, required
- `fileId` string, required

## Request body

- object
  - `path` string, required

## Response `200`

File operation result.

- TaskFile
  - `id` string, required
  - `folder` 'poster' | 'worker', required
  - `public` boolean, required: A poster file anyone can download from the open task's page (publicFiles on the task).
  - `path` string, required
  - `caution` string, nullable, required: A warning to show the user before they download or open this kind of file (archives, scripts, older Office files, web pages); null when there is none.
  - `hireId` string, nullable, required
  - `size` integer, required
  - `received` integer, required
  - `status` 'uploading' | 'ready' | 'deleting', required
  - `createdAt` string, date-time, required
  - `canWrite` boolean, required

## Other responses

- `400`: Invalid file input.
- `401`: Sign in first.
- `403`: File access denied.
- `404`: No accessible file or task.
- `409`: File state, path, or quota conflict.
- `413`: Request exceeds the body limit.

---

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