> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # ImportFile # Package: mediaManager # Namespace: FilesService # Method link: https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/import-file.md ## Permission Scopes: Manage Media Manager: SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER ## Introduction Imports a file to the Media Manager using an external url. Returns information about the imported file. Specify the `parentFolderId` and `filePath` parameters to specify which folder you want the file to be imported to. If no folder is specified, the file is imported to the `media-root` folder. >**Notes:** > - The `media` property isn't returned in the `files` response object. > - When you import 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](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/importing-files.md#knowing-when-a-file-is-ready). To import a file, you need to do one of the following: - Specify its [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` field of the request. For example, `mimeType: 'image/jpeg'`. - Specify its extension in either the `displayName` or `url` field of the request. For example, `displayName: 'Example Image.jpeg` or `url: https://www.example.com/image.jpeg`. - Ensure the server hosting the file supports HEAD requests. In these cases the Wix servers can retrieve the MIME type from the hosting server. > **Note:** If you want to validate the media type, specify the file's expected media type in the optional `mediaType` field of the request. For example, `mediaType: 'IMAGE'`. --- ## REST API ### Schema ``` Method: importFile Description: Imports a file to the Media Manager using an external url. Returns information about the imported file. Specify the `parentFolderId` and `filePath` parameters to specify which folder you want the file to be imported to. If no folder is specified, the file is imported to the `media-root` folder. >**Notes:** > - The `media` property isn't returned in the `files` response object. > - When you import 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](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/importing-files.md#knowing-when-a-file-is-ready). To import a file, you need to do one of the following: - Specify its [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` field of the request. For example, `mimeType: 'image/jpeg'`. - Specify its extension in either the `displayName` or `url` field of the request. For example, `displayName: 'Example Image.jpeg` or `url: https://www.example.com/image.jpeg`. - Ensure the server hosting the file supports HEAD requests. In these cases the Wix servers can retrieve the MIME type from the hosting server. > **Note:** If you want to validate the media type, specify the file's expected media type in the optional `mediaType` field of the request. For example, `mediaType: 'IMAGE'`. URL: https://www.wixapis.com/site-media/v1/files/import Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: url Method parameters: param name: displayName | type: displayName | description: File name that appears in the Media Manager. param name: externalInfo | type: ExternalInfo - name: origin | type: string | description: External information to specify in the File Ready or File Failed events. - name: externalIds | type: array | description: External GUIDs to specify in the File Ready or File Failed events. param name: filePath | type: filePath | description: 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.
param name: labels | type: array | description: Labels assigned to media files that describe and categorize them. Provided by the Wix user, or generated by [Google Vision API](https://cloud.google.com/vision/docs/drag-and-drop) for images. param name: mediaType | type: MediaType - enum: UNKNOWN - IMAGE - VIDEO - AUDIO - DOCUMENT - VECTOR - ARCHIVE - MODEL3D - OTHER - param name: mimeType | type: mimeType | description: File mime type. param name: parentFolderId | type: parentFolderId | description: GUID of the file's parent folder.
This folder is the path root for the `filePath`.
Default: `media-root`. param name: private | type: private | description: Whether the file will be public or private. Learn more [about private files](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/private-files.md). param name: url | type: url | description: Publicly accessible external file URL. | required: true param name: urlHeaders | type: urlHeaders | description: Optional headers that should be sent with the external URL. param name: urlParams | type: urlParams | description: Optional parameters that should be sent with the external URL. Return type: ImportFileResponse - name: file | type: FileDescriptor | description: Information about the imported file. - name: id | type: string | description: File GUID. Generated when a file is uploaded to the Media Manager. - name: displayName | type: string | description: File name as it appears in the Media Manager. - name: url | type: string | description: Static URL of the file. - name: parentFolderId | type: string | description: GUID of the file's parent folder. - name: hash | type: string | description: File hash. - name: sizeInBytes | type: string | description: Size of the uploaded file in bytes. - name: private | type: boolean | description: Whether the file is public or private. Learn more about [private files](https://dev.wix.com/docs/rest/assets/media/media-manager/files/private-files.md). - name: mediaType | type: MediaType | description: Media file type. - enum: UNKNOWN, IMAGE, VIDEO, AUDIO, DOCUMENT, VECTOR, ARCHIVE, MODEL3D, OTHER - name: media | type: FileMedia | description: Media file content. - ONE-OF: - name: image | type: ImageMedia | description: Information about the image. - name: image | type: Image | description: Image data. - name: id | type: string | description: WixMedia image GUID. - name: url | type: string | description: Image URL. - name: height | type: integer | description: Original image height. - name: width | type: integer | description: Original image width. - name: altText | type: string | description: Image alt text. - name: filename | type: string | description: Image filename. - name: colors | type: Colors | description: Image colors. - name: prominent | type: Color | description: Main color of the image. - name: hex | type: string | description: HEX color. - name: rgb | type: ColorRGB | description: RGB color. - name: r | type: integer | description: Red channel. - name: g | type: integer | description: Green channel. - name: b | type: integer | description: Blue channel. - name: palette | type: array | description: Color palette of the image. - name: faces | type: array | description: Information about faces in the image. Use to crop images without cutting out faces. - name: confidence | type: number | description: The accuracy percentage of the face recognition. The likelihood that a face is detected. - name: x | type: integer | description: Top left x pixel coordinate of the face. - name: y | type: integer | description: Top left y pixel coordinate of the face. - name: height | type: integer | description: Face pixel height. - name: width | type: integer | description: Face pixel width. - name: previewImage | type: Image | description: Information about the image preview. You can use this to display a preview for private images. - name: caption | type: string | description: Optional, An AI generated description of the image - name: video | type: VideoV2 | description: Information about the video. - name: id | type: string | description: WixMedia GUID. - name: resolutions | type: array | description: Available resolutions for the video, starting with the optimal resolution. - name: url | type: string | description: Video URL. - name: height | type: integer | description: Video height. - name: width | type: integer | description: Video width. - name: format | type: string | description: Video format Possible values: ['144p.mp4' '144p.webm' '240p.mp4' '240p.webm' '360p.mp4' '360p.webm' '480p.mp4' '480p.webm' '720p.mp4' '720p.webm' '1080p.mp4' '1080p.webm', 'hls' ] - name: filename | type: string | description: Video filename. - name: audio | type: AudioV2 | description: Information about the audio. - name: id | type: string | description: WixMedia GUID. - name: assets | type: array