# Upload avatar image with API

**URL:** https://meta.discourse.org/t/upload-avatar-image-with-api/55253
**Category:** Development
**Tags:** rest-api
**Created:** [January 6, 2017, 1:31am UTC](https://meta.discourse.org/t/upload-avatar-image-with-api/55253 "2017-01-06T01:31:43Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [January 6, 2017, 12:45pm UTC](https://meta.discourse.org/t/upload-avatar-image-with-api/55253/2 "2017-01-06T12:45:33Z")

</div>

So in order to change the avatar via the api you will need to make 2 api requests.

```
POST {{base_url}}/uploads.json
form-data:
  api_key: {{api_key}}
  api_username: {{api_username}}
  type: avatar
  user_id: 1
  files[]: file

```

The problem I found is that this just returns `{ "success": "OK" }` and doesn’t return the `upload_id`?

Then you need to make a request with the `upload_id`:

```
PUT {{base_url}}/users/{{api_username}}/preferences/avatar/pick
form-data:
  api_key: {{api_key}}
  api_username: {{api_username}}
  upload_id: 2
  type: uploaded

```

---

_[View the full topic](https://meta.discourse.org/t/upload-avatar-image-with-api/55253)._
