# How to get uploaded image url using the Discourse API?

**URL:** <https://meta.discourse.org/t/how-to-get-uploaded-image-url-using-the-discourse-api/37800>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [12.Январь.2016 03:51:27 UTC](https://meta.discourse.org/t/how-to-get-uploaded-image-url-using-the-discourse-api/37800 "2016-01-12T03:51:27Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![stefanm](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@stefanm](https://meta.discourse.org/u/stefanm)\
**Post date:** [12.Январь.2017 15:42:58 UTC](https://meta.discourse.org/t/how-to-get-uploaded-image-url-using-the-discourse-api/37800/13 "2017-01-12T15:42:58Z")

</div>

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

---

_[View the full topic](https://meta.discourse.org/t/how-to-get-uploaded-image-url-using-the-discourse-api/37800)._
