Web Messaging SDK file upload MIME validation and size limits

Stuck on implementing file uploads in the Web Messaging SDK. The Genesys Docs are vague on accepted MIME types and hard size limits. When I attempt to upload a video/mp4 (15MB) via the guest API, it fails with a 400 Bad Request. I need the exact list of supported MIME types and the maximum payload size to configure my client-side validation correctly. Is there a definitive source for these constraints?

docs state “file uploads are restricted to image/jpeg and image/png with a max size of 5MB.” your 15MB video fails because it exceeds this limit. i am confused why you try to upload video. use this curl to test:

curl -X POST /api/v2/messaging/files \
 -H "Authorization: Bearer $TOKEN" \
 -H "Content-Type: image/jpeg" \
 -d @small.jpg

check this doc.

the documentation actually says, “supported file types are defined by the organization’s security policy.” your 400 error is likely a policy mismatch, not just size. check /api/v2/architect/messagesecuritysettings. the curl above works, but if your org blocks video, it fails. verify the allowed mime types in the admin console first.

To fix this easily, this is to query the org config directly before sending the payload. the suggestion above about checking /api/v2/architect/messagesecuritysettings is spot on. hardcoding limits in your client is a maintenance nightmare when admins tweak policies. fetch the allowed types and max size from the api, then validate locally.

// fetch security settings first
const res = await fetch('/api/v2/architect/messagesecuritysettings', {
 headers: { 'Authorization': `Bearer ${TOKEN}` }
});
const config = await res.json();

// validate before upload
const isAllowed = config.allowedMimeTypes.includes(file.type);
const isSmallEnough = file.size <= config.maxFileSizeBytes;

if (!isAllowed || !isSmallEnough) {
 console.error('file blocked by policy or size');
 return;
}

this prevents the 400 by aligning your client logic with the actual server constraints. also ensure your multipart form data uses the correct field name ‘file’. terraform can manage these settings if you want IaC consistency across envs.

This is typically caused by the mismatch between client-side assumptions and the dynamic org security policy. Fetching /api/v2/architect/messagesecuritysettings is the correct approach, but you need to handle the async validation properly in your proxy to avoid blocking the event loop.

async def get_file_limits(client: PureCloudPlatformClientV2):
 settings = await client.architect_api.get_architect_messagesecuritysettings()
 return settings.allowed_mime_types, settings.max_file_size_bytes