> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mindcase.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Threads Posts API

> Get Threads posts with post id, text, posted, author username, author name, author id, by handles or search keywords.

`POST /v1/data/threads/posts/run`

**Pricing:** $0.0025 per post ($2.50 per 1,000).

## Ways to call it

* **Handles**: set `handles` (optional: `postedAfter`, `postedBefore`, `maxResults`)
* **Search Keywords**: set `queries` (optional: `postedAfter`, `postedBefore`, `maxResults`)

## Request

Send the inputs under `params`. Only the keys below are accepted; any other key returns `422 invalid_params`.

**handles** `string[]`

One or more handles. One request reads them all.

**queries** `string[]`

One or more search keywords. One request reads them all.

**postedAfter** `date`

Posted After as a date (YYYY-MM-DD).

**postedBefore** `date`

Posted Before as a date (YYYY-MM-DD).

**maxResults** `integer` (default: 100)

How many posts to return in total. Defaults to 100; use 0 for all.

## Example

```bash cURL theme={null}
curl -X POST "https://api.mindcase.co/v1/data/threads/posts/run?wait=true" \
  -H "Authorization: Bearer $MINDCASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "params": {
    "handles": [
      "nasa"
    ],
    "maxResults": 5
  }
}'
```

```python Python theme={null}
import os, requests

r = requests.post(
    "https://api.mindcase.co/v1/data/threads/posts/run",
    params={"wait": "true"},
    headers={"Authorization": f"Bearer {os.environ['MINDCASE_API_KEY']}"},
    json={"params": {
    "handles": [
        "nasa"
    ],
    "maxResults": 5
}},
)
job = r.json()
rows = job.get("data", [])  # if job["status"] == "running", poll /v1/jobs/{job_id}/results
```

```javascript Node.js theme={null}
const r = await fetch("https://api.mindcase.co/v1/data/threads/posts/run?wait=true", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MINDCASE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ params: {
  "handles": [
    "nasa"
  ],
  "maxResults": 5
} }),
});
const job = await r.json();
const rows = job.data ?? []; // if job.status === "running", poll /v1/jobs/{job_id}/results
```

## Response fields

Each row in `data` is one post, keyed by these fields.

| Field | Name | Type |
| - | - | - |
| `postUrl` | Post URL | url |
| `postId` | Post ID | text |
| `text` | Text | text |
| `posted` | Posted | text |
| `authorUsername` | Author Username | text |
| `authorName` | Author Name | text |
| `authorId` | Author ID | text |
| `authorVerified` | Author Verified | boolean |
| `authorProfileUrl` | Author Profile URL | url |
| `likes` | Likes | number |
| `replies` | Replies | number |
| `reposts` | Reposts | number |
| `quotes` | Quotes | number |
| `shares` | Shares | number |
| `views` | Views | number |
| `likesHidden` | Likes Hidden | boolean |
| `type` | Type | text |
| `image` | Image | url |
| `videoUrl` | Video URL | url |
| `images` | Images | object\_array |
| `videos` | Videos | object\_array |
| `altText` | Alt Text | text |
| `hashtags` | Hashtags | array |
| `mentions` | Mentions | array |
| `outboundLinks` | Outbound Links | array |
| `linkPreview` | Link Preview | object |
| `language` | Language | text |
| `isReply` | Is Reply | boolean |
| `replyToUsername` | Reply To Username | text |
| `isQuote` | Is Quote | boolean |
| `quotedPost` | Quoted Post | object |
| `isRepost` | Is Repost | boolean |
| `repostedPost` | Reposted Post | object |
| `isPinned` | Is Pinned | boolean |
| `isEdited` | Is Edited | boolean |
| `paidPartnership` | Paid Partnership | boolean |
| `threadId` | Thread ID | text |
| `positionInThread` | Position In Thread | number |
| `threadLength` | Thread Length | number |
| `replyControl` | Reply Control | text |

## Example response

Abridged: long text and lists are shortened.

```json theme={null}
{
  "job_id": "7f3a1c2e-0b9d-4c55-9a51-3f2e8d1b6a40",
  "agent": "threads/posts",
  "status": "completed",
  "row_count": 1,
  "truncated": false,
  "data": [
    {
      "videos": [],
      "altText": null,
      "isQuote": false,
      "replyToUsername": null,
      "linkPreview": {
        "url": "https://l.threads.com/?u=https%3A%2F%2Fsimonwillison.net%2F2024%2FNov%2F12%2Fqwen25-coder%2F&e=AUC19R7iuyTzoyJCZ47_wW_iWXfzRF72oKOdLSKNHhqB5Equkh6c0r1et42Vvh...",
        "displayUrl": "simonwillison.net",
        "title": "Qwen2.5-Coder-32B is an LLM that can code well that runs on my Mac",
        "imageUrl": "https://external-dfw5-2.xx.fbcdn.net/emg1/v/t13/1326247003692631461?url=https%3A%2F%2Fstatic.simonwillison.net%2Fstatic%2F2024%2Fmlx-fractal.jpg&utld=simonwi...",
        "faviconUrl": "https://external-dfw5-2.xx.fbcdn.net/emg1/v/t13/11754832816296167942?url=https%3A%2F%2Fsimonwillison.net%2Ffavicon.ico&utld=simonwillison.net&_nc_sid=1d65fc&..."
      },
      "positionInThread": 0,
      "likes": 33,
      "replies": 6,
      "mentions": [],
      "threadId": "3500043734543411671",
      "quotes": 0,
      "hashtags": [],
      "image": null,
      "paidPartnership": false,
      "isPinned": false,
      "quotedPost": null,
      "posted": "2024-11-13T00:29:08.000Z",
      "reposts": 1,
      "shares": 1,
      "likesHidden": false,
      "threadLength": 2,
      "replyControl": "everyone",
      "type": "text",
      "authorUsername": "simonwillison",
      "authorId": "63066894704"
    }
  ]
}
```

## Related APIs

For profile stats use [`threads/profiles`](https://docs.mindcase.co/apis/threads/profiles).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.