Private Message Send API

Are you setting the archetype? In the future if you include the request you are sending, it’ll be easier to help you.

The following example works for me:

curl https://$DISCOURSE_HOSTNAME/posts \
  -H "api-key: $DISCOURSE_API_KEY" \
  --data 'title=Testing PM creation&archetype=private_message&target_recipients=user1,user2' \
  --data-urlencode 'raw=PM body, long enough to meet site rules & may be complex ♥'

:information_source: if you are using an all_users API key you also need to specify api-username