Skip to main content

Update file metadata

POST 

/api/v1/storage/update-file-metadata

Replaces the metadata map and tag list when they survive decoding as nonnil values; it does not merge individual map keys. A nonempty description replaces the old description. This public shape has no reliable explicit clear operation for every empty value. Read the current record and submit the complete intended map/list; concurrent updates can overwrite one another.

Update metadata​

Section ID: DOC-CP-files-data-api-updateFileMetadata#update-metadata

This operation cannot clear tags with []; an empty description leaves the previous description unchanged.

The following access conditions are preserved as declared intent and are not implemented by generated code: Accepted storage owner context, Storage owner actor routing.

Use this in a guide: Build a searchable document library

Request​

Responses​

File metadata updated

Set descriptive metadata on an existing file.​

Section ID: DOC-CP-files-data-api-updateFileMetadata#example-storage-updateFileMetadata-request

Request example

{
"fileId": "0123456789abcdef0123456789abcdef",
"description": "Welcome message",
"tags": [
"onboarding"
],
"metadata": {
"category": "help"
}
}

Guide request for Save the review labels without erasing other labels. Replace example resource identifiers with your own authorized values.​

Section ID: DOC-CP-files-data-api-updateFileMetadata#example-cookbook-core-platform-files-data-managing-04-request

Request example

{
"fileId": "a1b2c3d4e5f60718293a4b5c6d7e8f90",
"metadata": {
"reviewed": "true",
"category": "internal"
},
"tags": [
"notes",
"reviewed"
],
"description": "Meeting notes from Q1 planning"
}

Illustrative response shape; omitted default fields and actual outcomes depend on the operation.​

Section ID: DOC-CP-files-data-api-updateFileMetadata#example-storage-updateFileMetadata-response

Response example

{
"file": {
"fileId": "example_123",
"name": "example",
"path": "documents/example.txt",
"folderPath": "documents/example.txt",
"sizeBytes": "1",
"contentType": "Example text",
"uploadedAt": "example",
"modifiedAt": "example",
"metadata": {},
"tags": [
"example"
],
"description": "example",
"storageRef": {
"bucket": "example",
"key": "example_123",
"provider": "STORAGE_PROVIDER_GCS"
},
"checksum": "example",
"version": 1
},
"updated": true
}

Document ID: DOC-CP-files-data-api-updateFileMetadata. Section identities and revisions.

SectionStable reference
Update file metadataDOC-CP-files-data-api-updateFileMetadata#overview
RequestDOC-CP-files-data-api-updateFileMetadata#request
ResponsesDOC-CP-files-data-api-updateFileMetadata#responses