Directus icon

Directus

Consume Directus API

File → Update

AI-generated

Summary

Update a file's metadata or content

Inputs

  • fileId (required) — The ID of the file to operate on
  • fileFields — Collection of field updates; each entry defines a field name or ID and its new value

Output shape

a single updated file record

The operation returns the updated file object; success is indicated by the returned record, failure throws an error.

Examples

Example 1: Replace the file's description

resource: file, operation: update, fileId: "123", fileFields: [{field: "description", value: "Updated description"}]

Example 2: Set custom metadata on a file

resource: file, operation: update, fileId: $fileId, fileFields: [{field: "customMetadata", value: {"author": "John"}}]

Discussion