I’m not sure this is even possible. I just spent a while messing about with Ajax uploads using the FormData interface, hoping one could set the content type manually to ‘image/jpeg’ and still have things work. Unfortunately, doing this just resulted in an empty payload being sent to the server. This is probably not news to you.
The only other thing that occurred to me was that you could stick some kind of PHP proxy between your JS script and the API and then have it intercept the Ajax call and translate it into something the API can deal with. No idea how practical that is in your case.
Nonetheless, it’s be interesting to hear how you got on with this. Could you share the API in question?