# Popularity and risk signals

Every result says how popular its site is and whether the site carries a risk label. An agent can use both to decide what to trust.

A list of links tells an agent nothing about where the links lead. MillionShort adds two facts about the site behind every result, and a way to ask for the same facts about any site.

## Popularity

```json
{ "rank": 48210, "bucket": "top-100k" }
```

| Field | Type | Notes |
|---|---|---|
| `rank` | integer or null | The site's popularity rank (1 is the most popular), or null when it is outside the top 1,000,000 or unknown. |
| `bucket` | `top-100`, `top-1k`, `top-10k`, `top-100k`, `top-1m`, `long-tail`, `unknown` |  |

The buckets, from most to least popular: `top-100`, `top-1k`, `top-10k`, `top-100k`, `top-1m`, then `long-tail` for a site outside the top 1,000,000, and `unknown` when the result has no site rank at all (usually a thread or a community).

Popularity is not quality. A `top-100` site is well known; it may or may not be right. A `long-tail` site is little known; it may be the only first-hand account there is. What the signal gives an agent is context:

- **Diversity.** If every result is `top-1k`, the agent is reading the mainstream. Searching again with [`remove_top_sites`](https://millionshort.com/docs/search/remove-top-sites) shows what is underneath.
- **Weighting.** For a medical or legal claim an agent may prefer well-established sites; for a product opinion it may prefer the long tail, where fewer pages are written to sell.
- **Explaining itself.** "This comes from a small independent site" is a useful thing to tell a person.

Rank belongs to the site, not the page: a page on a subdomain of a large hosting or blogging platform carries the platform's rank.

## Risk

`risk` is `null` for most sites. When a site carries a risk label, the result says so:

```json
{ "level": "labelled", "categories": ["phishing"] }
```

| Field | Type | Notes |
|---|---|---|
| `level` | `labelled`, `demoted`, `blocked` |  |
| `categories` | array of strings |  |

| Level | What happened to the result |
|---|---|
| `labelled` | Nothing. It is in its place, with the label attached. The decision is yours |
| `demoted` | It was moved down the list |
| `blocked` | It was removed from search results. You see this level only from `POST /v1/domain` |

`categories` says why, in a few short words. The example above is an illustration; read the values as text for a person or a model, and branch on `level`.

`summary.removed.risk` counts results that were removed because of a risk label.

A sensible default for an agent: never open or cite a `demoted` result without saying so, and treat `labelled` as a reason to look for a second source.

## SafeSearch

`safe_search` is a separate control for adult content: `off`, `moderate` (the default) or `strict`. `summary.removed.safe_search` counts what it removed. It is not a risk label and does not appear on results.

## Why a result is where it is

Add `"explain": true` to a search and every result gains two more fields. It is free.

```bash
curl https://api.millionshort.com/v1/search \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "restoring a cast iron skillet", "num_results": 5, "explain": true }'
```

```python
import os

import requests

r = requests.post(
    "https://api.millionshort.com/v1/search",
    headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]},
    json={
        "query": "restoring a cast iron skillet",
        "num_results": 5,
        "explain": True
    },
    timeout=30,
)
r.raise_for_status()
for hit in r.json()["data"]["results"]:
    print(hit["position"], hit["title"], hit["url"])
```

```ts
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": "restoring a cast iron skillet",
    "num_results": 5,
    "explain": true
  }),
});
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:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "search",
    "arguments": {
      "query": "restoring a cast iron skillet",
      "num_results": 5,
      "explain": true
    }
  }
}
```

`why` is a short list of reasons in plain words, such as the result's position by relevance, the query words in its title, and its site's popularity. `signals` holds three numbers:

| Field | Type | Notes |
|---|---|---|
| `text_rank` | integer or null | Position by text relevance alone. |
| `link_authority` | number, 0 to 10 or null | How well linked the site is, 0 to 10. Null when the source has none for the result. |
| `words` | integer or null | Length of the page in words. |

Sources whose results are not pages on sites (`hn`, `social`, `communities` and others) return `null` for some or all of the three. `why` is still filled in.

## Ask about any site

`POST /v1/domain` returns the same `popularity` and `risk` for up to 25 sites in one call, for 1 credit. Use it before following a link the agent found somewhere else, or to check a list of sources.

```bash
curl https://api.millionshort.com/v1/domain \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "domains": ["example.com", "blog.example.org"] }'
```

```python
import os

from millionshort import MillionShort

client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"])

info = client.get_domain_info(["example.com", "blog.example.org"])
for entry in info.domains:
    risk = entry["risk"]["level"] if entry["risk"] else "none"
    print(entry["domain"], entry["popularity"]["bucket"], "risk:", risk)
```

```ts
import { MillionShort } from 'millionshort';

const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY });

const info = await client.getDomainInfo(['example.com', 'blog.example.org']);
for (const entry of info.domains) {
  console.log(entry.domain, entry.popularity.bucket, 'risk:', entry.risk?.level ?? 'none');
}
```

The same call as a tool of the MCP server:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_domain_info",
    "arguments": {
      "domains": [
        "example.com",
        "blog.example.org"
      ]
    }
  }
}
```

Over MCP this is the `get_domain_info` tool. The [Domain info reference](https://millionshort.com/docs/api-reference/domain) has the fields.

## Filtering on them

Two request fields do the common cases for you. `exclude_risky: true` drops every result whose site carries a risk label. `popularity_buckets` keeps the bands you name:

```json
{ "query": "restoring a cast iron skillet", "popularity_buckets": ["top-100k", "top-1m", "long-tail"], "exclude_risky": true }
```

Three more facts about the site are on every result and are filters as well: where it is popular, which way its traffic is moving and what it is built with. See [Site signals](https://millionshort.com/docs/search/site-signals).

## A filter of your own

The signals are on every result, so an agent can also apply its own rule after the search. This keeps results from outside the 10,000 most popular sites that carry no risk label:

```python
import os

from millionshort import MillionShort

client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"])

r = client.search("restoring a cast iron skillet", num_results=30)
keep = [
    hit
    for hit in r.results
    if hit["risk"] is None
    and hit["popularity"]["bucket"] in ("top-100k", "top-1m", "long-tail")
]
for hit in keep:
    print(hit["popularity"]["bucket"], hit["url"])
```

```ts
import { MillionShort } from 'millionshort';

const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY });

const r = await client.search('restoring a cast iron skillet', { numResults: 30 });
const keep = r.results.filter(
  (hit) =>
    hit.risk === null &&
    ['top-100k', 'top-1m', 'long-tail'].includes(hit.popularity.bucket),
);
for (const hit of keep) {
  console.log(hit.popularity.bucket, hit.url);
}
```

## What the signals are not

- They describe the **site**, not the page and not the claim. A good site can host a wrong page.
- A missing risk label is not a guarantee. It means the site carries no label today.
- We do not say where a rank or a label comes from, and the response never does either.
