---
title: "Change filename visibility for an existing file"
method: PATCH
path: "/v1/files/{file_id}"
tags: ["Files"]
---

# Change filename visibility for an existing file

`PATCH /v1/files/{file_id}`

## Request

- Base URL: `https://filepost.dev` (the document declares no server; this is the origin it was published from)
- URL: `https://filepost.dev/v1/files/{file_id}`
- Auth: none declared

Choose whether the file's existing filename appears in its canonical URL. The stored filename, download filename, file bytes, file_id, expiry, and upload usage do not change. Showing the filename preserves the previous opaque URL. Hiding the filename revokes the previous filename-visible URL.

## Path parameters

- `file_id` string, required

## Headers

- `X-API-Key` string, nullable

## Request body

- FileVisibilityUpdateRequest
  - `filename_mode` 'download' | 'public', required: Set to download to keep the filename out of the canonical URL, or public to show the filename in the canonical URL.

## Response `200`

Successful Response

- FileVisibilityUpdateResponse
  - `file_id` string, required
  - `url` string, required
  - `name` string, required
  - `size` integer, required
  - `content_type` string, required
  - `created_at` string, required
  - `expires_at` string, nullable, required
  - `filename_mode` 'download' | 'public', required
  - `changed` boolean, required
  - `previous_url` string, nullable, required
  - `previous_url_preserved` boolean, required

## Other responses

- `422`: Validation Error

---

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