Search a Discourse forum

/api/v1/discourse/search

Search posts in one public Discourse forum by URL and keyword, newest first, and return normalized post and source data.

Endpoint

  • Path: /api/v1/discourse/search
  • Cost: 1 credit per successful request

Query parameters

NameRequiredDescriptionExample
urlYesThe full URL of the Discourse forum to search.https://discourse.32bit.cafe
queryYesThe keyword or phrase to search for.social listening
exactNoSearch for the exact phrase by wrapping the query in double quotes. Defaults to true. Set to false to send the query unchanged.true
cursorNoThe cursor returned by the previous response.2
rawNoInclude the unchanged provider response in the raw field. Defaults to false.true
curl --get 'https://api.sociallisteningapi.com/api/v1/discourse/search' \
  --data-urlencode 'url=https://discourse.32bit.cafe' \
  --data-urlencode 'query=social listening' \
  --data-urlencode 'exact=true' \
  --data-urlencode 'cursor=2' \
  --data-urlencode 'raw=true' \
  --header 'x-api-key: YOUR_API_KEY'

GET request using cURL.

Responses

{
  "success": true,
  "platform": "discourse",
  "endpoint": "/api/v1/discourse/search",
  "data": {
    "items": [
      {
        "id": "discourse.32bit.cafe:8057",
        "platform": "discourse",
        "url": "https://discourse.32bit.cafe/t/32-bit-cafe-joins-the-fediverse/1173/1",
        "content": {
          "title": "32-Bit Cafe Joins the Fediverse!",
          "text": "The 32-Bit Cafe is joining the fediverse with its own Pixelfed instance.",
          "media_urls": [],
          "thumbnail_url": null
        },
        "author": {
          "id": "xandra",
          "username": "xandra",
          "display_name": "xandra",
          "avatar_url": "https://discourse.32bit.cafe/user_avatar/discourse.32bit.cafe/xandra/96/5075_2.png",
          "verified": null
        },
        "engagement": {
          "views": null,
          "likes": 17,
          "comments": null,
          "shares": null,
          "saves": null
        },
        "published_at": "2024-08-06T20:20:28.409Z",
        "ext": {
          "forum_url": "https://discourse.32bit.cafe",
          "author_url": "https://discourse.32bit.cafe/u/xandra",
          "topic_id": 1173,
          "topic_slug": "32-bit-cafe-joins-the-fediverse",
          "post_number": 1,
          "category_id": 5,
          "category_name": null,
          "category_slug": null,
          "topic_posts_count": 28,
          "topic_reply_count": 16,
          "tags": []
        }
      }
    ]
  },
  "pagination": {
    "next_cursor": "2",
    "has_more": true,
    "page_size": 1
  },
  "raw": {
    "posts": [
      {
        "id": 8057,
        "username": "xandra",
        "avatar_template": "/user_avatar/discourse.32bit.cafe/xandra/{size}/5075_2.png",
        "created_at": "2024-08-06T20:20:28.409Z",
        "like_count": 17,
        "blurb": "The 32-Bit Cafe is joining the fediverse with its own Pixelfed instance.",
        "post_number": 1,
        "topic_id": 1173
      }
    ],
    "topics": [
      {
        "id": 1173,
        "title": "32-Bit Cafe Joins the Fediverse!",
        "slug": "32-bit-cafe-joins-the-fediverse",
        "posts_count": 28,
        "reply_count": 16,
        "category_id": 5,
        "tags": []
      }
    ],
    "categories": [],
    "grouped_search_result": {
      "more_full_page_results": true
    }
  },
  "request_id": "req_example123",
  "credits_used": 1,
  "credits_remaining": 99
}

Request completed successfully.