How to search Threads posts by keyword in Python

Checked on 2026-11-24.

Meta's Threads API has a keyword search, GET /keyword_search, but until Meta approves your app for the threads_keyword_search permission it searches only your own posts. Meta grants that permission to business apps that help their users manage their social media presence, and prohibits it in consumer apps. Without that approval, the way to search public posts from Python is a service that reads Threads' own search.

1. The official endpoint: /keyword_search

The keyword search documentation describes one GET endpoint for keywords and topic tags. In Python, after the curl example there:

Python
import os
import requests

res = requests.get(
    "https://graph.threads.com/v1.0/keyword_search",
    params={
        "q": "coffee",
        "search_type": "RECENT",   # TOP is the default
        "fields": "id,text,media_type,permalink,timestamp,username,has_replies,is_quote_post,is_reply",
        "limit": 50,
        "access_token": os.environ["THREADS_ACCESS_TOKEN"],   # a Threads user access token
    },
    timeout=30,
)
res.raise_for_status()
for post in res.json()["data"]:
    print(post["timestamp"], post["username"], post.get("text"), post["permalink"])
  • q (required): "The keyword(s) to be queried."
  • search_type: TOP (the default) "Returns the most popular search results"; RECENT "Returns the most recent search results".
  • search_mode: KEYWORD (the default), or TAG to search a topic tag.
  • media_type: TEXT, IMAGE or VIDEO; without it every type is returned.
  • since and until: a Unix timestamp or a date such as 2026-01-01. since "Must be on or after 1688540400", and until may be "no later than the current time".
  • limit: "The default is 25 and the maximum is 100."
  • author_username: only posts by that account, "an exact match without the @ symbol".

The permission, and what Meta approves it for

Every call needs threads_basic, and this one also threads_keyword_search. The documentation says what approval changes: "If your app has not been approved for the threads_keyword_search permission, the search is performed only on posts owned by the authenticated user. After approval, public posts are searchable."

Meta's permissions reference says what it approves the permission for. It "allows a business app to search and fetch content with a specific keyword on behalf of a Threads user", and: "The allowed usage for this permission is to help the user manage their social media presence. It is not intended for any other purpose. For example, using threads_keyword_search permission in a consumer app is strictly prohibited." The allowed usages it lists are showing public content that a business app user searches by keyword, letting the user sort their own mentioned threads, and letting the user publish responses to what they find.

The review asks for a use case description and a screencast that shows the Threads login with the permission being granted, the linking of a Threads account, a keyword search for public content, and a post's result in your app and in the Threads app. The get-started guide adds that for people without a role on your app, "each permission must first be approved through the App Review process, and your app must be published". Until then, Threads testers you invite can use the app, and their searches cover their own posts.

Where it stops: at the purpose. If what you build is not a tool that helps its users manage their presence on Threads, such as a research script or a data pipeline, it is outside the usage the permission's description allows.

Limits of the official search

  • "A user can send a maximum of 2,200 queries within a rolling 24-hour period." The limit belongs to the user across all apps, a repeated query counts again, and "Queries which return no results do not count against this limit".
  • "The API returns an empty array for any requests that include keywords that Threads has deemed sensitive or offensive."
  • No counts on the results: the fields a post can return include no like, reply, repost or view count, and for search "The owner field is excluded and is not returned."
  • A short-lived token lasts 1 hour and a long-lived one 60 days. A grant from a user with a public profile is valid for 90 days and is extended when you refresh the token.

2. Without a Meta app: an HTTP API

The Pipefetch search endpoint returns the posts Threads' own search shows a visitor who is not logged in, so there is no Meta app, token or review.

Python
import os
import requests

res = requests.get(
    "https://pipefetch.com/v1/threads/search",
    params={"q": "coffee", "sort": "recent", "limit": 20},   # sort: top (default) or recent
    headers={"x-api-key": os.environ["PIPEFETCH_API_KEY"]},
    timeout=90,
)
if res.status_code == 404:
    print("No posts found for this term")  # not charged
else:
    res.raise_for_status()
    for post in res.json()["data"]["posts"]:
        if post["isReply"]:
            continue   # replies are included; skip them to keep top-level posts only
        print(post["publishedAt"], post["likeCount"], post["replyCount"], post["repostCount"], post["text"][:80])
        print("   ", post["url"])

Each post has its text, link, publish time and detected language, its exact like, reply, repost and quote counts, and its author: username, name, verified flag, picture and profile address. It also carries image and video addresses, the topic, hashtags, mentions and links, and for a reply the post it answers. sort=recent starts with the last 24 hours, goes further back only when they do not hold enough posts, and returns the posts newest first. A search costs 1 credit, and most take 2 to 9 seconds. A search that finds nothing answers 404 and costs nothing, and a new account has 100 free credits and needs no card.

Where it stops:

  • Up to 20 posts per search, and no further pages. There is no date window, no author filter, no media filter and no topic-tag mode.
  • Threads matches terms of several words loosely, so only posts in which every word of the term appears (in the text, the topic, a link title or the author's name) are returned. A search can return fewer posts than you asked for.
  • Replies are included and marked with isReply: in the answer saved for "coffee", 6 of the 10 posts were replies.
  • Authors come without follower counts; the profile endpoint has those.
  • It is not the official API, and Pipefetch is not affiliated with Threads or Meta.

Which one should you use?

You wantUse
A tool that helps its users manage their Threads presence, and you can pass App ReviewThe official keyword search
Up to 100 results per query, date windows, topic tags, a search within one accountThe official keyword search, after approval
Like, reply and repost counts on the posts a search findsAn HTTP API such as Pipefetch
A search from a script, for research or monitoring, without a Meta appAn HTTP API such as Pipefetch

Profiles, and the posts people write

To read one account's profile and latest posts rather than search, the guide Threads API: can you read someone else's posts? covers Meta's profile discovery endpoints and their review. Whichever route you use, a post comes with its author's username and name, which is personal data when the author is a person, under laws such as the GDPR. Keep only what your purpose needs. Pipefetch's terms forbid using the API to harass people or to build profiles of private individuals.

Try it with 100 free credits. No card needed. No scraper to build or maintain. Get an API key or read the docs.

Every source

YouTube

Instagram

Websites

TikTok

Facebook

Google

LinkedIn

App stores

Steam

X

Pinterest

Airbnb

Real estate

Keywords

Job boards

Eventbrite

Shopify stores

Public tenders

All guides