# Topics and page types

Keep pages by what they are about and by what kind of page they are. 24 topics and 23 page types.

Almost every page in the `web` source carries two labels: a **topic**, what it is about, and a **page type**, what kind of page it is. A search can keep pages by either or both.

```text
"topics": ["food"],
"page_types": ["forums", "comments"]
```

Both fields are lists. Within a list, a page needs to match any one entry. Across the two, it needs to match both: the request above keeps forum or comment pages about food. Both are free.

Each has three more forms, with the same slugs:

| To | Page types | Topics |
|---|---|---|
| Keep only | `page_types` | `topics` |
| Never return | `exclude_page_types` | `exclude_topics` |
| Move ahead of the rest | `boost_page_types` | `boost_topics` |
| Move to the end | `bury_page_types` | `bury_topics` |

```text
"boost_page_types": ["forums", "comments"],
"exclude_page_types": ["products", "listicles"],
"exclude_topics": ["adult"]
```

A slug cannot be in both the keep list and the exclude list of the same kind: that is a `400`.

The same two labels come back on every page [Extract](https://millionshort.com/docs/extract/parameters#labels) returns and on every [Monitor](https://millionshort.com/docs/monitor/parameters#events) event, with a confidence and a `source_hint`, so an agent can filter and route a page it fetched the way it filters a page it found.

## Page types

| Slug | Label |
|---|---|
| `articles` | Article |
| `blogs` | Blog |
| `comments` | Comments |
| `companies` | Company page |
| `creative-writing` | Creative writing |
| `data` | Data |
| `directories` | Directory |
| `documentation` | Documentation |
| `faqs` | FAQ |
| `forums` | Forum |
| `legal` | Legal notices |
| `listicles` | Listicle |
| `news` | News |
| `press-releases` | Press release |
| `products` | Product |
| `profiles` | Profile |
| `reference` | Reference |
| `research` | Research |
| `reviews` | Review |
| `spam` | Spam & ads |
| `support` | Support |
| `transcripts` | Transcript |
| `tutorials` | Tutorial |

## Topics

| Slug | Label |
|---|---|
| `adult` | Adult |
| `art` | Art & design |
| `business` | Business & finance |
| `education` | Education |
| `entertainment` | Entertainment |
| `fashion` | Fashion & beauty |
| `food` | Food |
| `games` | Games |
| `hardware` | Hardware |
| `health` | Health |
| `history` | History |
| `home` | Home & hobbies |
| `industry` | Industry |
| `law` | Law |
| `literature` | Literature |
| `politics` | Politics |
| `programming` | Programming |
| `religion` | Religion |
| `science` | Science |
| `social-life` | Social life |
| `software` | Software |
| `sports` | Sports |
| `transport` | Transport |
| `travel` | Travel |

The lists above are the ones the API serves today. A program should read them from [`GET /v1/sources`](https://millionshort.com/docs/api-reference/sources), which is free, or from the `list_sources` tool over MCP, so it follows any change. A slug that is not on the list is a `400 INVALID_PARAM`.

## Example

Forum and comment pages about food:

```bash
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"],
    "num_results": 10
  }'
```

```python
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"],
    num_results=10,
)
for hit in r.results:
    print(hit["page_type"], hit["topic"], hit["title"])
```

```ts
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'],
  numResults: 10,
});
for (const hit of r.results) {
  console.log(hit.page_type, hit.topic, hit.title);
}
```

The same call as a tool of the MCP server:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "search",
    "arguments": {
      "query": "sourdough starter",
      "page_types": [
        "forums",
        "comments"
      ],
      "topics": [
        "food"
      ],
      "num_results": 10
    }
  }
}
```

Every result says what it is: `page_type` and `topic` hold the slugs.

## Things to know

- **The labels are assigned by us, automatically, per page.** They are right most of the time and wrong some of the time. A forum thread can be labelled `comments`; a long product review can be labelled `articles`. When a filter returns less than you expected, widen it by one neighbouring type.
- **The filters act on `web` and `news` results.** 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 a `filter_not_applied` warning, so a filter is never ignored silently. Results from some other sources carry the labels too: filter those in your own code, on `page_type` and `topic`.
- **To leave a kind of page out, use `exclude_page_types`.** To leave product pages out of a search for discussion: `"exclude_page_types": ["products"]`. To prefer discussion without losing everything else: `"boost_page_types": ["forums", "comments"]`.
- **A narrow filter can run short.** If fewer pages match than `num_results`, the response carries a `short_results` warning.

## Agent recipes

| The agent wants | `page_types` | Also set |
|---|---|---|
| What practitioners say | `forums`, `comments` | `remove_top_sites: 10000` |
| How to do something | `tutorials`, `documentation`, `faqs` | |
| Independent opinion on a product | `reviews`, `blogs`, `forums` | `remove_top_sites: 1000` |
| The primary record | `research`, `data`, `legal`, `press-releases` | |
| Who a company is | `companies`, `profiles` | |
| Long-form reading | `articles`, `blogs`, `creative-writing` | `topics` for the subject |
| The words that were spoken | `transcripts` | |

To study low-quality pages on purpose, `spam` is a page type like any other. Leave it out of every other request simply by naming the types you want.

## Related

- [Filters for agents](https://millionshort.com/docs/search/filters): every filter in one table, and more recipes.
- [Remove the top sites](https://millionshort.com/docs/search/remove-top-sites) and [Lenses](https://millionshort.com/docs/search/lenses).
- [Spaces](https://millionshort.com/docs/search/spaces): page types and topics saved with a list of sites under one name.
- [Sources reference](https://millionshort.com/docs/api-reference/sources): the call that returns these lists.
