# How to create post with ruby api?

**URL:** https://meta.discourse.org/t/how-to-create-post-with-ruby-api/61616
**Category:** Support
**Created:** [April 26, 2017, 3:58am UTC](https://meta.discourse.org/t/how-to-create-post-with-ruby-api/61616 "2017-04-26T03:58:12Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sessionstart](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sessionstart/32/67305_2.png) [@sessionstart](https://meta.discourse.org/u/sessionstart)
#### Post date: [April 26, 2017, 3:58am UTC](https://meta.discourse.org/t/how-to-create-post-with-ruby-api/61616/1 "2017-04-26T03:58:13Z")

</div>

Hello,

Can somebody tell me how to create post with ruby api?

It seems that there is only create topic api in discourse\_api gem ([GitHub - discourse/discourse\_api: Ruby API for Discourse · GitHub](https://github.com/discourse/discourse_api)).

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [April 26, 2017, 4:05am UTC](https://meta.discourse.org/t/how-to-create-post-with-ruby-api/61616/2 "2017-04-26T04:05:25Z")

</div>

Check out the source code:  
[discourse\_api/lib/discourse\_api/api/posts.rb at main · discourse/discourse\_api · GitHub](https://github.com/discourse/discourse_api/blob/master/lib/discourse_api/api/posts.rb)

I’d assume `create_post` is what you’re looking for, but I’m not a Ruby expert.

---

<div class="post-metadata">

### Author: ![sessionstart](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sessionstart/32/67305_2.png) [@sessionstart](https://meta.discourse.org/u/sessionstart)
#### Post date: [April 26, 2017, 4:57am UTC](https://meta.discourse.org/t/how-to-create-post-with-ruby-api/61616/3 "2017-04-26T04:57:40Z")

</div>

Thanks, it just works!

Better if I can get the latest inserted topic\_id when I call create\_topic method. I’ll have a try!

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [April 26, 2017, 3:08pm UTC](https://meta.discourse.org/t/how-to-create-post-with-ruby-api/61616/4 "2017-04-26T15:08:46Z")

</div>


