Skip to content

How to fix the `Upload preset not found` error in Cloudinary

I was doing a test project that used Cloudinary as the image storage.

I ran into this issue when I tried uploading the image. I received a 400 Bad Request with this JSON message:

{"error":{"message":"Upload preset not found"}}

Turned out I didn’t set up an Upload Preset.

You need to go in the Settings in your Cloudinary Dashboard, in the Upload tab you click “Add upload preset”, and you add one.

Then you use that preset name in your Cloudinary upload code.

For example I had a canvas object from an HTML canvas I wrote to, and this was the code to upload it to Cloudinary as an image:

const base64Image = canvas.toDataURL()
const formData = new FormData()
formData.append('file', base64Image)
formData.append('upload_preset', '***THE_PRESET_NAME***')

fetch(`https://api.cloudinary.com/v1_1/***YOUR_CLOUD_NAME***/image/upload`, {
  method: 'POST',
  body: formData,
})

Tip: while testing you might choose to add an unsigned upload preset, as it simplifies the code.


download all my books for free

  • javascript handbook
  • typescript handbook
  • css handbook
  • node.js handbook
  • astro handbook
  • html handbook
  • next.js pages router handbook
  • alpine.js handbook
  • htmx handbook
  • react handbook
  • sql handbook
  • git cheat sheet
  • laravel handbook
  • express handbook
  • swift handbook
  • go handbook
  • php handbook
  • python handbook
  • cli handbook
  • c handbook

subscribe to my newsletter to get them

Terms: by subscribing to the newsletter you agree the following terms and conditions and privacy policy. The aim of the newsletter is to keep you up to date about new tutorials, new book releases or courses organized by Flavio. If you wish to unsubscribe from the newsletter, you can click the unsubscribe link that's present at the bottom of each email, anytime. I will not communicate/spread/publish or otherwise give away your address. Your email address is the only personal information collected, and it's only collected for the primary purpose of keeping you informed through the newsletter. It's stored in a secure server based in the EU. You can contact Flavio by emailing [email protected]. These terms and conditions are governed by the laws in force in Italy and you unconditionally submit to the jurisdiction of the courts of Italy.

Related posts about services: