Troubleshooting image upload issues with Sanity's Assets API

6 replies
Last updated: Nov 30, 2024
Hey guys, I've been having trouble uploading images to sanity so I attempted to try it on postman with different pictures as well and I'm still getting this error.
Nov 30, 2024, 1:39 PM
I see the one file is a jpeg, but your assigning to a png file. If you leave the format the same, does it work as expected?
Nov 30, 2024, 2:32 PM
the second one isnt a real image and i can remove it and it still won't work
Nov 30, 2024, 9:14 PM
Using the
form-data
type will (I assume) send the header
Content-Type: multipart/form-data
, which isn’t what the Assets API expects . I would try changing the body type to
binary
.
Nov 30, 2024, 9:25 PM
Thank you for the help!
Nov 30, 2024, 10:58 PM
It works now
Nov 30, 2024, 10:59 PM
Great!
Nov 30, 2024, 11:10 PM

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?