# Domain info

How popular a site is, and whether it carries a risk label.

```text
POST https://api.millionshort.com/v1/domain
```

For up to 25 domains, returns how popular each site is and whether it carries a risk label. These are the same `popularity` and `risk` objects that every search result carries. One call costs 1 credit, however many domains it holds. It needs an [API key](https://millionshort.com/docs/authentication).

## Request

| Field | Type | Notes |
|---|---|---|
| `domains` | array of strings, 1 to 25 items | Required. |

```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

import requests

r = requests.post(
    "https://api.millionshort.com/v1/domain",
    headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]},
    json={
        "domains": [
            "example.com",
            "blog.example.org"
        ]
    },
    timeout=30,
)
r.raise_for_status()
print(r.json()["data"])
```

```ts
const res = await fetch('https://api.millionshort.com/v1/domain', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "domains": [
      "example.com",
      "blog.example.org"
    ]
  }),
});
if (!res.ok) throw new Error(`POST /v1/domain failed: ${res.status}`);
const { data } = (await res.json()) as { data: unknown };
console.log(data);
```

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"
      ]
    }
  }
}
```

## Response

`data.domains` has one entry per domain, in the order sent.

| Field | Type | Notes |
|---|---|---|
| `domain` | string |  |
| `popularity` | object |  |
| `risk` | object or null |  |

`popularity`:

| 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` |  |

`risk` is `null` when the site carries no risk label. Otherwise:

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

```json
{
  "data": {
    "domains": [
      {
        "domain": "example.com",
        "popularity": { "rank": 812, "bucket": "top-1k" },
        "risk": null
      },
      {
        "domain": "blog.example.org",
        "popularity": { "rank": null, "bucket": "long-tail" },
        "risk": null
      }
    ]
  },
  "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "domain": 1 } },
  "request_id": "req_..."
}
```

The values are an illustration.

## With the SDKs and MCP

```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:
    print(entry["domain"], entry["popularity"]["bucket"], entry["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, entry.risk);
}
```

Over MCP this is the `get_domain_info` tool. It needs a key.

## Errors

`400 INVALID_PARAM` (no domains, more than 25, or a value that is not a domain name), `401`, `429` and `502 SEARCH_UNAVAILABLE`. See [Errors](https://millionshort.com/docs/errors).
