Search
Filters for agents
The controls other search APIs do not have. Cut by popularity, steer by site, keep kinds of page and topics, and read what each result says about its site.
Copy as MarkdownOpen in ChatGPT (opens in a new tab)Open in Claude (opens in a new tab)
An agent that can only type a query gets what everyone gets. These filters let it say what kind of web it wants. All of them are fields of POST /v1/search, all of them are free, and they combine.
| Filter | Field | What it does |
|---|---|---|
| Remove the top sites | remove_top_sites | Drops results from the N most popular sites, N from 0 to 1,000,000 |
| Only the top sites | only_top_sites | Keeps only results from the N most popular sites |
| Popularity buckets | popularity_buckets | Keeps sites in the bands you name, from top-100 to long-tail |
| Boost | boost_domains, boost_page_types, boost_topics | Moves named sites, kinds of page or topics ahead of the rest |
| Bury | bury_domains, bury_page_types, bury_topics | Moves them to the end |
| Block | exclude_domains, exclude_page_types, exclude_topics | Removes them |
| Only | include_domains, page_types, topics | Keeps them and nothing else |
| Topics | topics and the three lists above | 24 topics |
| Page types | page_types and the three lists above | 23 kinds of page: forums, tutorials, documentation, reviews and so on |
| Traffic trends | traffic_trend | Keeps sites whose visits are rising, spiking, falling and so on; on every result too |
| Popular where | popular_in | Keeps sites that are popular in the countries you name; on every result too |
| Site tech | site_tech | Keeps sites built with what you name; on every result too |
| Risk | exclude_risky | Drops results whose site carries a risk label; the label is on every result |
| Popularity | on every result | The rank and band of the result's site |
| Dates | start_date, end_date, time_range | Results published in a range, on the sources that carry dates |
| Language and country | language, country | Results in a language, or from a country, on the sources that can tell; two-letter codes |
| SafeSearch | safe_search | off, moderate or strict |
Over MCP, the search tool takes the same fields under the same names.
A set of these filters can be saved under a name and used with one field, space. That is Spaces.
Agent recipes
Each recipe is one request. Copy it, change the query, and give it to your agent as an example of what it can ask for.
Long-tail forum discussions on a topic, with no product pages
Keep forum and comment pages, on one topic, from outside the 10,000 most popular sites. Shops and product pages are not among the kinds kept, so they are gone.
curl https://api.millionshort.com/v1/search \
-H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "sourdough starter",
"page_types": ["forums", "comments"],
"topics": ["food"],
"remove_top_sites": 10000,
"num_results": 10
}'import os
from millionshort import MillionShort
client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"])
r = client.search(
"sourdough starter",
page_types=["forums", "comments"],
topics=["food"],
remove_top_sites=10000,
num_results=10,
)
for hit in r.results:
print(hit["page_type"], hit["topic"], hit["popularity"]["bucket"], hit["url"])import { MillionShort } from 'millionshort';
const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY });
const r = await client.search('sourdough starter', {
pageTypes: ['forums', 'comments'],
topics: ['food'],
removeTopSites: 10000,
numResults: 10,
});
for (const hit of r.results) {
console.log(hit.page_type, hit.topic, hit.popularity.bucket, hit.url);
}The same call as a tool of the MCP server:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "search",
"arguments": {
"query": "sourdough starter",
"page_types": [
"forums",
"comments"
],
"topics": [
"food"
],
"remove_top_sites": 10000,
"num_results": 10
}
}
}What comes back, cut to one result (the values are an illustration):
{
"data": {
"results": [
{
"title": "Starter sluggish after a week in the fridge",
"url": "https://forum.example.org/t/starter-sluggish/4821",
"site": "forum.example.org",
"source": "web",
"snippet": "Mine does the same every winter. Two feeds at room temperature and it is back...",
"highlights": ["Mine does the same every winter. Two feeds at room temperature and it is back..."],
"published_date": null,
"page_type": "comments",
"topic": "food",
"popularity": { "rank": 412907, "bucket": "top-1m" },
"risk": null,
"position": 1,
"score": 1.0,
"extra": {}
}
],
"summary": {
"returned": 10,
"removed": { "popularity": 0, "blocked": 0, "duplicates": 1, "risk": 0, "safe_search": 0 }
},
"warnings": []
},
"usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "search": 1 } },
"warnings": [],
"request_id": "req_..."
}The mainstream view and the independent view, side by side
Two requests with the same query: only_top_sites: 1000, then remove_top_sites: 1000. The agent reads both and reports where they differ. Two credits.
Tutorials and documentation only, from sources you trust first
curl https://api.millionshort.com/v1/search \
-H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "rate limiting with a token bucket",
"page_types": ["tutorials", "documentation"],
"topics": ["programming", "software"],
"boost_domains": ["docs.example.com"],
"bury_domains": ["example.net"]
}'import os
import requests
r = requests.post(
"https://api.millionshort.com/v1/search",
headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]},
json={
"query": "rate limiting with a token bucket",
"page_types": [
"tutorials",
"documentation"
],
"topics": [
"programming",
"software"
],
"boost_domains": [
"docs.example.com"
],
"bury_domains": [
"example.net"
]
},
timeout=30,
)
r.raise_for_status()
for hit in r.json()["data"]["results"]:
print(hit["position"], hit["title"], hit["url"])const res = await fetch('https://api.millionshort.com/v1/search', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"query": "rate limiting with a token bucket",
"page_types": [
"tutorials",
"documentation"
],
"topics": [
"programming",
"software"
],
"boost_domains": [
"docs.example.com"
],
"bury_domains": [
"example.net"
]
}),
});
if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`);
const { data } = (await res.json()) as {
data: { results: { position: number; title: string; url: string }[] };
};
for (const hit of data.results) console.log(hit.position, hit.title, hit.url);The same call as a tool of the MCP server:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "search",
"arguments": {
"query": "rate limiting with a token bucket",
"page_types": [
"tutorials",
"documentation"
],
"topics": [
"programming",
"software"
],
"boost_domains": [
"docs.example.com"
],
"bury_domains": [
"example.net"
]
}
}
}A closed set of sites for a regulated answer
include_domains with the approved sites, and safe_search: "strict". Nothing outside the list can be cited. See Only.
Nothing risky, nothing you have already read
Send the sites already in your corpus in exclude_domains, and exclude_risky: true. Every result that comes back has risk: null.
{ "query": "home battery storage payback", "exclude_domains": ["example.com", "example.org"], "exclude_risky": true }Rising sites in a niche
Search the field broadly and keep the results whose site is rising. Sites on the move are rare, so use a broad query and ask for more results; the list is often short and can be empty. See traffic trends.
{ "query": "best running shoes", "traffic_trend": ["rising", "spiking", "new"], "num_results": 20 }Sites that matter in one country
popular_in keeps sites with an audience in the countries you name, whatever their domain ending. See popular where.
{ "query": "heat pump grant", "popular_in": ["GB", "IE"] }Discussion, with no shops and no listicles
{ "query": "standing desk wobble", "boost_page_types": ["forums", "comments"], "exclude_page_types": ["products", "listicles"] }This week's news in one language
{ "query": "Bundestag Haushalt", "sources": ["news"], "time_range": "week", "language": "de" }What to tell your agent
A tool description lists fields. It does not tell a model when a filter is worth using. Put this, or your own version of it, in the system prompt:
Search filters you can use:
- remove_top_sites: N drops the N most popular sites. Use 1000 to 10000 when results are all
big, familiar sites and you want specialist or first-hand pages. only_top_sites: N is the reverse.
- page_types keeps kinds of page (forums, comments, tutorials, documentation, reviews, research,
news, blogs and others). topics keeps subjects (programming, health, business, food and others).
exclude_page_types / exclude_topics remove them; boost_ and bury_ forms reorder.
Ask list_sources for the full lists.
- include_domains searches only the sites named; exclude_domains removes sites; boost_domains
and bury_domains reorder.
- start_date, end_date or time_range (day, week, month, year) for dated sources such as news;
web pages carry no date. language and country take two-letter codes.
- traffic_trend keeps sites whose visits are rising, spiking, falling, dropped or new (few sites
are on the move: use a broad query). popular_in keeps sites popular in the countries named.
site_tech keeps sites built with what you name. exclude_risky: true drops labelled sites.
- max_highlights: 1 to 5 returns the passages that answer the query. include_content: true
returns the page's text for web and news results (it costs extra per result).
- Every result has popularity, risk, traffic_trend, popular_in and site_tech. Say so when a
source is a little-known site. Do not cite a result that carries a risk label.
- If the answer has a filter_not_applied warning, a source could not apply that filter: say so
or search that source another way.Where they apply
- The popularity cut and the lenses apply to every source, and are most useful on
webandnews. page_types,topicsand theirexclude_,boost_andbury_forms act onwebandnewsresults. In a call that mixes sources they narrow those two and leave the rest as it is, and the response names the other sources in afilter_not_appliedwarning.- Dates work on the sources that carry dates;
webpages carry none. Language and country work on some sources. The search reference has the table, andGET /v1/sourcesreturns it as data. - The site filters (
popularity_buckets,traffic_trend,popular_in,site_tech,exclude_risky) apply to every source. A thread, a post or a community has no site of its own: it showsunknownpopularity, no site facts, and does not pass a site filter. - No filter is ignored silently. Where a source cannot apply one, the response says so.