async function getUploadToken(merchantId, platformApiKey) {
const response = await fetch('https://api.superseeded.ai/v1/auth/delegate-upload', {
method: 'POST',
headers: {
'Authorization': `Bearer ${platformApiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ merchant_id: merchantId })
});
if (!response.ok) {
throw new Error(`Failed to get upload token: ${response.statusText}`);
}
const data = await response.json();
return data.token;
}