Skip to content
Browsabledocs
Staging API reference · Requests use https://api-ingress-worker-staging.browsable-staging.workers.dev
Documentation Reddit Search
Markdown ↗
Reddit APIs

Reddit Search

Search Reddit posts globally or within a subreddit.

POST/v1/reddit/search
Authenticate every request

Send Authorization: Bearer YOUR_API_KEY. Get an API key →

Parameters

Send these fields in a flat JSON body. Add _run to choose execution options.

querystringRequired

Search query. Minimum length: 1. Maximum length: 2000.

limitintegerOptional

Maximum number of items to return. Default: 25. Minimum: 1. Maximum: 100.

afterstringOptional

Cursor returned by the previous response.

beforestringOptional

Cursor returned by the previous response.

sortstringOptional

Sort order. Global search supports relevance, new, top, and comment_count; subreddit search also supports hot and comments. Allowed: "relevance", "new", "top", "comment_count", "hot", "comments".

subredditstringOptional

Subreddit name, r/name, or subreddit URL.

timeframestringOptional

Timeframe for results where supported. Allowed: "hour", "day", "week", "month", "year", "all".

Response

Every response describes a run. Read result once run_status is succeeded.

run_id
The run to track. Keep it when contacting support.
run_status
Queued, running, waiting for sign-in, succeeded, or failed. Check this even after an HTTP 200.
status_url
Poll this URL while the run is pending. Keep the same run instead of starting another request.
result
The endpoint’s returned data. The example is illustrative; actual fields may be empty or unavailable.
error
On failure, inspect its code, message, retryable and action fields.
View the complete output schema
JSON
{
  "type": "object",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "required": [
    "results",
    "count"
  ],
  "properties": {
    "after": {
      "type": "string"
    },
    "count": {
      "type": "integer"
    },
    "before": {
      "type": "string"
    },
    "results": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "title",
          "author",
          "subreddit",
          "score",
          "upvoteRatio",
          "numComments",
          "created",
          "url",
          "isVideo"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "score": {
            "type": "number"
          },
          "title": {
            "type": "string"
          },
          "author": {
            "type": "string"
          },
          "created": {
            "type": "number"
          },
          "isVideo": {
            "type": "boolean"
          },
          "selftext": {
            "type": "string"
          },
          "subreddit": {
            "type": "string"
          },
          "thumbnail": {
            "type": "string"
          },
          "numComments": {
            "type": "number"
          },
          "upvoteRatio": {
            "type": "number"
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
View a polled run response
JSON
{
  "run_id": "00000000-0000-4000-8000-000000000001",
  "task_key": "reddit-search",
  "task_name": "Reddit Search",
  "run_status": "succeeded",
  "status_url": "/v1/runs/00000000-0000-4000-8000-000000000001",
  "result": {
    "count": 2,
    "results": [
      {
        "id": "1k9x2ab",
        "title": "What are the best resources for learning machine learning in 2026?",
        "author": "ml_beginner_42",
        "subreddit": "MachineLearning",
        "score": 187,
        "upvoteRatio": 0.96,
        "numComments": 54,
        "created": 1773328800,
        "url": "https://www.reddit.com/r/MachineLearning/comments/1k9x2ab/what_are_the_best_resources_for_learning_machine/",
        "isVideo": false,
        "selftext": "I have a solid Python background and want to move into practical ML projects. Looking for courses, books, and hands-on resources.",
        "thumbnail": "https://styles.redditmedia.com/t5_2r3gv/styles/communityIcon_example.png"
      },
      {
        "id": "1k93yz7",
        "title": "Show HN: I built a small model to classify research paper abstracts by topic",
        "author": "latent_vector",
        "subreddit": "programming",
        "score": 92,
        "upvoteRatio": 0.91,
        "numComments": 18,
        "created": 1773242400,
        "url": "https://www.reddit.com/r/programming/comments/1k93yz7/show_hn_i_built_a_small_model_to_classify/",
        "isVideo": false,
        "selftext": "It uses a lightweight embedding model and a simple classifier. I wrote up the approach and linked the repo in the comments.",
        "thumbnail": "https://b.thumbs.redditmedia.com/example-thumbnail.png"
      }
    ]
  },
  "error": null
}

Errors & retries

  • 400Fix the fields listed in errors before retrying.
  • 428Connect the requested website account using the returned sign-in link.
  • 429Wait for the duration in Retry-After.
  • 5xxRetry transient failures with backoff. Keep the request ID.

A failed run has its own error inside the response. Retry it only when error.retryable is true.

Validation, pagination and recovery →

More examples

Async request with polling
RUN=$(curl -s -X POST "https://api-ingress-worker-staging.browsable-staging.workers.dev/v1/reddit/search" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"machine learning"}')

RUN_ID=$(echo "$RUN" | jq -er '.run_id // empty') || { echo "$RUN" >&2; exit 1; }
POLL_DELAY=3

while true; do
  RESULT=$(curl -s -H "Authorization: Bearer YOUR_API_KEY" "https://api-ingress-worker-staging.browsable-staging.workers.dev/v1/runs/$RUN_ID")
  STATUS=$(echo "$RESULT" | jq -r '.run_status')
  if [[ "$STATUS" =~ ^(succeeded|failed|errored|cancelled|canceled|expired)$ ]]; then
    echo "$RESULT"
    break
  fi
  sleep "$(awk "BEGIN { print $POLL_DELAY * (0.9 + ($RANDOM % 21) / 100) }")"
  POLL_DELAY=$((POLL_DELAY < 30 ? POLL_DELAY * 2 : 30))
  [ "$POLL_DELAY" -gt 30 ] && POLL_DELAY=30
done
Wait-for-results request
curl -X POST "https://api-ingress-worker-staging.browsable-staging.workers.dev/v1/reddit/search" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"machine learning","_run":{"async":false}}'
Canonical & compatibility routes

You can also send the same JSON body to /v1/tasks/reddit-search/runs.