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

# Update a File

`PATCH /files/{id}`

Update an existing file, and/or replace it's file contents.

## Path parameters

- `id` string, required

## Query parameters

- `fields` string[]
- `meta` string

## Request body

- object
  - `title` string — Title for the file. Is extracted from the filename on upload, but can be edited by the user.
  - `filename_download` string — Preferred filename when file is downloaded.
  - `description` string, nullable — Description for the file.
  - `folder` union — Virtual folder where this file resides in.
    - string
    - Folders
      - `id` string — Unique identifier for the folder.
      - `name` string — Name of the folder.
      - `parent` union — Unique identifier of the parent folder. This allows for nested folders.
        - string
        - Folders — recursive
  - `tags` string[], nullable — Tags for the file. Is automatically populated based on Exif data for images.

## Response `200`

Successful request

- object
  - `data` Files
    - `id` string — Unique identifier for the file.
    - `storage` string — Where the file is stored. Either `local` for the local filesystem or the name of the storage adapter (for example `s3`).
    - `filename_disk` string — Name of the file on disk. By default, Directus uses a random hash for the filename.
    - `filename_download` string — How you want to the file to be named when it's being downloaded.
    - `title` string — Title for the file. Is extracted from the filename on upload, but can be edited by the user.
    - `type` string — MIME type of the file.
    - `folder` union — Virtual folder where this file resides in.
      - string
      - Folders
        - `id` string — Unique identifier for the folder.
        - `name` string — Name of the folder.
        - `parent` union — Unique identifier of the parent folder. This allows for nested folders.
          - string
          - Folders — recursive
    - `uploaded_by` union — Who uploaded the file.
      - string
      - Users
        - `id` string — Unique identifier for the user.
        - `first_name` string — First name of the user.
        - `last_name` string — Last name of the user.
        - `email` string, email — Unique email address for the user.
        - `password` string — Password of the user.
        - `location` string, nullable — The user's location.
        - `title` string, nullable — The user's title.
        - `description` string, nullable — The user's description.
        - `tags` string[], nullable — The user's tags.
        - `avatar` union — The user's avatar.
          - string
          - Files — recursive
        - `language` string — The user's language used in Directus.
        - `tfa_secret` string, nullable — The 2FA secret string that's used to generate one time passwords.
        - `status` 'active' | 'invited' | 'draft' | 'suspended' | 'deleted' — Status of the user.
        - `role` union — Unique identifier of the role of this user.
          - string
          - Roles
            - `id` string — Unique identifier for the role.
            - `name` string — Name of the role.
            - `icon` string — The role's icon.
            - `description` string, nullable — Description of the role.
            - `parent` union — $t:field_options.directus_roles.parent_note
              - …
            - `children` union[], nullable — $t:field_options.directus_roles.children_note
              - …
            - `policies` unknown
            - `users` union[], nullable
              - …
        - `token` string, nullable — Static token for the user.
        - `last_access` string, date-time, nullable — When this user used the API last.
        - `last_page` string, nullable — Last page that the user was on.
        - `provider` string
        - `external_identifier` string, nullable
        - `auth_data` unknown
        - `email_notifications` boolean, nullable
        - `appearance` string, nullable
        - `theme_dark` string, nullable
        - `theme_light` string, nullable
        - `theme_light_overrides` unknown
        - `theme_dark_overrides` unknown
        - `text_direction` string
        - `policies` unknown
    - `created_on` string, date-time — When the file was created.
    - `modified_by` union
      - string, uuid
      - Users
        - `id` string — Unique identifier for the user.
        - `first_name` string — First name of the user.
        - `last_name` string — Last name of the user.
        - `email` string, email — Unique email address for the user.
        - `password` string — Password of the user.
        - `location` string, nullable — The user's location.
        - `title` string, nullable — The user's title.
        - `description` string, nullable — The user's description.
        - `tags` string[], nullable — The user's tags.
        - `avatar` union — The user's avatar.
          - string
          - Files — recursive
        - `language` string — The user's language used in Directus.
        - `tfa_secret` string, nullable — The 2FA secret string that's used to generate one time passwords.
        - `status` 'active' | 'invited' | 'draft' | 'suspended' | 'deleted' — Status of the user.
        - `role` union — Unique identifier of the role of this user.
          - string
          - Roles
            - `id` string — Unique identifier for the role.
            - `name` string — Name of the role.
            - `icon` string — The role's icon.
            - `description` string, nullable — Description of the role.
            - `parent` union — $t:field_options.directus_roles.parent_note
              - …
            - `children` union[], nullable — $t:field_options.directus_roles.children_note
              - …
            - `policies` unknown
            - `users` union[], nullable
              - …
        - `token` string, nullable — Static token for the user.
        - `last_access` string, date-time, nullable — When this user used the API last.
        - `last_page` string, nullable — Last page that the user was on.
        - `provider` string
        - `external_identifier` string, nullable
        - `auth_data` unknown
        - `email_notifications` boolean, nullable
        - `appearance` string, nullable
        - `theme_dark` string, nullable
        - `theme_light` string, nullable
        - `theme_light_overrides` unknown
        - `theme_dark_overrides` unknown
        - `text_direction` string
        - `policies` unknown
    - `modified_on` string, date-time
    - `charset` string, nullable — Character set of the file.
    - `filesize` integer — Size of the file in bytes.
    - `width` integer, nullable — Width of the file in pixels. Only applies to images.
    - `height` integer, nullable — Height of the file in pixels. Only applies to images.
    - `duration` integer, nullable — Duration of the file in seconds. Only applies to audio and video.
    - `embed` string, nullable — Where the file was embedded from.
    - `description` string, nullable — Description for the file.
    - `location` string, nullable — Where the file was created. Is automatically populated based on Exif data for images.
    - `tags` string[], nullable — Tags for the file. Is automatically populated based on Exif data for images.
    - `metadata` object, nullable — IPTC, Exif, and ICC metadata extracted from file
    - `focal_point_x` integer, nullable
    - `focal_point_y` integer, nullable
    - `tus_id` string, nullable
    - `tus_data` unknown
    - `uploaded_on` string, date-time — When the file was last uploaded/replaced.

## Other responses

- `401` — Error: Unauthorized request

---

[API](https://skmtc.net/utomic-media/apis/dynamic-api-specification.md) · [All operations](https://skmtc.net/utomic-media/apis/dynamic-api-specification/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/utomic-media/dynamic-api-specification/versions/4a0ccd34700e/schema)
