How to get uploaded image url using the Discourse API?

hi all,

i am trying to upload image using ajax, and getting 400 bad request.
but there is no message so i can see what is going on.
Have my csrf token, and also logged in but still nothing.

code looks something like this

 $.ajax({
                    headers: { 'X-CSRF-Token': data.csrf },
                    url: '/forum/uploads.json?synchronous=1',
                    type: 'POST',
                    data: formData,
                    cache: false,
                    contentType: false,
                    processData: false,
                    success: function (xhr) {
                   
                    },
                });

i guess it is maybe because i am using formData, if it is can you please tell me in which format i need to send image?

Thanks