> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# BulkImportFile

# Package: mediaManager

# Namespace: FilesService

# Method link: https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/bulk-import-file.md

## Permission Scopes:
Manage Media Manager: SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER

## Introduction

Imports a bulk of files to the Media Manager using external urls. <br/>

Returns information about the imported files.

Specify the `parentFolderId` and `filePath` parameters to specify the folder you want each 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 files, you need to do one of the following for each file:
- 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'`.
- Include 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: bulkImportFile
 Description: Imports a bulk of files to the Media Manager using external urls. <br/>  Returns information about the imported files.  Specify the `parentFolderId` and `filePath` parameters to specify the folder you want each 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 files, you need to do one of the following for each file: - 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'`. - Include 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/bulk/files/import-v2
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  importFileRequests, importFileRequests.url
 Method parameters: 
   param name: importFileRequests | type: array<importFileRequests> | description: Information about the files to import. | required: true | validation: minItems 1, maxItems 100
              - name: url | type: string | description: Publicly accessible external file URL. | required: true | validation: minLength 2, format WEB_URL
              - name: mediaType | type: MediaType | description: Media type of the file to import. excluding: OTHER media type  
                     - enum:
                     -     UNKNOWN: Unknown media type.
                     -     IMAGE: Image file, such as JPEG or PNG.
                     -     VIDEO: Video file.
                     -     AUDIO: Audio file.
                     -     DOCUMENT: Document file, such as PDF.
                     -     VECTOR: Vector image file, such as SVG.
                     -     ARCHIVE: Archive file, such as ZIP.
                     -     MODEL3D: 3D model file.
                     -     OTHER: Any other file type.
              - name: displayName | type: string | description: File name that appears in the Media Manager. The file name is truncated to 255 characters if longer.  | validation: maxLength 1000
              - name: parentFolderId | type: string | description: GUID of the file's parent folder. <br /> This folder is the path root for the `filePath`. <br /> Default: `media-root`.  | validation: maxLength 100
              - name: private | type: boolean | 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).  
              - name: labels | type: array<string> | 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.  | validation: maxItems 500, maxLength 200
              - name: mimeType | type: string | description: File mime type.  | validation: maxLength 100
              - name: externalInfo | type: ExternalInfo | description: Information sent to the File Ready and File Failed events. See [Importing Files](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/importing-files.md) to learn more.  
                 - name: origin | type: string | description: Identifier of the app or service that initiated the upload or import, for example your app's GUID. Returned in the resulting File Ready and File Failed events, and can be used to filter events by their origin.  | validation: maxLength 1000
                 - name: externalIds | type: array<string> | description: IDs from your own system, for example the GUIDs of the entities the file belongs to. Returned in the resulting File Ready and File Failed events, and can be used to correlate an event with the call that triggered it.  | validation: maxItems 30, maxLength 4000
              - name: urlParams | type: object | description: Optional parameters that should be sent with the external URL.  
              - name: urlHeaders | type: object | description: Optional headers that should be sent with the external URL.  
              - name: filePath | type: string | description: Path to the folder where the file will be stored. For example, `/videos/2024/december`. <br/> 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.  <br />  | validation: maxLength 100
   param name: returnEntity | type: returnEntity | description: Whether to include the imported file descriptor in the response. Set to `false` to exclude the file descriptor from the response.  Default: `true`  
 Return type: BulkImportFileResponse
  - name: results | type: array<BulkImportFileResult> | description: Items created by bulk action.  
     - name: itemMetadata | type: ItemMetadata | description: Item metadata.  
        - name: id | type: string | description: Item GUID. Should always be available, unless it's impossible (for example, when failing to create an item).  
        - name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items.  
        - name: success | type: boolean | description: Whether the requested action was successful for this item. When `false`, the `error` field is populated.  
        - name: error | type: ApplicationError | description: Details about the error in case of failure.  
           - name: code | type: string | description: Error code.  
           - name: description | type: string | description: Description of the error.  
           - name: data | type: object | description: Data related to the error.  
     - name: item | type: FileDescriptor | description: Imported file. This field is included in the response if the operation was successful and `returnEntity` is not set to `false`.  
        - name: id | type: string | description: File GUID. Generated when a file is uploaded to the Media Manager.  | read-only: true | validation: maxLength 1000
        - name: displayName | type: string | description: File name as it appears in the Media Manager.  | validation: maxLength 255
        - name: url | type: string | description: Static URL of the file.  | read-only: true | validation: format WEB_URL
        - name: parentFolderId | type: string | description: GUID of the file's parent folder.  | validation: maxLength 100
        - name: hash | type: string | description: File hash.  | read-only: true | validation: maxLength 100
        - name: sizeInBytes | type: string | description: Size of the uploaded file in bytes.  | read-only: true | validation: format DECIMAL_VALUE, decimalValue {"maxScale":0}
        - 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).  | read-only: true 
        - name: mediaType | type: MediaType | description: Media file type.  | read-only: true 
             - enum:
             -     UNKNOWN: Unknown media type.
             -     IMAGE: Image file, such as JPEG or PNG.
             -     VIDEO: Video file.
             -     AUDIO: Audio file.
             -     DOCUMENT: Document file, such as PDF.
             -     VECTOR: Vector image file, such as SVG.
             -     ARCHIVE: Archive file, such as ZIP.
             -     MODEL3D: 3D model file.
             -     OTHER: Any other file type.
        - name: media | type: FileMedia | description: Media-type-specific metadata, such as an image's dimensions or a video's available resolutions. The relevant property is populated according to the file's `mediaType`.  | read-only: true 
           - 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.  | read-only: true 
                    - name: width | type: integer | description: Original image width.  | read-only: true 
                    - name: altText | type: string | description: Image alt text.  
                    - name: filename | type: string | description: Image filename.  | read-only: true 
                 - name: colors | type: Colors | description: Image colors.  
                    - name: prominent | type: Color | description: Main color of the image.  
                       - name: hex | type: string | description: HEX color.  | validation: format COLOR_HEX
                       - name: rgb | type: ColorRGB | description: RGB color.  
                          - name: r | type: integer | description: Red channel.  | validation: minimum 0, maximum 255, format int32
                          - name: g | type: integer | description: Green channel.  | validation: minimum 0, maximum 255, format int32
                          - name: b | type: integer | description: Blue channel.  | validation: minimum 0, maximum 255, format int32
                    - name: palette | type: array<Color> | description: Color palette of the image.  | validation: maxItems 100
                 - name: faces | type: array<FaceRecognition> | description: Information about faces in the image. Use to crop images without cutting out faces.  | validation: maxItems 100
                    - 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  | read-only: true | validation: maxLength 300
              - name: video | type: VideoV2 | description: Information about the video.  
                 - name: id | type: string | description: WixMedia GUID.  
                 - name: resolutions | type: array<VideoResolution> | description: Available resolutions for the video, starting with the optimal resolution.  | read-only: true | validation: maxItems 100
                    - 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.  | read-only: true 
              - name: audio | type: AudioV2 | description: Information about the audio.  
                 - name: id | type: string | description: WixMedia GUID.  | validation: maxLength 200
                 - name: assets | type: array<Audio> | description: Audio formats available for this file.  | validation: maxItems 100
                    - name: id | type: string | description: WixMedia GUID.  
                    - name: url | type: string | description: Audio URL.  
                    - name: filename | type: string | description: Audio filename.  | read-only: true 
                 - name: bitrate | type: integer | description: Audio bitrate.  | read-only: true | validation: minimum 0, format int32
                 - name: format | type: string | description: Audio format.  | read-only: true | validation: maxLength 100
                 - name: duration | type: integer | description: Audio duration in seconds.  | read-only: true | validation: minimum 0, format int32
                 - name: sizeInBytes | type: string | description: Audio size in bytes.  | read-only: true | validation: format DECIMAL_VALUE, decimalValue {"maxScale":0}
              - name: document | type: Document | description: Information about the document.  
                 - name: id | type: string | description: WixMedia GUID.  
                 - name: url | type: string | description: Document URL.  
                 - name: filename | type: string | description: Document filename.  
              - name: vector | type: ImageMedia | description: Information about the vector.  
              - name: archive | type: Archive | description: Information about the archive.  
                 - name: id | type: string | description: WixMedia GUID.  
                 - name: url | type: string | description: Archive URL.  
                 - name: urlExpirationDate | type: string | description: Archive URL expiration date (when relevant).  | read-only: true | validation: format date-time
                 - name: sizeInBytes | type: string | description: Archive size in bytes.  | validation: format DECIMAL_VALUE
                 - name: filename | type: string | description: Archive filename.  
              - name: model3d | type: Model3D | description: Information about the 3D Model.  
                 - name: id | type: string | description: WixMedia 3D GUID.  
                 - name: url | type: string | description: 3D URL.  
                 - name: thumbnail | type: Image | description: 3D thumbnail Image  
                 - name: altText | type: string | description: 3D alt text.  
                 - name: urlExpirationDate | type: string | description: 3D URL expiration date (when relevant).  | read-only: true | validation: format date-time
                 - name: filename | type: string | description: 3D filename.  | read-only: true 
                 - name: sizeInBytes | type: string | description: 3D size in bytes.  | read-only: true | validation: format DECIMAL_VALUE
        - name: operationStatus | type: OperationStatus | description: Status of the file that was uploaded.  | read-only: true 
             - enum:
             -     FAILED: The file failed to upload, for example, during media post processing.
             -     READY: The file uploaded, finished all processing, and is ready for use.
             -     PENDING: The file is processing and the URLs are not yet available. This response is returned when importing a file.
        - name: sourceUrl | type: string | description: URL where the file was uploaded from.  | read-only: true | validation: format WEB_URL
        - name: thumbnailUrl | type: string | description: URL of the file's thumbnail.  | read-only: true | validation: format WEB_URL
        - name: labels | type: array<string> | 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.  | validation: maxItems 100, maxLength 200
        - name: createdDate | type: string | description: Date and time the file was created.  | read-only: true | validation: format date-time
        - name: updatedDate | type: string | description: Date and time the file was updated.  | read-only: true | validation: format date-time
        - name: siteId | type: string | description: The Wix site GUID where the media file is stored.  | read-only: true | validation: maxLength 100
        - name: state | type: State | description: State of the file.  | read-only: true 
             - enum:
             -     OK: File is ready for consumption
             -     DELETED: Deleted file
  - name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk action metadata.  
     - name: totalSuccesses | type: integer | description: Number of items that were successfully processed.  
     - name: totalFailures | type: integer | description: Number of items that couldn't be processed.  
     - name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded.  


```

### Examples

### Import files using external URLs
```curl
curl -X POST \
  'https://www.wixapis.com/site-media/v1/bulk/files/import-v2' \
  -H 'Authorization: <AUTH>' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "importFileRequests": [{
      "mimeType": "image/jpeg",
      "displayName": "T-shirt",
      "parentFolderId":"25284aa06584441ea94338fdcfbaba12",
      "private": false,
      "url": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png"
    }, {
      "mimeType": "video/mp45",
      "displayName": "[Pants]",
      "parentFolderId":"25284aa06584441ea94338fdcfbaba12",
      "private": false,
      "url": "https://www.google.com/videos/branding/googlelogo"
    }]
  }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.media.files.bulkImportFile(importFileRequests, options)
 Description: Imports a bulk of files to the Media Manager using external urls. <br/>  Returns information about the imported files.  Specify the `parentFolderId` and `filePath` parameters to specify the folder you want each 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 files, you need to do one of the following for each file: - 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'`. - Include 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'`.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  importFileRequests, importFileRequests.url
 Method parameters: 
   param name: importFileRequests | type: array<ImportFileRequest> | description: Information about the files to import. | required: true | validation: minItems 1, maxItems 100
              - name: url | type: string | description: Publicly accessible external file URL. | required: true | validation: minLength 2, format WEB_URL
              - name: mediaType | type: MediaType | description: Media type of the file to import. excluding: OTHER media type  
                     - enum:
                     -     UNKNOWN: Unknown media type.
                     -     IMAGE: Image file, such as JPEG or PNG.
                     -     VIDEO: Video file.
                     -     AUDIO: Audio file.
                     -     DOCUMENT: Document file, such as PDF.
                     -     VECTOR: Vector image file, such as SVG.
                     -     ARCHIVE: Archive file, such as ZIP.
                     -     MODEL3D: 3D model file.
                     -     OTHER: Any other file type.
              - name: displayName | type: string | description: File name that appears in the Media Manager. The file name is truncated to 255 characters if longer.  | validation: maxLength 1000
              - name: parentFolderId | type: string | description: GUID of the file's parent folder. <br /> This folder is the path root for the `filePath`. <br /> Default: `media-root`.  | validation: maxLength 100
              - name: private | type: boolean | 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).  
              - name: labels | type: array<string> | 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.  | validation: maxItems 500, maxLength 200
              - name: mimeType | type: string | description: File mime type.  | validation: maxLength 100
              - name: externalInfo | type: ExternalInfo | description: Information sent to the File Ready and File Failed events. See [Importing Files](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/importing-files.md) to learn more.  
                 - name: origin | type: string | description: Identifier of the app or service that initiated the upload or import, for example your app's GUID. Returned in the resulting File Ready and File Failed events, and can be used to filter events by their origin.  | validation: maxLength 1000
                 - name: externalIds | type: array<string> | description: IDs from your own system, for example the GUIDs of the entities the file belongs to. Returned in the resulting File Ready and File Failed events, and can be used to correlate an event with the call that triggered it.  | validation: maxItems 30, maxLength 4000
              - name: urlParams | type: object | description: Optional parameters that should be sent with the external URL.  
              - name: urlHeaders | type: object | description: Optional headers that should be sent with the external URL.  
              - name: filePath | type: string | description: Path to the folder where the file will be stored. For example, `/videos/2024/december`. <br/> 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.  <br />  | validation: maxLength 100
   param name: options | type: BulkImportFileOptions  none  
        - name: returnEntity | type: boolean | description: Whether to include the imported file descriptor in the response. Set to `false` to exclude the file descriptor from the response.  Default: `true`  
 Return type: PROMISE<BulkImportFileResponse>
  - name: results | type: array<BulkImportFileResult> | description: Items created by bulk action.  
     - name: itemMetadata | type: ItemMetadata | description: Item metadata.  
        - name: _id | type: string | description: Item GUID. Should always be available, unless it's impossible (for example, when failing to create an item).  
        - name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items.  
        - name: success | type: boolean | description: Whether the requested action was successful for this item. When `false`, the `error` field is populated.  
        - name: error | type: ApplicationError | description: Details about the error in case of failure.  
           - name: code | type: string | description: Error code.  
           - name: description | type: string | description: Description of the error.  
           - name: data | type: object | description: Data related to the error.  
     - name: item | type: FileDescriptor | description: Imported file. This field is included in the response if the operation was successful and `returnEntity` is not set to `false`.  
        - name: _id | type: string | description: File GUID. Generated when a file is uploaded to the Media Manager.  | read-only: true | validation: maxLength 1000
        - name: displayName | type: string | description: File name as it appears in the Media Manager.  | validation: maxLength 255
        - name: url | type: string | description: Static URL of the file.  | read-only: true | validation: format WEB_URL
        - name: parentFolderId | type: string | description: GUID of the file's parent folder.  | validation: maxLength 100
        - name: hash | type: string | description: File hash.  | read-only: true | validation: maxLength 100
        - name: sizeInBytes | type: string | description: Size of the uploaded file in bytes.  | read-only: true | validation: format DECIMAL_VALUE, decimalValue {"maxScale":0}
        - 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).  | read-only: true 
        - name: mediaType | type: MediaType | description: Media file type.  | read-only: true 
             - enum:
             -     UNKNOWN: Unknown media type.
             -     IMAGE: Image file, such as JPEG or PNG.
             -     VIDEO: Video file.
             -     AUDIO: Audio file.
             -     DOCUMENT: Document file, such as PDF.
             -     VECTOR: Vector image file, such as SVG.
             -     ARCHIVE: Archive file, such as ZIP.
             -     MODEL3D: 3D model file.
             -     OTHER: Any other file type.
        - name: media | type: FileMedia | description: Media-type-specific metadata, such as an image's dimensions or a video's available resolutions. The relevant property is populated according to the file's `mediaType`.  | read-only: true 
           - ONE-OF: 
              - name: image | type: ImageMedia | description: Information about the image.  
                 - name: image | type: string | description: Image data.  
                 - name: colors | type: Colors | description: Image colors.  
                    - name: prominent | type: Color | description: Main color of the image.  
                       - name: hex | type: string | description: HEX color.  | validation: format COLOR_HEX
                       - name: rgb | type: ColorRGB | description: RGB color.  
                          - name: r | type: integer | description: Red channel.  | validation: minimum 0, maximum 255, format int32
                          - name: g | type: integer | description: Green channel.  | validation: minimum 0, maximum 255, format int32
                          - name: b | type: integer | description: Blue channel.  | validation: minimum 0, maximum 255, format int32
                    - name: palette | type: array<Color> | description: Color palette of the image.  | validation: maxItems 100
                 - name: faces | type: array<FaceRecognition> | description: Information about faces in the image. Use to crop images without cutting out faces.  | validation: maxItems 100
                    - 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: string | 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  | read-only: true | validation: maxLength 300
              - name: video | type: string | description: Information about the video.  
              - name: audio | type: AudioV2 | description: Information about the audio.  
                 - name: _id | type: string | description: WixMedia GUID.  | validation: maxLength 200
                 - name: assets | type: array<string> | description: Audio formats available for this file.  | validation: maxItems 100
                 - name: bitrate | type: integer | description: Audio bitrate.  | read-only: true | validation: minimum 0, format int32
                 - name: format | type: string | description: Audio format.  | read-only: true | validation: maxLength 100
                 - name: duration | type: integer | description: Audio duration in seconds.  | read-only: true | validation: minimum 0, format int32
                 - name: sizeInBytes | type: string | description: Audio size in bytes.  | read-only: true | validation: format DECIMAL_VALUE, decimalValue {"maxScale":0}
              - name: document | type: string | description: Information about the document.  
              - name: vector | type: ImageMedia | description: Information about the vector.  
              - name: archive | type: Archive | description: Information about the archive.  
                 - name: _id | type: string | description: WixMedia GUID.  
                 - name: url | type: string | description: Archive URL.  
                 - name: urlExpirationDate | type: Date | description: Archive URL expiration date (when relevant).  | read-only: true 
                 - name: sizeInBytes | type: string | description: Archive size in bytes.  | validation: format DECIMAL_VALUE
                 - name: filename | type: string | description: Archive filename.  
              - name: model3d | type: Model3D | description: Information about the 3D Model.  
                 - name: _id | type: string | description: WixMedia 3D GUID.  
                 - name: url | type: string | description: 3D URL.  
                 - name: thumbnail | type: string | description: 3D thumbnail Image  
                 - name: altText | type: string | description: 3D alt text.  
                 - name: urlExpirationDate | type: Date | description: 3D URL expiration date (when relevant).  | read-only: true 
                 - name: filename | type: string | description: 3D filename.  | read-only: true 
                 - name: sizeInBytes | type: string | description: 3D size in bytes.  | read-only: true | validation: format DECIMAL_VALUE
        - name: operationStatus | type: OperationStatus | description: Status of the file that was uploaded.  | read-only: true 
             - enum:
             -     FAILED: The file failed to upload, for example, during media post processing.
             -     READY: The file uploaded, finished all processing, and is ready for use.
             -     PENDING: The file is processing and the URLs are not yet available. This response is returned when importing a file.
        - name: sourceUrl | type: string | description: URL where the file was uploaded from.  | read-only: true | validation: format WEB_URL
        - name: thumbnailUrl | type: string | description: URL of the file's thumbnail.  | read-only: true | validation: format WEB_URL
        - name: labels | type: array<string> | 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.  | validation: maxItems 100, maxLength 200
        - name: _createdDate | type: Date | description: Date and time the file was created.  | read-only: true 
        - name: _updatedDate | type: Date | description: Date and time the file was updated.  | read-only: true 
        - name: siteId | type: string | description: The Wix site GUID where the media file is stored.  | read-only: true | validation: maxLength 100
        - name: state | type: State | description: State of the file.  | read-only: true 
             - enum:
             -     OK: File is ready for consumption
             -     DELETED: Deleted file
  - name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk action metadata.  
     - name: totalSuccesses | type: integer | description: Number of items that were successfully processed.  
     - name: totalFailures | type: integer | description: Number of items that couldn't be processed.  
     - name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded.  


```

### Examples

### Bulk import files from visitor input into a form (with $w)
This code shows a page where the visitor adds basic media file data to a form and then adds it to the `newMedia` array. When the visitor clicks the upload button, all added media files are uploaded using the `bulkImportFile()` function.

```javascript
/**********************************************
 * Backend code - bulk-import-files.web.js/ts *
 *********************************************/

import { Permissions, webMethod } from '@wix/web-methods';
import { files } from '@wix/media';
import { auth } from '@wix/essentials';

export const importFiles = webMethod(Permissions.Anyone, async (importFileRequests) => {
  try {
    const elevatedBulkImportFile = auth.elevate(files.bulkImportFile)
    const importedFiles = await elevatedBulkImportFile(importFileRequests);

    console.log("Imported files:", importedFiles);
    return importedFiles;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
});
  
  
/*************
 * Page code *
 ************/

import { importFiles } from 'backend/bulk-import-files.web';

$w.onReady(() => {
  const newMedia = [];
  
  $w('#addMedia').onClick( () => {
    const newMediaFile = {
      displayName: $w('#displayName').value,
      mediaType: $w('#mediaType').value,
      parentFolderId: $w('#parentFolderId').value,
      url: $w('#url').value
    }
    newMedia.push(newMediaFile);

    // show message to remind user to submit media
    // after adding all media files for 5 seconds
    $w('#rememberToUploadMessage').show();
    setTimeout(() => {
      $w('#rememberToUploadMessage').hide();
    }, 5000)
  });

  $w('#uploadMedia').onClick(async () => {
    if (newMedia.length === 0) {
      // if no media has been added then
      // show message to add media
      $w('#addMediaMsg').show()
    } else {
      await importFiles(newMedia);

      $w('#successfulUploadMsg').show();
      setTimeout(() => {
        $w('#successfulUploadMsg').hide();
      }, 10000);
    }
  });
});

```

### Bulk import file (with elevated permissions)
```javascript
import { files } from '@wix/media';
import { auth } from '@wix/essentials';

const elevatedBulkImportFile = auth.elevate(files.bulkImportFile);

/* Sample importFileRequests value:
 * [
 *   {
 *     displayName: 'image1',
 *     mediaType: 'IMAGE',
 *     mimeType: 'image/jpeg',
 *     parentFolderId: 'igje5u22nij3qkltzsnol37j3dnthvvh',
 *     url: 'https://www.site1.com/example.jpg'
 *   }, 
 *   {
 *     displayName: 'vectorArt1',
 *     mediaType: 'VECTOR',
 *     labels : ['label1', 'label2'],
 *     url: 'https://cdn.vectorstock.com/example-vector-art.webp'
 *   },
 *   {
 *     displayName: 'video1',
 *     mediaType: 'VIDEO',
 *     url: 'https://cdn.pixabay.com/example-video.mp4'
 *   }
 * ]
 */

async function mybulkImportFileFunction(importFileRequests) {
  try {
    const importedFiles = await elevatedBulkImportFile(importFileRequests);

    console.log("Imported files:", importedFiles);
    return importedFiles;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
}

/* Promise resolves to: 
 * {
 *   "bulkActionMetadata": {
 *     "totalFailures": 0,
 *     "totalSuccesses": 3,
 *     "undetailedFailures": 0
 *   },
 *   "results": [
 *     {
 *       "item": {
 *         "_createdDate": "2023-12-26T10:22:31.000Z",
 *         "_id": "a8a52b_f8c86723942347488316f1ab35119411~mv2.jpg",
 *         "_updatedDate": "2023-12-26T10:22:31.000Z",
 *         "addedBy": {
 *           "identityId": "a8a52bb9-bac0-4bba-a55c-0611b5cdaa16",
 *           "identityType": "MEMBER"
 *         },
 *         "displayName": "image1.jpg",
 *         "hash": "",
 *         "internalTags": [],
 *         "labels": [],
 *         "mediaType": "IMAGE",
 *         "operationStatus": "PENDING",
 *         "parentFolderId": "igje5u22nij3qkltzsnol37j3dnthvvh",
 *         "private": false,
 *         "siteId": "49dcb500-1081-47b0-b13b-368b9bed8fa9",
 *         "sizeInBytes": "-1",
 *         "sourceUrl": "https://www.site1.com/example.jpg",
 *         "state": "OK",
 *         "thumbnailUrl": "https://static.wixstatic.com/media/a8a52b_f8c86723942347488316f1ab35119411~mv2.jpg",
 *         "url": "https://static.wixstatic.com/media/a8a52b_f8c86723942347488316f1ab35119411~mv2.jpg"
 *       },
 *       "itemMetadata": {
 *         "_id": "a8a52b_f8c86723942347488316f1ab35119411~mv2.jpg",
 *         "originalIndex": 0,
 *         "success": true
 *       }
 *     },
 *     {
 *       "item": {
 *         "_createdDate": "2023-12-26T10:22:32.000Z",
 *         "_id": "a8a52b_43eb6841371f4d738ddfcb7fa2bb62be-tmp.svg",
 *         "_updatedDate": "2023-12-26T10:22:32.000Z",
 *         "addedBy": {
 *           "identityId": "a8a52bb9-bac0-4bba-a55c-0611b5cdaa16",
 *           "identityType": "MEMBER"
 *         },
 *         "displayName": "vectorArt1.webp.svg",
 *         "hash": "",
 *         "internalTags": [],
 *         "labels": ["label1", "label2"],
 *         "mediaType": "VECTOR",
 *         "operationStatus": "PENDING",
 *         "parentFolderId": "media-root",
 *         "private": false,
 *         "siteId": "49dcb500-1081-47b0-b13b-368b9bed8fa9",
 *         "sizeInBytes": "-1",
 *         "sourceUrl": "https://cdn.vectorstock.com/example-vector-art.webp",
 *         "state": "OK",
 *         "thumbnailUrl": "https://static.wixstatic.com/shapes/a8a52b_43eb6841371f4d738ddfcb7fa2bb62be-tmp.svg",
 *         "url": "https://static.wixstatic.com/shapes/a8a52b_43eb6841371f4d738ddfcb7fa2bb62be-tmp.svg"
 *       },
 *       "itemMetadata": {
 *         "_id": "a8a52b_43eb6841371f4d738ddfcb7fa2bb62be-tmp.svg",
 *         "originalIndex": 1,
 *         "success": true
 *       }
 *     },
 *     {
 *       "item": {
 *         "_createdDate": "2023-12-26T10:22:32.000Z",
 *         "_id": "a8a52b_fec67a695b474a729e3a31010afbb0af",
 *         "_updatedDate": "2023-12-26T10:22:32.000Z",
 *         "addedBy": {
 *           "identityId": "a8a52bb9-bac0-4bba-a55c-0611b5cdaa16",
 *           "identityType": "MEMBER"
 *         },
 *         "displayName": "video1.mp4",
 *         "hash": "",
 *         "internalTags": [],
 *         "labels": [],
 *         "mediaType": "VIDEO",
 *         "operationStatus": "PENDING",
 *         "parentFolderId": "media-root",
 *         "private": false,
 *         "siteId": "49dcb500-1081-47b0-b13b-368b9bed8fa9",
 *         "sizeInBytes": "-1",
 *         "sourceUrl": "https://cdn.pixabay.com/example-video.mp4",
 *         "state": "OK",
 *         "thumbnailUrl": "https://static.wixstatic.com/media/54ece48fa04e492fa46bd79980105f0d.png",
 *         "url": "https://video.wixstatic.com/video/a8a52b_fec67a695b474a729e3a31010afbb0af/file"
 *       },
 *       "itemMetadata": {
 *         "_id": "a8a52b_fec67a695b474a729e3a31010afbb0af",
 *         "originalIndex": 2,
 *         "success": true
 *       }
 *     }
 *   ]
 * }
 */
```

### Bulk import file
```javascript
import { files } from '@wix/media';

/* Sample importFileRequests value:
 * [
 *   {
 *     displayName: 'image1',
 *     mediaType: 'IMAGE',
 *     mimeType: 'image/jpeg',
 *     parentFolderId: 'igje5u22nij3qkltzsnol37j3dnthvvh',
 *     url: 'https://www.site1.com/example.jpg'
 *   }, 
 *   {
 *     displayName: 'vectorArt1',
 *     mediaType: 'VECTOR',
 *     labels : ['label1', 'label2'],
 *     url: 'https://cdn.vectorstock.com/example-vector-art.webp'
 *   },
 *   {
 *     displayName: 'video1',
 *     mediaType: 'VIDEO',
 *     url: 'https://cdn.pixabay.com/example-video.mp4'
 *   }
 * ]
 */

async function mybulkImportFileFunction(importFileRequests) {
  try {
    const importedFiles = await files.bulkImportFile(importFileRequests);

    console.log("Imported files:", importedFiles);
    return importedFiles;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
}

/* Promise resolves to: 
 * {
 *   "bulkActionMetadata": {
 *     "totalFailures": 0,
 *     "totalSuccesses": 3,
 *     "undetailedFailures": 0
 *   },
 *   "results": [
 *     {
 *       "item": {
 *         "_createdDate": "2023-12-26T10:22:31.000Z",
 *         "_id": "a8a52b_f8c86723942347488316f1ab35119411~mv2.jpg",
 *         "_updatedDate": "2023-12-26T10:22:31.000Z",
 *         "addedBy": {
 *           "identityId": "a8a52bb9-bac0-4bba-a55c-0611b5cdaa16",
 *           "identityType": "MEMBER"
 *         },
 *         "displayName": "image1.jpg",
 *         "hash": "",
 *         "internalTags": [],
 *         "labels": [],
 *         "mediaType": "IMAGE",
 *         "operationStatus": "PENDING",
 *         "parentFolderId": "igje5u22nij3qkltzsnol37j3dnthvvh",
 *         "private": false,
 *         "siteId": "49dcb500-1081-47b0-b13b-368b9bed8fa9",
 *         "sizeInBytes": "-1",
 *         "sourceUrl": "https://www.site1.com/example.jpg",
 *         "state": "OK",
 *         "thumbnailUrl": "https://static.wixstatic.com/media/a8a52b_f8c86723942347488316f1ab35119411~mv2.jpg",
 *         "url": "https://static.wixstatic.com/media/a8a52b_f8c86723942347488316f1ab35119411~mv2.jpg"
 *       },
 *       "itemMetadata": {
 *         "_id": "a8a52b_f8c86723942347488316f1ab35119411~mv2.jpg",
 *         "originalIndex": 0,
 *         "success": true
 *       }
 *     },
 *     {
 *       "item": {
 *         "_createdDate": "2023-12-26T10:22:32.000Z",
 *         "_id": "a8a52b_43eb6841371f4d738ddfcb7fa2bb62be-tmp.svg",
 *         "_updatedDate": "2023-12-26T10:22:32.000Z",
 *         "addedBy": {
 *           "identityId": "a8a52bb9-bac0-4bba-a55c-0611b5cdaa16",
 *           "identityType": "MEMBER"
 *         },
 *         "displayName": "vectorArt1.webp.svg",
 *         "hash": "",
 *         "internalTags": [],
 *         "labels": ["label1", "label2"],
 *         "mediaType": "VECTOR",
 *         "operationStatus": "PENDING",
 *         "parentFolderId": "media-root",
 *         "private": false,
 *         "siteId": "49dcb500-1081-47b0-b13b-368b9bed8fa9",
 *         "sizeInBytes": "-1",
 *         "sourceUrl": "https://cdn.vectorstock.com/example-vector-art.webp",
 *         "state": "OK",
 *         "thumbnailUrl": "https://static.wixstatic.com/shapes/a8a52b_43eb6841371f4d738ddfcb7fa2bb62be-tmp.svg",
 *         "url": "https://static.wixstatic.com/shapes/a8a52b_43eb6841371f4d738ddfcb7fa2bb62be-tmp.svg"
 *       },
 *       "itemMetadata": {
 *         "_id": "a8a52b_43eb6841371f4d738ddfcb7fa2bb62be-tmp.svg",
 *         "originalIndex": 1,
 *         "success": true
 *       }
 *     },
 *     {
 *       "item": {
 *         "_createdDate": "2023-12-26T10:22:32.000Z",
 *         "_id": "a8a52b_fec67a695b474a729e3a31010afbb0af",
 *         "_updatedDate": "2023-12-26T10:22:32.000Z",
 *         "addedBy": {
 *           "identityId": "a8a52bb9-bac0-4bba-a55c-0611b5cdaa16",
 *           "identityType": "MEMBER"
 *         },
 *         "displayName": "video1.mp4",
 *         "hash": "",
 *         "internalTags": [],
 *         "labels": [],
 *         "mediaType": "VIDEO",
 *         "operationStatus": "PENDING",
 *         "parentFolderId": "media-root",
 *         "private": false,
 *         "siteId": "49dcb500-1081-47b0-b13b-368b9bed8fa9",
 *         "sizeInBytes": "-1",
 *         "sourceUrl": "https://cdn.pixabay.com/example-video.mp4",
 *         "state": "OK",
 *         "thumbnailUrl": "https://static.wixstatic.com/media/54ece48fa04e492fa46bd79980105f0d.png",
 *         "url": "https://video.wixstatic.com/video/a8a52b_fec67a695b474a729e3a31010afbb0af/file"
 *       },
 *       "itemMetadata": {
 *         "_id": "a8a52b_fec67a695b474a729e3a31010afbb0af",
 *         "originalIndex": 2,
 *         "success": true
 *       }
 *     }
 *   ]
 * }
 */
```

### bulkImportFile (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { files } from '@wix/media';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { files },
  // Include the auth strategy and host as relevant
});


async function bulkImportFile(importFileRequests,options) {
  const response = await myWixClient.files.bulkImportFile(importFileRequests,options);
};
```

---