---
title: "Patch a file"
method: PATCH
path: "/matters/{matterId}/documents/files/{fileId}"
tags: ["Files"]
---

# Patch a file

`PATCH /matters/{matterId}/documents/files/{fileId}`

Partially updates a file's metadata. Only the fields supplied in the request are changed; all other fields keep
their current values. Use PUT to replace all fields.
            
The response always includes a presigned PUT URL (valid for 1 hour) that can optionally be used to upload a new
version of the file. Every call records a new upload request whether or not the URL is used.

## Path parameters

- `matterId` string, required
- `fileId` string, required

## Request body

- EditFileDto
  - `fileName` string, required — Full name of the file. Required on PUT, maximum 256 characters. The name is normalised to XML-safe characters and must contain at least one valid character. The file's existing extension is kept unless the supplied name ends with that same extension; a trailing '.something' that differs from the current extension is treated as part of the name, so the extension cannot be changed by renaming.
  - `folderId` string, nullable — Unique identifier (GUID) of the folder to move the file to. Null means the root folder. On PUT, omitting this property moves the file to the root folder. On PATCH, the file is moved only when '/folderId' is present in the request. The destination folder is not validated for existence.
  - `userId` string, nullable — Unique identifier (GUID) of the user modifying the file. If null it will fallback to the authenticated user
  - `fileAdditionalData` object, nullable — Dictionary of custom metadata to set on the file. Keys must not be blank. Values must be strings, integers, numbers, booleans or null; objects and arrays are rejected. Supplied keys are added or overwritten. Null or empty is a no-op, so existing values cannot be cleared through this property.
  - `isFavorite` boolean, nullable — Flag indicating whether this file is a favorite. If null it will be ignored

## Response `202`

When request is accepted. Returns an 'UploadFileInfo' object.

- UploadFileInfo
  - `fileId` string, nullable — Unique identifier of the file.
  - `uploadUrl` string, nullable — Temporary presigned URL to upload the file content to. Send the raw file bytes with an HTTP PUT request. The URL is valid for 1 hour from the time of the API call (see Expiry). Important note: When uploading to this URL, set the 'Content-Type' header to an empty value. Example cURL: curl --location --request PUT 'URL_GOES_HERE' \ --header 'Content-Type: ""' \ --data '@/C:/dir/test.pdf'
  - `expiry` string, date-time — UTC date/time when the upload link is no longer accessible (1 hour after issue).

## Other responses

- `400` — When a supplied id is not a valid GUID; when the file does not belong to this matter or account; when 'folderId' is not a valid GUID; when the file name contains no valid XML characters; or when the additional data contains a null key or a non-primitive value.
- `404` — When the file does not exist.

## Changes

- **2026-08-26** `db1b8a86b58e` — 1 breaking, 5 warning
  - the response's body type/format changed from `object`/`` to `string`/`` for status `400`
  - removed the optional property `detail` from the response with the `400` status
  - removed the optional property `instance` from the response with the `400` status
  - removed the optional property `status` from the response with the `400` status
  - …2 more

[Change history](https://skmtc.dev/smokeball/apis/api/changes/matters/:matterId/documents/files/:fileId/patch.md)

---

[API](https://skmtc.dev/smokeball/apis/api.md) · [All operations](https://skmtc.dev/smokeball/apis/api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/smokeball/api/revisions/db1b8a86b58e/schema)
