Private Messages

Creates a new topic, a new post, or a private message

POST
https://discourse.example.com/posts.json

Body

application/json
titlestring

Required if creating a new topic or new private message.

rawstringrequired
topic_idinteger

Required if creating a new post.

categoryinteger

Optional if creating a new topic, and ignored if creating a new post.

target_recipientsstring

Required for private message, comma separated.

Example
blake,sam
target_usernamesstringdeprecated

Deprecated. Use target_recipients instead.

archetypestring

Required for new private message.

Example
private_message
created_atstring
reply_to_post_numberinteger

Optional, the post number to reply to inside a topic.

embed_urlstring

Provide a URL from a remote system to associate a forum topic with that URL, typically for using Discourse as a comments system for an external blog.

external_idstring

Provide an external_id from a remote system to associate a forum topic with that id.

auto_trackboolean

If false, the user will not track the topic. By default, the user will track the topic.

Response

200OKany

post created

Response fields application/json
idintegerrequired
namestring | nullrequired
usernamestringrequired
avatar_templatestringrequired
created_atstringrequired
rawstring
cookedstringrequired
post_numberintegerrequired
post_typeintegerrequired
posts_countintegerrequired
updated_atstringrequired
reply_countintegerrequired
reply_to_post_numberstring | nullrequired
quote_countintegerrequired
readsintegerrequired
readers_countintegerrequired
scorenumberrequired
yoursbooleanrequired
topic_idintegerrequired
topic_slugstringrequired
display_usernamestring | nullrequired
primary_group_namestring | nullrequired
flair_namestring | nullrequired
flair_urlstring | nullrequired
flair_bg_colorstring | nullrequired
flair_colorstring | nullrequired
flair_group_idinteger | null
badges_grantedArray<any>
versionintegerrequired
can_editbooleanrequired
can_deletebooleanrequired
can_recoverbooleanrequired
can_see_hidden_postboolean
can_wikibooleanrequired
user_titlestring | nullrequired
bookmarkedbooleanrequired
actions_summaryArray<object>required
Show child attributes
idintegerrequired
can_actbooleanrequired
moderatorbooleanrequired
adminbooleanrequired
staffbooleanrequired
user_idintegerrequired
draft_sequenceintegerrequired
hiddenbooleanrequired
trust_levelintegerrequired
deleted_atstring | nullrequired
user_deletedbooleanrequired
edit_reasonstring | nullrequired
can_view_edit_historybooleanrequired
wikibooleanrequired
reviewable_idinteger | nullrequired
reviewable_score_countintegerrequired
reviewable_score_pending_countintegerrequired
post_urlstringrequired
post_localizationsArray<any>
mentioned_usersArray<any>