POST

Generate File Upload Url


Generates an upload URL to allow external clients to upload a file to the Media Manager.

To learn how external clients can use the generated upload URL in the response to upload a file to the Media Manager, see Upload API (SDK | REST).

Notes:

  • When you upload a file, it's not immediately available, meaning you can't manage or use the file straight away. Learn more about knowing when a file is ready (SDK | REST).
  • Any interruption in the upload process stops the file upload. For files larger than 10MB, or when network connection is poor, call Generate File Resumable Upload URL instead. With the resumable upload URL, any interruption in the upload process pauses the file upload, and resumes the file upload process after the interruption.
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
POST
https://www.wixapis.com/site-media/v1/files/generate-upload-url

Body Params
mimeTypestringRequiredmaxLength 100

File mime type.


fileNamestringmaxLength 200

Temporary file name used to identify the file type. For example, a file named "myFile.jpeg" identifies as an "image/jpeg" file type.
Note: The name that appears in the Media Manager is taken from the filename parameter in the Generate File Upload Url call.


parentFolderIdstringmaxLength 100

ID of the file's parent folder.
This folder is the path root for the filePath.
Default: media-root.


privateboolean

Whether the file will be public or private. Learn more about private files (SDK | REST).


labelsArray <string>maxItems 50maxLength 200

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


externalInfoExternalInfo

A place to map an external entity to an uploaded file in the Wix Media Manager.


filePathstringmaxLength 100

Path to the folder where the file will be stored. For example, /videos/2024/december.
If parentFolderId is defined, the parent folder is used as the path root. Otherwise, the root is media-root. The folders in the path will be created if they don't already exist.

Response Object
uploadUrlstringformat WEB_URL

The URL for uploading a file to the Media Manager.

Generate an upload URL
Request
cURL
curl -X POST \ 'https://www.wixapis.com/site-media/v1/files/generate-upload-url' \ -H 'Authorization: <AUTH>' -H 'Content-Type: application/json' \ --data-binary '{ "mimeType": "image/jpeg", "fileName": "T-shirt.jpg", "sizeInBytes": "2608831" "parentFolderId":"25284aa06584441ea94338fdcfbaba12", "private": false, "labels": ["AMS:external_file_id", "woman", "bicyc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2d4ZDIxTlNrTTRjbG95UlZsMFNUZDRVelpVT0dFMWRsRmpaVk53VW5oMU9URTFYMEYyT1ZaM1pXaHhUbWR6ZHpkSVZVaE1SVlpwWVV0ZmRsOVlZMmsxWTJNeVNFMURRbTFTT0hNOUluMHNJbWhsWVdSbGNuTWlPbTUxYkd3c0luQmhjM04wYUhKdmRXZG9JanAwY25WbGZYMC5WNWV4TndIdTAtXzltYzhMMUtYTUItdFRUVE9WS2czZTZnbnVSQlNtcThFIiwiYWNsIjoicHVibGljIiwibWltZVR5cGUiOiJpbWFnZS9qcGVnIn0.Z-R2i-w9YzBH4vkkP3RjaXaqj-QPnu-cyvQd5h_oTyE" }
Errors
400Invalid Argument

There are 5 errors with this status code.

This method may also return standard errors. Learn more about standard Wix errors.

Did this help?