> 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 # MediaAttachmentUploadUrl # Package: aiSiteChat # Namespace: Messages # Method link: https://dev.wix.com/docs/api-reference/business-management/ai-site-chat/messages/media-attachment-upload-url.md ## Permission Scopes: Innovation Lab User: SCOPE.INNOVATION_LAB.USER ## Introduction Allows site visitor to create upload url to use for uploading a file. --- ## REST API ### Schema ``` Method: mediaAttachmentUploadUrl Description: Allows site visitor to create upload url to use for uploading a file. URL: https://www.wixapis.com/v1/messages/files/generate-upload-url Method: GET # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: mimeType Method parameters: query param name: fileName | type: fileName | description: File name query param name: filePath | type: filePath query param name: mimeType | type: mimeType | description: File type e.g. "image/png". | required: true query param name: parentFolderId | type: parentFolderId Return type: MediaAttachmentUploadUrlResponse - name: uploadUrl | type: string | description: ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.aiSiteChat.Messages.mediaAttachmentUploadUrl(mimeType, options) Description: Allows site visitor to create upload url to use for uploading a file. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: mimeType Method parameters: param name: mimeType | type: string | description: File type e.g. "image/png". | required: true param name: options | type: MediaAttachmentUploadUrlOptions none - name: fileName | type: string | description: File name Return type: PROMISE - name: uploadUrl | type: string | description: ``` ### Examples ### mediaAttachmentUploadUrl ```javascript import { messages } from '@wix/ai-site-chat'; async function mediaAttachmentUploadUrl(mimeType,options) { const response = await messages.mediaAttachmentUploadUrl(mimeType,options); }; ``` ### mediaAttachmentUploadUrl (with elevated permissions) ```javascript import { messages } from '@wix/ai-site-chat'; import { auth } from '@wix/essentials'; async function myMediaAttachmentUploadUrlMethod(mimeType,options) { const elevatedMediaAttachmentUploadUrl = auth.elevate(messages.mediaAttachmentUploadUrl); const response = await elevatedMediaAttachmentUploadUrl(mimeType,options); } ``` ### mediaAttachmentUploadUrl (self-hosted) Self-hosted 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 { messages } from '@wix/ai-site-chat'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { messages }, // Include the auth strategy and host as relevant }); async function mediaAttachmentUploadUrl(mimeType,options) { const response = await myWixClient.messages.mediaAttachmentUploadUrl(mimeType,options); }; ``` ---