Cannot send Request using fetch

I was trying to send a image using fetch api but i was getting status 400
fetch(‘’, {
method: ‘POST’,
“Content-Type”: “application/x-www-form-urlencoded”,
‘Accept’: ‘application/vnd.uploadcare-v0.5+json’,
‘Authorization’: ‘Uploadcare.Simple public_key:private_key’ },
body: data

Hi @varun1010.meka,

If by “send an image” you mean “upload an image”, you need to use Upload API instead of REST API. For example

const data = new FormData();
data.set('UPLOADCARE_PUB_KEY', 'your_public_key')
data.set('UPLOADCARE_STORE', '1')
data.append('file', file);
fetch('', {
    method: 'POST',
    body: data
}).then(res => res.json())  
  .then(data => {
}).catch(error => {
1 Like