Threads has an official keyword search API, but it searches only your own posts until Meta approves your app for the threads_keyword_search permission. After approval it searches public posts, up to 2,200 queries per user per rolling 24 hours, and returns no like counts. Our API returns them.
What Meta's keyword search returns
Meta's keyword search is GET graph.threads.com/v1.0/keyword_search. It takes a query q, with filters for TOP or RECENT, media type, a date range, and an exact author username, and returns up to 100 posts a call. You need the threads_basic and threads_keyword_search permissions, and queries with sensitive keywords return an empty array. If your app is approved and you need every post about you this week, search_type=RECENT with since fits better than ours.
The post fields Meta documents include text, username, permalink, timestamp, media_type and is_verified. None is a count of likes, replies or reposts; those come from the Threads Insights API, which needs threads_manage_insights and reads your own threads only. Meta's other limits, such as profile lookups, are in our Threads API overview.
Search Threads with likes and replies
We make ToolzerHub. Our Threads API searches public Threads posts and returns each post with its engagement counts, using one API key and no Meta app. Each query returns one page of about 20 posts. This script runs one search per keyword and writes the posts to CSV.
import csv
import os
import sys
import time
from datetime import datetime, timezone
import requests
URL = "https://api.toolzerhub.com/v1/threads/search"
HEADERS = {"x-api-key": os.environ["TOOLZERHUB_API_KEY"]}
FIELDS = ["query", "post_id", "username", "verified", "posted", "likes", "replies",
"reposts", "quotes", "text", "url"]
def cell(value):
# Spreadsheets run text that starts with = + - or @ as a formula; an apostrophe keeps it text.
if isinstance(value, str) and value[:1] in ("=", "+", "-", "@", "\t", "\r"):
return "'" + value
return value
def get(params, tries=5):
# 429 and 503 are retryable; the error body says how long to wait.
for attempt in range(tries):
r = requests.get(URL, headers=HEADERS, params=params, timeout=90)
if r.status_code not in (429, 503) or attempt == tries - 1:
r.raise_for_status()
return r.json()["data"]
wait = int(((r.json().get("error") or {}).get("details") or {}).get("retryAfter") or r.headers.get("Retry-After") or 5 * (attempt + 1))
time.sleep(min(wait, 60))
def row(query, post):
info = post.get("text_post_app_info") or {}
user = post["user"]
return {
"query": query,
"post_id": post["pk"],
"username": user["username"],
"verified": user.get("is_verified"),
"posted": datetime.fromtimestamp(post["taken_at"], timezone.utc).isoformat(timespec="minutes"),
"likes": post.get("like_count"),
"replies": info.get("direct_reply_count"),
"reposts": info.get("repost_count"),
"quotes": info.get("quote_count"),
"text": ((post.get("caption") or {}).get("text") or "").replace("\n", " "),
"url": f"https://www.threads.com/@{user['username']}/post/{post['code']}",
}
def main(queries, out="threads.csv"):
seen = set()
with open(out, "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=FIELDS)
writer.writeheader()
for query in queries.split(","):
data = get({"q": query})
for edge in data["edges"]:
for item in edge["node"]["thread"]["thread_items"]:
post = item["post"]
if post["pk"] not in seen:
seen.add(post["pk"])
writer.writerow({k: cell(v) for k, v in row(query, post).items()})
print(f"wrote {len(seen)} posts to {out}")
if __name__ == "__main__":
main(*sys.argv[1:])
Each result is a thread, and a thread can hold several posts by its author, so the script writes every post in it. Like counts sit on the post (like_count); replies, reposts and quotes sit in text_post_app_info. If you open the CSV in Excel, import post_id as Text: Excel keeps 15 digits of a number, and these IDs have 19.
Run the script
export TOOLZERHUB_API_KEY=your_key
python threads_search.py "notion,notion ai,notion calendar" threads.csv
It printed wrote 60 posts to threads.csv, in 27.5 seconds for three calls. The first three rows, without usernames and text:
| query | verified | likes | replies | reposts | quotes |
|---|---|---|---|---|---|
| notion | no | 114 | 1 | 14 | 0 |
| notion | yes | 1,242 | 114 | 183 | 2 |
| notion | no | 644 | 52 | 100 | 1 |
What the 60 posts looked like
- 23 posts for "notion", 20 for "notion ai" and 17 for "notion calendar".
- 13 came from verified accounts. The median post had 129 likes.
- Results are not sorted by date, and search is not limited to one language.
If you would rather run your own code, our free script covers logged-out search too: scrape Threads search with Python. Pinterest has the same gap: its v5 search reads your own pins, as covered in Pinterest API search.
What it costs
Each search call is 1 credit, so this run cost 3 credits. At about 20 posts per call, 1,000 posts is about 50 calls across different keywords, or 50 credits. The 100 free credits a month cover a first test; $19 buys 10,000 credits that never expire, and plans for higher volume cover more keywords. Set your key and the first search is a CSV in under a minute.
We are not affiliated with Meta Platforms, Inc.