# Reddit Posts API

Extract Reddit posts from any subreddit, post, user, or feed — with an optional keyword search on top. Posts only (no comment tree).

**Pricing:** $0.1 / 1k results

**Endpoint:** `POST /v1/data/reddit/posts/run`

**Auth:** `Authorization: Bearer mk_live_...`

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `urls` | string | No | Reddit URL to scrape posts from. Accepts a subreddit (r/technology or the full URL), a post link, a user profile, or a listing feed. |
| `keyword` | string | No | Optional. A keyword to search Reddit posts for (e.g. 'gpt5'). Use on its own, or add it alongside the URLs above — both run together. |
| `maxResults` | integer | No | Number of posts to return. Use 0 for all. |
| `sortBy` | string | No | Sort order for posts. |
| `timeRange` | string | No | Time window for posts. Only applies when Sort By is "Top" — Reddit ignores it for the other sorts. (Preset windows only; no custom date ranges.) |

## Example

```bash
curl -X POST https://api.mindcase.co/v1/data/reddit/posts/run \
  -H "Authorization: Bearer mk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"params":{}}'
```

```python
import requests

resp = requests.post(
    "https://api.mindcase.co/v1/data/reddit/posts/run",
    headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
    json={"params": {}},
)
data = resp.json()
```

## Get the results

`run` is async and returns a `job_id`. Poll until `status` is `completed`, then read the rows:

```bash
# 1) check status
curl https://api.mindcase.co/v1/jobs/JOB_ID \
  -H "Authorization: Bearer mk_live_YOUR_API_KEY"

# 2) when status == completed, fetch the rows
curl https://api.mindcase.co/v1/jobs/JOB_ID/results \
  -H "Authorization: Bearer mk_live_YOUR_API_KEY"
```

Full API reference (auth, jobs, balance, endpoints): https://mindcase.co/skills.md

## Response columns

| Field | Display name | Type |
|-------|--------------|------|
| `type` | Type | text |
| `redditUrl` | Reddit URL | url |
| `redditId` | Reddit ID | text |
| `title` | Title | text |
| `body` | Body | text |
| `subreddit` | Subreddit | text |
| `flair` | Flair | text |
| `author` | Author | text |
| `authorFlair` | Author Flair | text |
| `upvotes` | Upvotes | number |
| `upvoteRatio` | Upvote Ratio | number |
| `commentCount` | Comment Count | number |
| `gallery` | Gallery | image |
| `externalLink` | External Link | url |
| `over18` | Over 18 | boolean |
| `posted` | Posted | text |
| `edited` | Edited | text |
