Reverse engineer the Discourse API

Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api.

Many of the endpoints are properly documented in the discourse_api gem, however some endpoints lack documentation.

To determine how to do something with the JSON API here are some steps you can follow.

Example: recategorize a topic.

  • Go to a topic and start editing a category:


  • Open Chrome dev tools, switch to the Network tab, select XHR filter:

  • Perform the operation

  • Note that in some versions of Chrome, the “Form Data” will be located under the “Payload” tab

  • Look at preview as well to figure out the results

  • You now have all the info you need.
  1. The endpoint is

  2. Payload is passed using a PUT

  3. The parameter sent is: category_id: 5

Equipped with this information you can make your own calls using your favorite programming language. All you need to do is add your Api-Username and Api-Key to the request headers. (See Discourse REST API Documentation for details about how to formulate a curl request to the Discourse API.)

API credentials can be generated from the Admin / API tab:

Last Reviewed by @SaraDev on 2022-06-03T00:00:00Z

Last edited by @JammyDodger 2024-05-25T08:35:35Z

Last checked by @barto_95 2024-06-10T14:46:19Z

Check documentPerform check on document: