# Can't update a topic's body by API

**URL:** <https://meta.discourse.org/t/cant-update-a-topics-body-by-api/264640>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [May 11, 2023, 12:05pm UTC](https://meta.discourse.org/t/cant-update-a-topics-body-by-api/264640 "2023-05-11T12:05:50Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Dotila\_Li](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dotila_li/32/303426_2.png) [@Dotila\_Li](https://meta.discourse.org/u/Dotila_Li)\
**Post date:** [May 11, 2023, 12:05pm UTC](https://meta.discourse.org/t/cant-update-a-topics-body-by-api/264640/1 "2023-05-11T12:05:50Z")

</div>

I did follow the [docs](https://docs.discourse.org/#tag/Topics/operation/updateTopic) and， however, it only update the topic’s title, without updating the body.

My code (Javascript):

```js
async function updateDiscourseTopic(topic_id) {
  const Discourse_API_Key = "Discourse_API_Key";
  const url = `https://discourse.mysite.com/t/-/${topic_id}.json`;

  const payload = {
    title: 'session_1',
    raw: "new body(doesn't apply)"
  }

  const response = await fetch(url, {
    method: 'PUT',
    headers: {
      "Api-Key": Discourse_API_Key,
      "Api-Username": "system",
      "Content-Type": "application/json",
    },
    body: JSON.stringify(payload)
  });

}

```

---

_[View the full topic](https://meta.discourse.org/t/cant-update-a-topics-body-by-api/264640)._
