> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voyantcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update File

> Update gallery file metadata such as tags or folder assignment.

## Method

`PUT` `/v1/gallery/files/:id`

## Path Parameters

<ParamField path="id" type="string">Gallery file ID.</ParamField>

## Body Parameters

<ParamField name="tags" type="string[] | string">Tags to store in metadata. Provide an array or a comma-separated string.</ParamField>
<ParamField name="folderId" type="uuid | null">Move the file to a folder (`null` moves it to the root).</ParamField>

## Headers

<ParamField header="Authorization" type="string">Bearer token (e.g. <code>Authorization: Bearer YOUR\_API\_KEY</code>)</ParamField>
<ParamField header="content-type" type="string">`application/json`</ParamField>

## Request Example

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT "https://api.voyantcloud.com/v1/gallery/files/gal_file_123" \
    -H "Authorization: Bearer $VOYANT_API_KEY" \
    -H "content-type: application/json" \
    -d '{
      "tags": ["campaign:summer", "channel:web"],
      "folderId": "00000000-0000-0000-0000-000000000000"
    }'
  ```

  ```javascript Node.js theme={null}
  await fetch("https://api.voyantcloud.com/v1/gallery/files/gal_file_123", {
    method: "PUT",
    headers: {
      Authorization: `Bearer ${process.env.VOYANT_API_KEY}`,
      "content-type": "application/json",
    },
    body: JSON.stringify({ tags: "campaign:summer,channel:web" }),
  })
  ```

  ```python Python theme={null}
  import os, requests

  payload = {
    "tags": ["hero", "homepage"],
    "folderId": None,
  }

  resp = requests.put(
    "https://api.voyantcloud.com/v1/gallery/files/gal_file_123",
    headers={
      "Authorization": f"Bearer {os.environ['VOYANT_API_KEY']}",
      "content-type": "application/json",
    },
    json=payload,
  )
  updated = resp.json()
  ```
</RequestExample>

## Response

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "data": {
      "id": "gal_file_123",
      "workspaceId": "ws_abc",
      "name": "ws_abc/banner_summer.png",
      "originalName": "banner_summer.png",
      "size": 245812,
      "mimeType": "image/png",
      "storageProvider": "cf-images",
      "folderId": "00000000-0000-0000-0000-000000000000",
      "metadata": {
        "tags": ["campaign:summer", "channel:web"]
      },
      "status": "completed",
      "publicUrls": {
        "primary": "https://cdn.voyantcloud.com/gallery/ws_abc/banner_summer.png"
      },
      "updatedAt": "2025-02-12T09:30:00.000Z"
    }
  }
  ```
</ResponseExample>

<Note>Updates emit a `gallery.file.updated` webhook so downstream systems can synchronize metadata.</Note>
