# How to upload image using Discourse API

**URL:** https://meta.discourse.org/t/how-to-upload-image-using-discourse-api/148869
**Category:** Development
**Tags:** rest-api
**Created:** [April 22, 2020, 3:23pm UTC](https://meta.discourse.org/t/how-to-upload-image-using-discourse-api/148869 "2020-04-22T15:23:55Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![jwulf](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jwulf/32/202597_2.png) [@jwulf](https://meta.discourse.org/u/jwulf)
#### Post date: [December 8, 2020, 7:09am UTC](https://meta.discourse.org/t/how-to-upload-image-using-discourse-api/148869/5 "2020-12-08T07:09:34Z")

</div>

Did you get this to work? I have been trying all manner of combinations with Node.js, and cannot get this to work.

I get a 422 Unprocessable Entity error.

In [the Discourse docs](https://docs.discourse.org/#tag/Upload), it says the content-type for the request is `application/json`.

In [this post](https://meta.discourse.org/t/upload-avatar-image-with-api/55253/7), the Postman example is using `form-data`, and when I watch the composer in the Discourse Web UI, it uses a multi-part post.

Anyone know how to do this via the API without using the Ruby client?

---

_[View the full topic](https://meta.discourse.org/t/how-to-upload-image-using-discourse-api/148869)._
