# Replying to PM via API not working anymore

**URL:** https://meta.discourse.org/t/replying-to-pm-via-api-not-working-anymore/145037
**Category:** Support
**Created:** [March 21, 2020, 12:09pm UTC](https://meta.discourse.org/t/replying-to-pm-via-api-not-working-anymore/145037 "2020-03-21T12:09:58Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Rina\_Fallingstar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rina_fallingstar/32/168391_2.png) [@Rina\_Fallingstar](https://meta.discourse.org/u/Rina_Fallingstar)
#### Post date: [March 21, 2020, 12:09pm UTC](https://meta.discourse.org/t/replying-to-pm-via-api-not-working-anymore/145037/1 "2020-03-21T12:09:59Z")

</div>

I’ve noticed there was a [fix](https://review.discourse.org/t/fix-ensures-we-dont-attempt-to-create-a-new-pm-on-an-existing-topic-9029/9319) to discourse almost a month ago where you can’t create a PM on an existing topic anymore. I never knew this was the issue at all. But it seems this fix “broke” the ability to reply to PM messages through the API.

The response from the discourse server contains the following error: [“Sorry, you can’t create a PM on an existing topic.”].  
We are sending the following (example):

```plaintext
url: /posts
json: {
  raw: "message goes here",
  topic_id: 31,
  archetype: "private_message"
}

```

Can anyone help me fix this issue? Is there another way to reply to PM?  
Thank you.

---

<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: [March 21, 2020, 12:57pm UTC](https://meta.discourse.org/t/replying-to-pm-via-api-not-working-anymore/145037/2 "2020-03-21T12:57:46Z")

</div>

Have you checked [How to reverse engineer the Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576)? It’s likely that the API just changed

---

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [March 21, 2020, 1:04pm UTC](https://meta.discourse.org/t/replying-to-pm-via-api-not-working-anymore/145037/3 "2020-03-21T13:04:56Z")

</div>

> [@Rina\_Fallingstar](#):
>
> But it seems this fix “broke” the ability to reply to PM messages through the API.

Replying to topic and private topic is the same through API (you just supply `topic_id`).. I don’t have any problems with that.. It works 100% with latest.

---

<div class="post-metadata">

### Author: ![Rina\_Fallingstar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rina_fallingstar/32/168391_2.png) [@Rina\_Fallingstar](https://meta.discourse.org/u/Rina_Fallingstar)
#### Post date: [March 21, 2020, 5:57pm UTC](https://meta.discourse.org/t/replying-to-pm-via-api-not-working-anymore/145037/4 "2020-03-21T17:57:45Z")

</div>

I did some reverse engineering like you suggested. The solution is as followed.

When you reply to an already existing private message **archetype** must be set to “regular” and not “private\_message”.

---

<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: [April 20, 2020, 5:57pm UTC](https://meta.discourse.org/t/replying-to-pm-via-api-not-working-anymore/145037/5 "2020-04-20T17:57:57Z")

</div>

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