# Search subreddits

Search public communities by name or topic and return normalized community cards ordered by Reddit relevance. May take up to 60 seconds.

- Platform: [Reddit](https://docs.upscrape.com/docs/platforms/reddit)
- Capability ID: `reddit.subreddit.search`
- Cost: 1 credit per request
- Maximum runtime: 60 seconds
- Execute endpoint: `POST https://data.upscrape.com/execute`

## Request

Use the exact public capability ID in the shared execute envelope.

```bash
curl --request POST \
  --url https://data.upscrape.com/execute \
  --header "Authorization: Bearer $UPSCRAPE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Prefer: wait=30" \
  --data '{
  "input": {
    "limit": 10,
    "q": "web development"
  },
  "capability": "reddit.subreddit.search"
}'
```

## Input


| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | `integer` | No | Result count (default 10). From 1 to 25. Default: `10`. |
| `q` | `string` | Yes | Community name, prefix, or topic. |

### Example input

```json
{
  "limit": 10,
  "q": "web development"
}
```

## Response

Successful output is returned in `results[0].data`.

Raw platform output is intentionally open-ended and may evolve with the upstream source.

### Illustrative sample output

This example shows one response. Values and optional fields vary with the data available.

```json
{
  "items": [
    {
      "active_users": null,
      "created_utc": null,
      "description": "A community dedicated to all things web development: both front-end and back-end. For more design-related questions, try /r/web_design.",
      "icon_url": "https://styles.redditmedia.com/t5_2qs0q/styles/communityIcon_kxcmzy9bt1381.jpg?width=64&frame=1&auto=webp&s=[redacted:token]",
      "name": "webdev",
      "nsfw": false,
      "subscribers": null,
      "title": null,
      "url": "https://www.reddit.com/r/webdev/",
      "weekly_visitors": 459900
    },
    {
      "active_users": null,
      "created_utc": null,
      "description": "Community for discussions about web development",
      "icon_url": "https://styles.redditmedia.com/t5_2qtxp/styles/communityIcon_kkm13y8xu5qg1.png?width=64&frame=1&auto=webp&s=[redacted:token]",
      "name": "webdevelopment",
      "nsfw": false,
      "subscribers": null,
      "title": null,
      "url": "https://www.reddit.com/r/webdevelopment/",
      "weekly_visitors": 9926
    },
    {
      "active_users": null,
      "created_utc": null,
      "description": "/r/frontend is a subreddit for front end web developers who want to move the web forward or want to learn how. If you're looking to find or share the latest and greatest tips, links, thoughts, and discussions on the world of front web development, this is the place to do it.",
      "icon_url": null,
      "name": "Frontend",
      "nsfw": false,
      "subscribers": null,
      "title": null,
      "url": "https://www.reddit.com/r/Frontend/",
      "weekly_visitors": 35210
    }
  ]
}
```
### Illustrative output fields

Derived from the sample above for orientation only. These fields are not a fixed response schema.

| Path | Observed type | Example |
| --- | --- | --- |
| `items` | `array` | 3 items |
| `items` | `array` | 3 items |

## Execution behavior

A `200` response completed inline. A `202` response was queued; poll `GET /jobs/{id}` until the job reaches `completed` or `failed`. Use an `Idempotency-Key` when retrying must not create a duplicate logical job.

## Related documentation

- [Authentication](https://docs.upscrape.com/docs/api/authentication)
- [Jobs and results](https://docs.upscrape.com/docs/api/jobs)
- [Errors and retries](https://docs.upscrape.com/docs/api/errors)
- [Idempotency](https://docs.upscrape.com/docs/api/idempotency)
