# Uploading a local image using the API

**URL:** <https://meta.discourse.org/t/uploading-a-local-image-using-the-api/127071>\
**Category:** Development\
**Created:** [August 28, 2019, 10:37pm UTC](https://meta.discourse.org/t/uploading-a-local-image-using-the-api/127071 "2019-08-28T22:37:28Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![chandan.gupta](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chandan.gupta/32/180765_2.png) [@chandan.gupta](https://meta.discourse.org/u/chandan.gupta)\
**Post date:** [May 6, 2020, 5:03am UTC](https://meta.discourse.org/t/uploading-a-local-image-using-the-api/127071/5 "2020-05-06T05:03:34Z")

</div>

I spent quite some time trying to figure out how to invoke the upload endpoint from a Python script. I first followed the recommendation to reverse engineer the upload API call through Chrome dev tools. Next I replicated the upload call via Postman. Time consuming part for me was to translate that to a working Python code. For some reason, the Postman-generated Python code wasn’t working either. Here’s how it finally worked for me:

`requests.post('/uploads.json', files={'files[]': open('/path/to/image.png', 'rb')}, data={'type': 'composer'})`

---

_[View the full topic](https://meta.discourse.org/t/uploading-a-local-image-using-the-api/127071)._
