# Updating topic body via the API

**URL:** https://meta.discourse.org/t/updating-topic-body-via-the-api/61220
**Category:** Support
**Created:** [2017年四月19日 02:30 UTC](https://meta.discourse.org/t/updating-topic-body-via-the-api/61220 "2017-04-19T02:30:27Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![kennym](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kennym/32/115557_2.png) [@kennym](https://meta.discourse.org/u/kennym)
#### Post date: [2017年四月19日 02:30 UTC](https://meta.discourse.org/t/updating-topic-body-via-the-api/61220/1 "2017-04-19T02:30:27Z")

</div>

I’m trying to update a topic body via the API, but I’m not sure how to do it.

I tried to use `POST /posts/` and providing it with the `topic_id` which only creates a new post for a topic.

I also tried `PUT /posts/:id` but providing it with the topic id doesn’t update the topic. I actually get a 403.

`PUT /t/:slug/:id` doesn’t seem to be what I’m looking for.

Any advice here, please?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2017年四月19日 02:36 UTC](https://meta.discourse.org/t/updating-topic-body-via-the-api/61220/2 "2017-04-19T02:36:21Z")

</div>

The [official docs](http://docs.discourse.org/#tag/Posts%2Fpaths%2F~1posts~1%7Bid%7D%2Fput) say it’s a `PUT` for `/posts/:id` with `post[raw]` in FormData:

---

<div class="post-metadata">

### Author: ![kennym](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kennym/32/115557_2.png) [@kennym](https://meta.discourse.org/u/kennym)
#### Post date: [2017年四月19日 02:41 UTC](https://meta.discourse.org/t/updating-topic-body-via-the-api/61220/4 "2017-04-19T02:41:06Z")

</div>

Where `:id` is equal to the topic ID in this case?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2017年四月19日 02:42 UTC](https://meta.discourse.org/t/updating-topic-body-via-the-api/61220/5 "2017-04-19T02:42:37Z")

</div>

No, it’s the post id.

On Discourse land, a topic it’s just a bunch of posts. A topic has no body, the first post of the topic is the body.

---

<div class="post-metadata">

### Author: ![kennym](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kennym/32/115557_2.png) [@kennym](https://meta.discourse.org/u/kennym)
#### Post date: [2017年四月19日 02:43 UTC](https://meta.discourse.org/t/updating-topic-body-via-the-api/61220/7 "2017-04-19T02:43:57Z")

</div>

Got it. [Discourse API Docs](http://docs.discourse.org/#tag/Topics%2Fpaths%2F~1t~1%7Bid%7D.json%2Fget)

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2017年四月19日 04:09 UTC](https://meta.discourse.org/t/updating-topic-body-via-the-api/61220/9 "2017-04-19T04:09:20Z")

</div>

It really depends on how you are managing stuff.

If it’s a sync, you can save the post id of the topic when you create it, so it’s easy when you need to update it later (if that’s a common operation).

---

<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: [2021年十二月27日 23:29 UTC](https://meta.discourse.org/t/updating-topic-body-via-the-api/61220/12 "2021-12-27T23:29:48Z")

</div>


