Discourse REST API: create topics and posts programmatically

domain: discourse.org · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Generate an API key from the target Discourse instance's admin panel (Admin > API), scoped either globally or to a specific user, per docs.discourse.org.
  2. Send the key via the Api-Key and Api-Username headers — never as a URL query parameter, since Discourse's own docs warn query-string keys can leak via logs/traffic.
  3. Create a new topic (with its first post) via POST /posts.json, supplying title, raw (Markdown body), and category (category id).
  4. Create a reply in an existing topic using the same /posts.json endpoint but supplying topic_id instead of title/category.
  5. Handle standard Discourse validation and rate limits (minimum post length, new-user posting limits) since API-created content is subject to the same site rules as UI-created content.

Known gotchas

Related routes

Discourse webhooks: subscribe to post and topic events
discourse.org · 5 steps · unrated
Manage Gladly topics and conversation routing via API
developer.gladly.com · 6 steps · unrated
Create incidents and manage severities programmatically via the incident.io REST API
api-docs.incident.io · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans