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 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 @AlexDev on 2022-06-03T00:00:00Z

Discourse API Documentation
Discourse API Documentation
How do I get all posts from a specific category?
Assign group permission to a category via API
Delete Post from a Topic Using discourse API
Is there an API for changing a password?
Add a user to a group via API?
API: Getting all posts in a topic
Discourse API Documentation Released!
API: fetch all users with external id info
Problem creating a category using the API
Topic Status API
Incoming Web Hooks
Change ownership through the API?
Get list of wiki editors
Mark as accepted solution by API?
Dev Category sidebar
Calling POST on /posts.json returns null
How to upload a file via API and get it's URL?
Custom permalinks
Assign topics or messages when created via API
Adding user to group from API gets "BAD CSRF"
Discourse always posts in general using API
User API only shows 3 badges
API call to unmask all emails
Approving an already-existing user through API?
API for Category based notification level update
Trust Level Requirements from API
Struggling with pagination within search/query.json
How can I get user image's url
How to get unread notification / topic count via API?
Check_username api endpoint seems to not work correctly
Poor Notifications API documentation
Reset avatar in sync SSO
How to set user's location string with Discourse API
How to remove someone from a Message?
Getting a topic statistics with API
Replying to PM via API not working anymore
Download a user's posting history via Discourse API?
API - Get topics a user is active in
Can I update the user field automatically via API or otherwise?
How to automate configuration
No way to get period stats?
500 or 400 when updating the content of a post using the API
Need help to **getSelected** and **replace** from Toolbarevent
How to edit post with API without bumping topic?
Apis for bookmarking post and topic, and removing them as well
Not generate topic automatically for all blog posts
Get Categories detalis by categories name
API for not so techie
Is there a way to check validity of a new username via the API before actually trying to register?
Specify user by external id
How to Change User Profile Picture
Posting a new topic via API
How to easily make Discourse bots?
Remove users script either via API or PG available?
Getting who liked a post from the API
How do I set-up this workflow? Membership form with Payment > Discourse Invite
Is there an API endpoint for enabling voting in a category?
Discourse Data Explorer
Automate Badges with Webhooks for cross site integration?
/directory_items.json API returns wrong link for next page
API documentation error?
Cannot update group owners via Ruby or REST API
Shared Drafts: Allow staff to collaborate on posts before publishing
API for changing category groups
Internal server error setting tags via the api
How can i rename a group with the help of discourse api?
Can't SSO due to blocked IP addresses
Leaderboard Plugin
Post unread count clear api
Set watch_first_post via API?
How should I get the raw text of a single post
Get "badge-notification" from API?
Setting a category to use the solved plugin via console
Custom tag query for homepage?
Can we toggle anonymous mode via API
Mark notifications as read from Discourse API
How to update a private message by API?
Documentation on Client Api
Data Explorer Queries accessible to public
Bulk revert edits (bulk undo edits)
Trying to make a post.json a wiki
Anonymizing Users in Discourse
Is it possible change the post owner?
SSO, old disabled accounts
Suspend/unsuspend user based on WP membership status
API feature request
Discourses API get just the number of search results
API for preview
Is there a support about api check when users create topic
Update a Post, via API PUT: request
Why isn't the Discourse API fully documented?
Unsubscribing a user from all emails via an API call?
SSO and Screened IPs
API support for deleting categories?
Slackbot with Discourse Admin stats
How do I add tags to a post created with the API?
Now that there is an API call for Merge Users, how to call it?
How do I get the json for the each raw from topics in the category?
Can we upload Watched words through APIs?
Adding UI for Merge Users
How to reply to Topic reply?
Force-post in restricted category
How can I get external_id from the user object?
Creating a staged user with an API call
API request returns text/html and not a json object
Admin guide to tags in Discourse
Theme-Component v Plugin: What's the difference
Can I use the JSON API instead of building a plugin?
Help with Authenticating user via API
Unable to GET user by External ID
SSO and Screened IPs
The purpose of the 2 Discourse API systems
API Error: You are not permitted to view the requested resource
How do I get the latest topics from a specific category via API?
Do not disturb mode
How to add machine-generated tags to a post?
Category Slug api
Post commits via webhook inside a topic as reply
WordPress Membership Integration (Private Forum) with Discourse
GraphQL api for Discourse
Zapier webhook to update topics
Add Tag to The topic
Subcategory Name
Move topics to subcategories automatically based on their tags
Obtaining a list of topics from a category
Struggling with pagination within search/query.json
Post anonymously via API?
Retroactive topic timers
Endpoint for User Information
API: Get all private messages sent to a group
Understanding Discourse Trust Levels
Is there a way to change or delete the secondary email
Group restrictions API on Category
How to create Category/Group through API
What is Discourse API?
Allow all users to see users post_count when using the API
Multiple Topic Timers?
Can Discourse API link with Obsidian?
How to script the setup wizard?
POST on /posts returns null on moderated categories
Badges data to my website database
Send an invite to a user but complete their profile programmatically
Can I use API keys for this?
Unlist "About the *****" topics automatically when it gets created
Make requests to the Discourse API with Zapier
Add user to group after purchase
Bulk undelete topics help 😟
"Get a user by id" can't get email
Best Practise for Using a Raspberry PI as Bot for Posting Updates in Discourse
Re-Activate a suspended User via API
Automate sending Discourse invite emails with Zapier
Is there is any open API for getting similar topic in discourse?
How to get mentions for a specific user via the API?
"Fake" OAuth Provider?
Deleting all messages from a User in a Category
Allow name removal using SSO
API for getting topics doesn't include tags
Is there any endpoint that would provide a user's external account IDs from their Discourse ID?
Getting categories on your website via JS
Add users to a specific group via API
Parse groups and their member count
There are 2 IDs when I try to get API, in case of lack documentation
Is there an API call to set the logo image of a category?
User Data By Date Rage
How could I set tag for a topic by API
Set all anonymized user names to common "deleted user"
Beginner's guide to using Discourse Themes
API bug : final "." in username causes error
How can you like a specific post through the API?
How can you like a specific post through the API?
Unable to lock post with API
Update user details
Make requests to the Discourse API with Zapier
User Status
Run Data Explorer queries with the Discourse API
How to know if user has SSO
Creating a User - Tag relation plugin
How to download Comments and Topics
Create and configure an API key
Updating custom fields using API
Issue with Api
How to get uploaded image url using the Discourse API?
Automate sending Discourse invite emails with Zapier
Top Referred Topics and Trending search via API
What is the Timing of Formal Discourse REST API?
Discourse Chat Integration
User ignore feature: webhook and API
Get user by e-mail
API GET for Category User notification_level
Discourse API Documentation
How to mark Topic or Notification as "Read = true"
Discourse API Documentation
Discourse API Documentation
API Error: You are not permitted to view the requested resource
Integrating Discourse with a larger social network app?
Is there a way to see hourly post data?
Exclude / Suppress (Automatically) Closed Topics from the Homepage?
Correct method for updating category group permission level via API
API: a scope with access to /uploads
Changed API for directory_items
Add category moderators with the API?
Tickets Plugin :tickets:
Bulk change setting - want to enable accepted solution for multiple subcategories
How to remove tags via API
Seeding a new forum by creating users and content
Open composer for existing topic/personal message via URL