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

# Update File

> Update metadata for an existing file.

## Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier of the file.
</ParamField>

## Request Body

<ParamField body="filename" type="string">
  A new filename for the file.
</ParamField>

<ParamField body="path" type="string">
  A new path for the file within the drive.
</ParamField>

<ParamField body="tags" type="string[]">
  Updated tags for the file. Replaces all existing tags.
</ParamField>

<ParamField body="metadata" type="object">
  Updated metadata for the file. Replaces all existing metadata.
</ParamField>

<ParamField body="expires_at" type="string">
  An ISO 8601 timestamp for when the file should expire. Set to `null` to remove expiration.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH https://api.getagentdrive.com/v0/files/file_xyz789 \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "filename": "annual-report.pdf",
      "tags": ["report", "2026", "annual"],
      "metadata": { "author": "Jane Doe", "reviewed": true }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "file_xyz789",
    "drive_id": "drv_abc123",
    "path": "documents/report.pdf",
    "filename": "annual-report.pdf",
    "mime_type": "application/pdf",
    "size": 24576,
    "content_hash": "sha256:abcdef1234567890",
    "content_preview": null,
    "tags": ["report", "2026", "annual"],
    "metadata": { "author": "Jane Doe", "reviewed": true },
    "created_at": "2026-01-15T10:30:00Z",
    "updated_at": "2026-03-19T08:15:00Z"
  }
  ```
</ResponseExample>

## Response

Returns the updated file record. See [Get File](/api-reference/files/get) for the full response schema.
