Social media4 min readBy Purrkey teamUpdated

How to search X communities by keyword

Find X communities by keyword and get IDs, names, topics, member counts, and URLs for follow-up reads

On this page

You have three AI keywords to map on X before planning a campaign, and you need the communities behind each one with their IDs, names, topics, member counts and URLs, cut down to a shortlist for a closer read. anyapi.twitter.search_communities matches a keyword against community names and topics and returns a page of summary records

The worksheet below is the deliverable. No call has been run for this article, so each value in the tables is a placeholder that shows the shape rather than a result

Example input and the shortlist table

The input is a keyword in query. Example: generative ai. Run the three keywords as three separate calls, one keyword per call, so each row can be traced back to the query that produced it

idnametopicmemberCountnsfwurlshortlist
(id from the response)(community name)(topic label, may be empty)(integer)true or false(canonical community URL)yes, review or no

Values here are placeholders showing the shape

Step 1: send one keyword per call

query is required, with a minimum length of 1, and it is the keyword matched against community names and topics. cursor is optional. Leave it out for the first page and use it only to continue an existing lane

Agents call it through POST /v1/runs with toolId anyapi.twitter.search_communities. A response holds one page, so plan the run around pages rather than expecting one call to return the full list of matching communities

Step 2: page with the cursor

The pagination limit sits in this step. Each response carries nextCursor. Omit cursor on the first call, then pass the opaque nextCursor value back as cursor to fetch the next page. When nextCursor is null, the contract says that lane has no more, and the loop stops. Do not edit or rebuild the cursor string

Two pages per keyword is six calls for the plan. Stop a keyword's lane at the second page unless the shortlist is still thin

Reading the output that drives the shortlist

found is true when the search returned at least one community and false when nothing matched. On a false result, reason is present with the value not_found and data is null; the contract calls that a successful call rather than an error, and reason appears only in that case

On a true result, data.communities holds the page and data.nextCursor carries the continuation. Each community record has id, name, url, memberCount, topic and nsfw. The contract marks id, name and url as populated whenever the provider has data for the entity. topic may be empty, so a blank topic on its own does not mean the match failed. memberCount is the number of members; the record carries no field for posting activity, so treat the count as a size signal and open the community itself to judge how busy it is

url is the field to keep for the deeper read

The agent prompt

Agent prompt
Set up https://purrkey.app/SKILL.md, then use Purrkey to search X
communities for three AI keywords. Check the current inputs and price of
anyapi.twitter.search_communities before running anything. Call it once
per keyword for the first page, then call it again with the nextCursor
from the previous response when nextCursor is not null, up to two pages
per keyword. Return a table with the keyword, id, name, topic,
memberCount, nsfw, url and a shortlist column marked yes, review or no.
Leave topic empty when the response is empty. Do not invent URLs or
community names. Report how many calls you used.

Example keyword: generative ai

Estimated tool cost

Prices read through the Purrkey catalog on November 13, 2026. The unit is max_call, which the catalog defines as "Maximum per call. Successful runs settle at the actual AnyAPI charge", so each total below is a ceiling rather than a settled charge

StepFormulaUnit pricePlanned quantityTotal
One keyword, first pagecalls x max price$0.0011 per call1$0.0011
Three keywords, two pages eachcalls x max price$0.0011 per call6$0.0066

The three-keyword plan with two pages per keyword is six calls. Agent model fees are not counted

Run the first keyword

Open the community search tool page, confirm the current price, and send the first page for one keyword before spending six calls

Get started by giving this to your agent

  • Claude Code
  • Codex
  • Gemini CLI
  • Cursor
  • GitHub Copilot
Set up https://purrkey.app/SKILL.md, then use Purrkey to show me what I can do with X (Twitter).
Explore X (Twitter) tools and pricing

FAQ

How do I search X communities by keyword?

Call anyapi.twitter.search_communities with the keyword in query and leave cursor out for the first page. Each response returns a page of communities with id, name, topic, memberCount, nsfw and url.

What inputs does anyapi.twitter.search_communities take?

query is required, with a minimum length of 1, and it is the keyword matched against community names and topics. cursor is optional and takes the nextCursor value from a prior response.

How do I get the next page of X community results?

Pass the opaque nextCursor string from a prior response back as cursor. A null nextCursor means that lane has no more pages, and the loop stops there.

What does found false mean in the community search output?

It means nothing matched. reason is then present with the value not_found and data is null, and the contract calls that a successful call rather than an error.

How much does it cost to search three keywords with two pages each?

At most $0.0066, which is six calls at up to $0.0011 per call. One keyword on its first page is one call at up to $0.0011.

What do memberCount and nsfw tell me about a community?

memberCount is the number of members in the community and nsfw is a boolean flag for not safe for work. The community record carries no field for posting activity.

Next step

Try this with X (Twitter)

The tool directory lists every endpoint with its current price. Inspect the inputs there, then let your agent run a small batch before scaling up.

See X (Twitter) tools

Share this article