# Threads Search Scraper: Top, Recent & Tags Posts (`luzivanlt/threads-search-scraper`) Actor

Threads keyword search on the Top, Recent and Tags tabs; each reply comes with the post it answers. $1.50 per 1,000 posts. Author bio, likes, replies, media, quotes. Free view counts. No login.

- **URL**: https://apify.com/luzivanlt/threads-search-scraper.md
- **Developed by:** [Luzi](https://apify.com/luzivanlt) (community)
- **Categories:** Social media, Marketing, Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 87.2% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.05 / 1,000 posts

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Threads Search Scraper: Top, Recent & Tags Posts

Search Threads by keyword or hashtag and get every post its Top, Recent and
Tags tabs list, in one run: the text, the date, likes, replies, reposts,
quotes, images, videos and links, with the author's name, bio and badge, and
the post a reply answers or a post quotes, and view counts at no extra cost.
Paste words, hashtags, or Threads search or tag links. No Threads or
Instagram account needed.

Tested daily. Latest check: 101 posts from 3 searches, all three tabs, in about a minute.

### What does this Actor do?

You give it searches. For each one it reads the tab you pick on Threads'
search page (Top, Recent or Tags) or all three, and saves one row per post,
in Threads' own order.

A search result on Threads can be a reply: Threads shows it under the post it
answers. The row is the reply, and the post it answers comes with it in
`parent_post`.

Each post comes with:

- its text, link and date, its language, and whether it was edited
- its likes, replies, reposts, quotes and shares
- whether it is text, an image, a video or a carousel, with the image and
  video links
- the link it shares, the links, accounts and stickers in its text, its topic
  tag and its song, when it has them
- the post it answers (for a reply) and the post it quotes, each with its own
  text, date, counts, media and author
- who can reply to it, its AI label, and whether it is a spoiler, a ghost
  post or a paid partnership
- the author's username, name, ids, profile link, bio, picture, and whether
  the account is verified or private
- the search, the tab and its place in the results
- its view count, with **Include view counts** on (no extra charge)

### Why use it?

- **Every tab in one run.** Top, Recent and Tags list different posts; pick
  **All three** and a post found in two tabs is saved and charged once.
- **Replies with their context.** A reply that matched your search comes with
  the post it answers, so you can read it in context.
- **Track a keyword, a brand or a hashtag.** Run it daily with **Only new
  posts** on to get only what is new since the last run.
- **Use the data anywhere.** Download as JSON, CSV or Excel, or send it to
  your own tools through Apify's API and integrations.

### How to use it

1. Type one or more searches into **Searches**: words such as `nasa`, a
   hashtag such as `#coffee`, or a link copied from Threads' search page or a
   tag page.
2. Pick the **Tab**: Top, Recent, Tags or All three.
3. Optionally set **Only posts newer than** and **Max posts per search**.
4. Click **Start**, then download the posts from the **Output** tab.

### Input

```json
{
  "searchQueries": ["nasa", "#coffee"],
  "searchTab": "all",
  "maxPostsPerSearch": 100,
  "onlyPostsNewerThan": "7 days"
}
```

- **Searches** (`searchQueries`): words, a #hashtag, a Threads search link
  (`https://www.threads.com/search?q=…`) or a Threads tag link
  (`https://www.threads.com/tag/…`). A search link on the Recent or Tags tab
  keeps its own tab; a tag link is searched as its #hashtag, on the **Tab**
  you pick.
- **Tab** (`searchTab`): `top` (default), `recent`, `tags` or `all`.
- **Max posts per search** (`maxPostsPerSearch`): from 1 to 1,000, 100 by
  default. Expect about 17 to 19 posts per tab, about 35 to 60 with **All
  three**: see *Good to know*.
- **Only posts newer than** (`onlyPostsNewerThan`): a date (YYYY-MM-DD, UTC)
  or a period such as `7 days`. It filters what Threads lists.
- **Include view counts** (`includeViewCounts`): see below.
- **Only new posts** (`onlyNewItems`): see below.

### View counts

Turn on **Include view counts** (`includeViewCounts`) to also read each post's
own page for its exact view count, `view_count`. One more page per post, so a
run takes longer (about 3 to 4 seconds more per post), but it costs nothing
extra: each post is charged as a post, at the same price. A post minutes old often has none yet (about 1 post in 5 in our tests); it is still saved, with `view_count` empty. It cannot be combined with **Only new posts**.

### New items only

Turn on **Only new posts** (`onlyNewItems`) for a scheduled run, or a re-run
of the same task. Each run then returns only the posts it has not returned
before for each search. Skipped posts are neither saved nor charged; each new
post is charged as usual.

- Runs with other settings, or from another task, keep their own list.
- Each run reads the whole list a search shows again, so a post past **Max
  posts per search** in one run can come back in the next.
- The list lives in your Apify account, in a key-value store named
  `threads-search-scraper-monitor`. Delete it to start afresh.

### Output

One row per post. An example, with made-up values:

```json
{
  "post_id": "3200000000000000001",
  "post_code": "DAbCdEfGhIj",
  "post_fbid": "17900000000000001",
  "url": "https://www.threads.com/@example.fan/post/DAbCdEfGhIj",
  "text": "Watching the launch tonight with the whole family",
  "attachment_text": null,
  "posted_at": "2026-11-05T21:14:06.000Z",
  "is_edited": false,
  "language": "en",
  "like_count": 214,
  "reply_count": 9,
  "repost_count": 3,
  "quote_count": 1,
  "reshare_count": null,
  "view_count": null,
  "like_counts_hidden": false,
  "media_type": "image",
  "image_urls": ["https://…/1.jpg"],
  "video_urls": [],
  "video_cover_url": null,
  "image_alt_texts": ["A rocket on a launch pad at night"],
  "has_gif": false,
  "gif_url": null,
  "gif_description": null,
  "media_width": 1080,
  "media_height": 1350,
  "has_audio": null,
  "link_url": null,
  "link_title": null,
  "link_image_url": null,
  "link_favicon_url": null,
  "text_links": [],
  "mentioned_users": [],
  "hashtags": [],
  "sticker_urls": [],
  "topic": "Space",
  "topic_id": "1234",
  "topic_is_community": false,
  "music_title": null,
  "music_artist": null,
  "music_song_id": null,
  "music_audio_id": null,
  "reply_control": "everyone",
  "ai_detection_method": "NONE",
  "is_spoiler": false,
  "is_ghost_post": false,
  "is_paid_partnership": null,
  "is_reply": true,
  "reply_to_username": "example.news",
  "reply_to_user_id": "63000000001",
  "parent_post_url": "https://www.threads.com/@example.news/post/DZyXwVuTsRq",
  "parent_post": {
    "post_id": "3199999999999999999",
    "text": "Launch window opens at 9 pm tonight",
    "posted_at": "2026-11-05T18:02:44.000Z",
    "like_count": 1830,
    "author_username": "example.news"
  },
  "root_post_author_username": "example.news",
  "root_post_author_id": "63000000001",
  "is_liked_by_root_author": false,
  "quoted_post_url": null,
  "quoted_post": null,
  "thread_id": "3199999999999999999",
  "self_thread_count": 0,
  "author_username": "example.fan",
  "author_full_name": "Example Fan",
  "author_id": "63000000002",
  "author_fbid": "17841400000000002",
  "author_url": "https://www.threads.com/@example.fan",
  "author_is_verified": false,
  "author_is_private": false,
  "author_biography": "Space nerd. Coffee first.",
  "author_profile_pic_url": "https://…/pic.jpg",
  "author_is_meta_ai_bot": false,
  "search_query": "rocket launch",
  "search_tab": "top",
  "search_rank": 3,
  "source_url": "https://www.threads.com/search?q=rocket%20launch&serp_type=default"
}
```

| Field                       | What it holds                                                                                                                 |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `post_id`                   | Threads' id for the post                                                                                                      |
| `post_code`                 | The short code in the post's link                                                                                             |
| `post_fbid`                 | Meta's other id for the post                                                                                                  |
| `url`                       | The post's page                                                                                                               |
| `text`                      | The post's text. `null` for a post with only media                                                                            |
| `attachment_text`           | The text attachment under the post (the long text Threads shows collapsed), when it has one                                   |
| `posted_at`                 | When it was posted (UTC, ISO 8601)                                                                                            |
| `is_edited`                 | `true` when the author edited the text                                                                                        |
| `language`                  | The language Threads detected for the text, as a code such as `en`                                                            |
| `like_count`                | Likes                                                                                                                         |
| `reply_count`               | Direct replies                                                                                                                |
| `repost_count`              | Reposts                                                                                                                       |
| `quote_count`               | Quotes                                                                                                                        |
| `reshare_count`             | Shares (Threads leaves it out on some posts)                                                                                  |
| `view_count`                | With **Include view counts** on: the post's views, exact. Empty when Threads shows none, and always empty with the option off |
| `like_counts_hidden`        | `true` when the author hid the post's like count                                                                              |
| `media_type`                | `text`, `image`, `video` or `carousel`                                                                                        |
| `image_urls`                | The post's images (for a carousel, one per slide; a video's cover image too)                                                  |
| `video_urls`                | The post's videos                                                                                                             |
| `video_cover_url`           | A video's cover image, when the post has a video                                                                              |
| `image_alt_texts`           | The image descriptions Threads gives the post's images, when it has them                                                      |
| `has_gif`                   | `true` when the post is a GIF                                                                                                 |
| `gif_url`                   | The GIF's link, when the search shows it (often empty: Threads shows a stand-in)                                              |
| `gif_description`           | The GIF's description, when the search shows it (often empty)                                                                 |
| `media_width`               | The width of the post's image or video in pixels. `null` for a text post                                                      |
| `media_height`              | Its height in pixels                                                                                                          |
| `has_audio`                 | For a video, whether it has sound; `null` for a post with no video                                                            |
| `link_url`                  | The web link the post shares, when it has one                                                                                 |
| `link_title`                | The title of that link's preview card                                                                                         |
| `link_image_url`            | The image of that link's preview card                                                                                         |
| `link_favicon_url`          | The site icon on that link's preview card                                                                                     |
| `text_links`                | Web links written in the post's text                                                                                          |
| `mentioned_users`           | The accounts the text names: `username`, `id` and `profile_pic_url` for each                                                  |
| `hashtags`                  | The #tags written in the text, without the `#`, each once, when it has them                                                   |
| `sticker_urls`              | The stickers placed in the text                                                                                               |
| `topic`                     | The post's topic tag, when it has one                                                                                         |
| `topic_id`                  | Threads' id for the topic tag                                                                                                 |
| `topic_is_community`        | `true` when that topic is a Threads community                                                                                 |
| `music_title`               | The song on the post, when it has one                                                                                         |
| `music_artist`              | The song's artist                                                                                                             |
| `music_song_id`             | Threads' id for that song                                                                                                     |
| `music_audio_id`            | Threads' id for that song's audio                                                                                             |
| `reply_control`             | Who may reply, as Threads names it (for example `everyone`)                                                                   |
| `ai_detection_method`       | Threads' AI-content label for the post; `NONE` when it has none                                                               |
| `is_spoiler`                | `true` when the post's media is marked as a spoiler                                                                           |
| `is_ghost_post`             | `true` for a ghost post (one set to disappear)                                                                                |
| `is_paid_partnership`       | `true` when the post is marked as a paid partnership                                                                          |
| `is_reply`                  | `true` when the post answers another post                                                                                     |
| `reply_to_username`         | The account the post answers                                                                                                  |
| `reply_to_user_id`          | That account's id                                                                                                             |
| `parent_post_url`           | The post this one answers, when it is a reply                                                                                 |
| `parent_post`               | That post's own facts: the same names as the row's first fields (text, date, counts, media, author)                           |
| `root_post_author_username` | Who started the thread a reply sits in                                                                                        |
| `root_post_author_id`       | Their id                                                                                                                      |
| `is_liked_by_root_author`   | `true` when the person who started the thread liked this post                                                                 |
| `quoted_post_url`           | The post this one quotes                                                                                                      |
| `quoted_post`               | The quoted post's own facts, the same names as `parent_post`                                                                  |
| `thread_id`                 | The id of the thread the post sits in                                                                                         |
| `self_thread_count`         | How many follow-ups the author added under the post                                                                           |
| `author_username`           | The author's username                                                                                                         |
| `author_full_name`          | The author's display name                                                                                                     |
| `author_id`                 | Threads' id for the author                                                                                                    |
| `author_fbid`               | Meta's other id for the author                                                                                                |
| `author_url`                | The author's profile page                                                                                                     |
| `author_is_verified`        | `true` when the author has the verified badge                                                                                 |
| `author_is_private`         | `true` when the author's profile is private                                                                                   |
| `author_biography`          | The author's bio                                                                                                              |
| `author_profile_pic_url`    | The author's profile picture                                                                                                  |
| `author_is_meta_ai_bot`     | `true` when the author is a Meta AI account                                                                                   |
| `search_query`              | The search that found the post, as you typed it (or the `q` of your link)                                                     |
| `search_tab`                | The tab it was found on: `top`, `recent` or `tags`                                                                            |
| `search_rank`               | Its place in that tab's list, from 1                                                                                          |
| `source_url`                | The Threads search page of that search and tab                                                                                |

Not included: the follower counts of authors, polls, and the lyrics of a
post's song.

### How much does it cost?

No surcharges and no paid options; an item that fails is not charged.

You pay for what you get:

- **$2.50 per 1,000 posts** ($0.0025 a post). Each post is charged once per run.
- View counts are included at no extra cost: with **Include view counts** on,
  each post costs the same.
- No start fee, and nothing per search.

So 3 searches with all three tabs, about 100 posts in our test, cost about $0.25. If you
set a maximum cost for a run, the Actor stops when it reaches it and keeps
every post saved so far.

### How long does a run take?

About 20 seconds per search with all three tabs: 3 searches took about a minute in our test, so 10 take about 3 to 4 minutes. With **Include view counts** on, each post's page is read too, about 3 to 4 seconds more per post.

### Good to know

- **Threads lists one page per tab to a visitor.** A search gives about 17
  to 19 posts on each tab (Recent often fewer), so about 35 to 60 with **All
  three**, whatever **Max posts per search** says. Pick **All three** for the
  most posts from a search. Tried: asking for more per page, asking past the end and a fresh session; each gave the same page. To get more posts on a topic, add more
  searches (other words, the hashtag, a phrase).
- **The tabs list different posts.** Recent lists the newest, often fewer than
  20; Top and Tags overlap a little. A post found twice is saved once.
- **Only posts newer than filters; it does not go back further.** Threads'
  search does not offer older posts to a visitor.
- **Check your input first.** A link that is not a Threads search or tag link
  (a profile or a post, for example) stops the run before anything is read,
  and the message names it.
- **A search with nothing found is not an error.** It saves nothing and the
  run's report says so.
- **Counts move.** Likes, replies and views are the numbers at the moment the
  post was read.

### More Actors from us

- [Threads Posts Scraper: A Profile's Whole Post History](https://apify.com/luzivanlt/threads-posts-scraper): A Threads profile's whole post history, back to its very first post, newest first.
- [Threads Replies Scraper: Every Page of Replies](https://apify.com/luzivanlt/threads-replies-scraper): Replies to Threads posts, newest first, page after page: 1,800 from one post in a test, nested replies too.
- [2GIS Places Scraper: Every Result, Contacts](https://apify.com/luzivanlt/2gis-places-scraper): Every place a 2GIS search lists, read to 2GIS's own count, with phones, emails, sites and socials included.
- [Airbnb Scraper: Every Stay, Past the 15-Page Limit](https://apify.com/luzivanlt/airbnb-listings-scraper): Every stay of an Airbnb search, past the 15 pages Airbnb shows, checked against its count.
- [Alibaba Products Scraper: Price Tiers & Suppliers](https://apify.com/luzivanlt/alibaba-products-scraper): Alibaba.com products by keyword or link: USD price tiers, MOQ, supplier, product pages at no extra cost.
- [AliExpress Product Scraper: Search Results & Prices](https://apify.com/luzivanlt/aliexpress-products-scraper): Every product of an AliExpress search to its last page, with exact sold counts and ratings.
- [Amazon Product Scraper: Search Results & Prices](https://apify.com/luzivanlt/amazon-products-scraper): Every product on Amazon's search pages to the last page, sponsored marked, with monthly sales.
- [App Store Reviews Scraper: All Reviews, Not 500](https://apify.com/luzivanlt/app-store-reviews-scraper): Every written App Store review of an app, not just the newest 500.

### Use it from an AI agent or the API

One call starts a run and returns its items (Apify waits up to 300 seconds; for a
longer run, start it with `POST /v2/acts/…/runs` and read its dataset):

```text
POST https://api.apify.com/v2/acts/luzivanlt~threads-search-scraper/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>
```

With the sample input as its JSON body:

```json
{
  "searchQueries": ["nasa"],
  "searchTab": "top",
  "maxPostsPerSearch": 20
}
```

Its inputs, in the order of the input form:

| Input                                        | What it takes                                                                                                                                                                                       | Default |
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `searchQueries` (Searches)                   | What to search Threads for, one search per line: words, a #hashtag, a Threads search link (https://www.threads.com/search?q=…) or a Threads tag link (https://www.threads.com/tag/…).               | —       |
| `searchTab` (Tab)                            | Which of Threads' search tabs to read: Top (the most relevant posts), Recent (the newest posts), Tags (posts filed under the topic of that name) or All three, a post found in two tabs saved once. | `"top"` |
| `maxPostsPerSearch` (Max posts per search)   | Stop each search after this many posts, from 1 to 1,000 (100 by default).                                                                                                                           | `100`   |
| `onlyPostsNewerThan` (Only posts newer than) | Keep only posts from this date on: a date (YYYY-MM-DD, UTC) or a period such as "7 days", "2 weeks" or "3 months".                                                                                  | —       |
| `includeViewCounts` (Include view counts)    | Also read each post's own page for its view count: the exact number, where Threads shows one (a post minutes old often has none yet).                                                               | —       |
| `onlyNewItems` (Only new posts)              | Turn this on for a scheduled run, or a re-run of the same task: each run then returns only the posts it has not returned before for each search, so you can track a keyword over time.              | —       |

Apify's MCP server, `https://mcp.apify.com`, lists it as `luzivanlt/threads-search-scraper`. To give an
AI agent this Actor as a tool, add the server to the agent's MCP config:

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=luzivanlt/threads-search-scraper"
    }
  }
}
```

The client signs in with OAuth, or add `"headers": { "Authorization": "Bearer <APIFY_TOKEN>" }`.

Charged per post delivered; the sample input above costs at most $0.05.

### FAQ

**Do I need a Threads or Instagram account?**
No. The Actor reads what anyone can see on Threads' search page.

**Can I get more than about 20 posts for one search and tab?**
Not for one search: that is the page Threads lists. Pick **All three** tabs
(about 35 to 60 posts a search), and add related searches to get more posts
on a topic.

**Can I filter by author?**
Not yet. To read one account's posts, use the Threads Posts Scraper under
More Actors from us.

**Does it read the replies to each post?**
No, only the posts the search lists (a reply comes with the post it answers).
The Threads Replies Scraper, under More Actors from us, reads a post's replies.

**Can I run it from my own code, on a schedule, or with other apps?**
Yes. Like any Apify Actor, you can start it through the Apify API, run it on a
schedule, and connect it to other apps with Apify's integrations and webhooks.

### Is it legal to scrape Threads?

This Actor reads only public posts that anyone can see. Posts and profiles
hold personal data, such as names, ids, bios and pictures: check Meta's terms
and the laws that apply to you (such as the GDPR) before you use the data. If
you are unsure, ask a lawyer.

### Support

Found a problem or missing a feature? Open an issue on the **Issues** tab and
we will look into it.

***

This Actor is not affiliated with, endorsed by or sponsored by Threads, Meta
or Instagram.

# Changelog

This Actor's version history is a separate document: https://apify.com/luzivanlt/threads-search-scraper/changelog.md

# Actor input Schema

## `searchQueries` (type: `array`):

What to search Threads for, one search per line: words, a #hashtag, a Threads search link (https://www.threads.com/search?q=…) or a Threads tag link (https://www.threads.com/tag/…). Each search gives you the posts Threads lists for it. A search link that is on the Recent or Tags tab keeps its own tab; a tag link is searched as its #hashtag, on the Tab below. Up to 200 characters each. Example: nasa

## `searchTab` (type: `string`):

Which of Threads' search tabs to read: Top (the most relevant posts), Recent (the newest posts), Tags (posts filed under the topic of that name) or All three, a post found in two tabs saved once. Default Top. Example: "all" for every post the three tabs list.

## `maxPostsPerSearch` (type: `integer`):

Stop each search after this many posts, from 1 to 1,000 (100 by default). Expect about 17 to 19 posts per tab: that is all Threads lists for one search (Recent often fewer). A search on All three tabs gives the most, about 35 to 60. For more posts on a topic, add more searches. You pay $0.0025 a post saved, so 100 posts cost at most $0.25. A post found by two searches is charged once.

## `onlyPostsNewerThan` (type: `string`):

Keep only posts from this date on: a date (YYYY-MM-DD, UTC) or a period such as "7 days", "2 weeks" or "3 months". Leave empty to keep every post a search lists. It filters what Threads lists; it does not make a search go further back. A date in the future is refused. Example: 7 days

## `includeViewCounts` (type: `boolean`):

Also read each post's own page for its view count: the exact number, where Threads shows one (a post minutes old often has none yet). No extra charge: each post still costs $0.0025. One more page per post, so a run takes longer, about 3 to 4 seconds more per post. A post whose count is not shown is still saved, with no view count. Cannot be combined with Only new posts. Off by default.

## `onlyNewItems` (type: `boolean`):

Turn this on for a scheduled run, or a re-run of the same task: each run then returns only the posts it has not returned before for each search, so you can track a keyword over time. Skipped posts are neither saved nor charged; each new post is charged as usual. Runs with other settings, or from another task, keep their own list. Off by default.

## Actor input object example

```json
{
  "searchQueries": [
    "nasa"
  ],
  "searchTab": "top",
  "maxPostsPerSearch": 20
}
```

# Actor output Schema

## `posts` (type: `string`):

Every post the run saved, one row per post.

## `allFields` (type: `string`):

The same rows with every field.

## `runReport` (type: `string`):

What happened to each input: items saved, nothing found, refused by the site, stopped at your limit, or the error.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchQueries": [
        "nasa"
    ],
    "maxPostsPerSearch": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("luzivanlt/threads-search-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchQueries": ["nasa"],
    "maxPostsPerSearch": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("luzivanlt/threads-search-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchQueries": [
    "nasa"
  ],
  "maxPostsPerSearch": 20
}' |
apify call luzivanlt/threads-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,luzivanlt/threads-search-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/xqr7QEL6ULXeGcaOs/builds/glUpMLvYOemZYMQFS/openapi.json
