PATCH

Update File


Deprecated

This method has been replaced with Update File Descriptor, and will be removed on March 31, 2023.

Updates a file.

Deprecation Notice:

This endpoint has been replaced with Update File Descriptor and will be removed on March 31, 2023.

Specify the parentFolderId parameter to move a file from its current folder to a different folder.

Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Manage Bookings Services and Settings
Manage Media Manager
Manage Portfolio
Manage Restaurants - all permissions
Learn more about app permissions.
Endpoint
PATCH
https://www.wixapis.com/site-media/v1/files/update-file

Body Params
fileIdstringRequiredmaxLength 1000

ID of the file to update.

You can also specify the file's Wix media URL. For example, wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032. Learn more about the file ID parameter (SDK | REST).


displayNamestringmaxLength 200

File name that appears in the Media Manager.


parentFolderIdstringmaxLength 100

ID of the file's parent folder.
Default: media-root.


labelsArray <string>maxItems 500maxLength 200

Labels assigned to media files that describe and categorize them. Provided by the Wix user, or generated by Google Vision API for images.

Response Object
fileFile

Information about the updated file.

Update a file
Request
cURL
curl --location --request PATCH 'www.wixapis.com/site-media/v1/files/update-file' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'authorization: <AUTH>' \ --data-raw '{ "fileId": "2acbb8_f968336b3fea5cbebc056d5c41f9944d~mv2.png", "displayName": "new name", "parentFolderId": "media-root", "labels": ["image", "logo"] }'
Response
JSON
{ "file": { "id": "2acbb8_f968336b3fea4cbebc056d5c41f5944d~mv2.png", "displayName": "new name", "url": "https://static.wixstatic.com/media/2acbb8_f668336b3fea4cbebc056d5c41f9944d~mv2.png", "parentFolderId": "media-root", "hash": "354c465d4dd665d5e0d9e1840d6e516a", "sizeInBytes": "7108", "private": false, "mediaType": "IMAGE", "media": { "image": { "image": { "id": "2acbb8_f968336b3fea4cbebc056d5c41f9944d~mv2.png", "url": "https://static.wixstatic.com/media/2acbb8_f968336b33ea4cbebc056d5c41f9944d~mv2.png", "height": 184, "width": 544, "altText": null, "urlExpirationDate": null, "filename": "new name", "sizeInBytes": "7108" }, "colors": null, "faces": [], "previewImage": null } }, "operationStatus": "READY", "sourceUrl": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png", "thumbnailUrl": "https://static.wixstatic.com/media/2acbb8_f964336b3fea4cbebc056d5c41f9944d~mv2.png", "labels": ["image", "logo"], "createdDate": "2022-08-31T18:20:39Z", "updatedDate": "2022-08-31T18:24:39Z", "state": "OK" } }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?