> 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

# GetMediaUploadURL

# Package: forms

# Namespace: FormSubmissionService

# Method link: https://dev.wix.com/docs/api-reference/crm/forms/form-submissions/get-media-upload-url.md

## Permission Scopes:
View Forms: SCOPE.FORMS.VIEW-FORM

## Introduction

> **Note:** The Form Submission API only works with the Wix Forms app. Call [GetAppInstance](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/get-app-instance.md) to confirm that the app named `wix_forms` is installed on the site.
<br>
Retrieves a URL, generated by [Media Manager](https://dev.wix.com/api/rest/media/media-manager/files/generate-file-upload-url), to allow clients to upload a file to a form for submission.

---

## REST API

### Schema

```
 Method: getMediaUploadUrl
 Description: > **Note:** The Form Submission API only works with the Wix Forms app. Call [GetAppInstance](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/get-app-instance.md) to confirm that the app named `wix_forms` is installed on the site. <br> Retrieves a URL, generated by [Media Manager](https://dev.wix.com/api/rest/media/media-manager/files/generate-file-upload-url), to allow clients to upload a file to a form for submission.
 URL: https://www.wixapis.com/form-submission-service/v4/submissions/media-upload-url
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  formId, mimeType, filename
 Method parameters: 
   param name: filename | type: filename | description: Name of file to upload. | required: true | validation: maxLength 300
   param name: formId | type: formId | description: Form GUID. | required: true | validation: format GUID
   param name: mimeType | type: mimeType | description: [Mime type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#) of file to upload.  For example, `'image/png'` | required: true | validation: maxLength 100
   param name: uploadTarget | type: uploadTarget | description: Human readable identifier used to reference a field to which file was uploaded. For example, `"address"`.  | validation: maxLength 200
 Return type: GetMediaUploadURLResponse
  - name: uploadUrl | type: string | description: Url to upload file.  | validation: maxLength 500


```

### Examples

### GetMediaUploadURL
```curl
~~~cURL
curl -X POST \
  'https://www.wixapis.com/form-submission-service/v4/submissions/media-upload-url' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: <AUTH>' \
  -d '{
    "formId": "e62e3011-55cf-4de3-a497-e097b52d86b8",
    "filename": "cats.mp4",
    "mimeType": "video/mp4"
  }'
~~~
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.forms.submissions.getMediaUploadUrl(formId, filename, mimeType, options)
 Description: > **Note:** The Form Submission API only works with the Wix Forms app. Call [GetAppInstance](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/get-app-instance.md) to confirm that the app named `wix_forms` is installed on the site. <br> Retrieves a URL, generated by [Media Manager](https://dev.wix.com/api/rest/media/media-manager/files/generate-file-upload-url), to allow clients to upload a file to a form for submission.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  formId, mimeType, filename
 Method parameters: 
   param name: formId | type: string | description: Form GUID. | required: true | validation: format GUID
   param name: filename | type: string | description: Name of file to upload. | required: true | validation: maxLength 300
   param name: mimeType | type: string | description: [Mime type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#) of file to upload.  For example, `'image/png'` | required: true | validation: maxLength 100
   param name: options | type: GetMediaUploadURLOptions  none  
        - name: uploadTarget | type: string | description: Human readable identifier used to reference a field to which file was uploaded. For example, `"address"`.  | validation: maxLength 200
 Return type: PROMISE<GetMediaUploadURLResponse>
  - name: uploadUrl | type: string | description: Url to upload file.  | validation: maxLength 500


```

### Examples

### Get media upload URL
```javascript
import { submissions } from '@wix/forms';

/* 
Sample formID value: "21bcb6c7-02b3-4ed1-b6db-7856094fac03"
Sample filename value: "cats.mp4"
Sample mimeType value: "video/mp4"
*/

export async function myGetMediaUploadUrlFunction(formId, filename, mimeType) {
  try {
    const uploadUrl = await submissions.getMediaUploadUrl(formId, filename, mimeType);
    console.log('Success! Upload URL:', uploadUrl);
    return uploadUrl;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
}

/* Promise resolves to:
{
  "uploadUrl": "https://upload.wixmp.com/upload/eyJhbGciOiJfdddcCI6IkpXVCJ9.eyJqdGkiOiIqweFkM2NiMi0zYzQ4LTRjNDQtODBkNi0yYmEwMTUwZDM0OTEiLCJhdWQiOiJ1cm46c2VydmljZTp1cGxvYWQiLCJpc3MiOiJ1cm46c2VydmljZTp1c3NzY2OWZmMGQwNzRkN2YyLXN0YWdlIiwicGF0aCI6IjkzYTE5ZjZkLTkwZjUtNGFkZi04ZTEwLTk4Zj2UvZWZkYTdlZTYtZDFlZi00NzZjLWJmOTItZTYwNmEwYWMzNGQ0LXNjcmVlbi5wbmciLCJjYWxsYmFja1VybCI6Imh0dHBzOi8vd2l4bXAtMTY4YWExOTc3NzY2OWZmMGQwNzRkN2YyLmFwcHNwb3QuY29tL19hcGkvdjMvdXBsb2FkL2NhbGxiYWNrP3VwbG9hZFRva2VuPWV5SmhiR2NpT2lKSVV6STFOaUlzSW5SNWNDSTZJa3BYVkNKOS5leUpwYzNNaU9pSjFjbTQ2YzJWeWRtbGpaVHBtYVd4bExuVndiRzloWkNJc0ltRjFaQ0k2SW5WeWJqcHpaWEoyYVdObE9tWnBiR1V1ZFhCc2IyRmtJaXdpYzNWaUlqb2lkWsafdEp1T21Gd2NEbzNZVEk1TVdZek5ERmpaamswT1RrMU9UUmlNRFpsTjJVM09EbG1PV1ppTlNJc0ltbGhkQ0k2TVRZNE5qZ3hOREUwTWl3aVpYaHdJam94TmpnMk9EVTNNelF5TENKcWRHa2lPaUprTkRBMVlUQmpZekV3bkIwYUNJNklpODVNMkV4T1dZMlpDMDVNR1kxTFRSaFpHWXRPR1V4TUMwNU9HWTFZelZsT0RNeE5USXZOemt3WWpFNFpHUXRaV1UyTmkwME9EQmlMV0V4TTJRdE5qbGxZbUl3WXpKbE1qTmxMMlZtWkdFM1pXVTJMV1F4WldZdE5EYzJZeTFpWmpreUxXVTJNRFpoTUdGak16UmtOQzF6WTNKbFpXNHVjRzVuSWl3aVlXTnNJam9pY0hWaWJHbGpJaXdpYkdaaklqcDdJbUZuWlNJNk1qVTVNakF3TUN3aVlXTjBdfdhVzl1SWpvaVpXUWlPaUprWld4bGRHVXRNalU1TWpBd01DSjlMQ0pqYkdJaU9tNTFiR3g5Li1qdkg3VkN4U2N6UXZpM3U2MVJmSTg3WUY3YllKRGdlNWZqc21ZMk9WSEUiLCJhY2wiOiJwdWJsaWMiLCJtaW1lVHlwZSI6ImltYWdlL3BuZyJ9.z0G6bPu_K1qdoj9EK-6Lo_ZEpd2jTihSp6LEPBVqiXw"
}

*/
```

### getMediaUploadUrl (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 { submissions } from '@wix/forms';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function getMediaUploadUrl(formId,filename,mimeType,options) {
  const response = await myWixClient.submissions.getMediaUploadUrl(formId,filename,mimeType,options);
};
```

---