# Change ownership through the API?

**URL:** https://meta.discourse.org/t/change-ownership-through-the-api/109456
**Category:** Development
**Created:** [February 18, 2019, 12:40pm UTC](https://meta.discourse.org/t/change-ownership-through-the-api/109456 "2019-02-18T12:40:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![nottrobin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nottrobin/32/114694_2.png) [@nottrobin](https://meta.discourse.org/u/nottrobin)
#### Post date: [February 18, 2019, 12:40pm UTC](https://meta.discourse.org/t/change-ownership-through-the-api/109456/1 "2019-02-18T12:40:09Z")

</div>

I’m trying to change the ownership of posts through the API, but can’t work out how to do it.

I tried [using PUT to `/posts/{id}.json`](https://docs.discourse.org/#tag/Posts%2Fpaths%2F~1posts~1%7Bid%7D.json%2Fput) with setting `post[username]` and `post[user_id]`, but neither of those seemed to work.

Anyone know how to do this?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 18, 2019, 12:42pm UTC](https://meta.discourse.org/t/change-ownership-through-the-api/109456/2 "2019-02-18T12:42:07Z")

</div>

Did you start with [Reverse engineer the Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576)

---

<div class="post-metadata">

### Author: ![nottrobin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nottrobin/32/114694_2.png) [@nottrobin](https://meta.discourse.org/u/nottrobin)
#### Post date: [February 18, 2019, 2:02pm UTC](https://meta.discourse.org/t/change-ownership-through-the-api/109456/3 "2019-02-18T14:02:33Z")

</div>

No I’ve not done that yet. I know how to do it, but I don’t have time just this second. I’ll post here if I get around to it and discover the answer =)

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [February 18, 2019, 5:34pm UTC](https://meta.discourse.org/t/change-ownership-through-the-api/109456/4 "2019-02-18T17:34:08Z")

</div>

Do a POST request to the URL `/t/[TOPIC_ID]/change-owner.json` with the form data `post_ids[]` and `username`.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [November 13, 2023, 1:06pm UTC](https://meta.discourse.org/t/change-ownership-through-the-api/109456/5 "2023-11-13T13:06:22Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
