# Extract parameters

Every field of an Extract request, the modes, and everything that comes back for each URL.

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

Takes up to 20 URLs and returns, for each, the page's main content as Markdown or plain text, with its title, metadata and links. The call is synchronous. Each URL succeeds or fails on its own, and a URL that fails costs nothing, with the one exception in [Credits](#credits).

## Request

| Field | Type | Default | Notes |
|---|---|---|---|
| `urls` | array of strings, 1 to 20, distinct | | Required. `http` or `https`, default ports, a host name (not an address), no credentials in the URL. Up to 2,048 characters each |
| `mode` | `auto`, `cached`, `live`, `rendered`, `unblock`, `stealth` | `"auto"` | How the page is obtained. See below |
| `max_age_hours` | integer, 0 to 8,760 | `168` | With `auto` only: how old a stored copy may be before a live fetch is made instead |
| `formats` | array of `markdown`, `text`, `links`, `metadata` | `["markdown","metadata"]` | What to return for each page |
| `max_chars` | integer, 1 to 500,000 | `50000` | The longest content per page. Longer content is cut and `truncated` is `true` |
| `topics` | array of topic slugs | | Keep only pages about these topics. See [Labels](https://millionshort.com/docs/extract/parameters#labels) |
| `page_types` | array of page-type slugs | | Keep only pages of these kinds |
| `source_hints` | array of source slugs | | Keep only pages with one of these source hints |
| `json` | object with `schema` and an optional `prompt` | | Each page as JSON of your shape. Starter and up, at most 3 `urls`. See [JSON of your shape](#json-of-your-shape) |

Any other field is a `400 INVALID_PARAM`. A caller cannot send cookies or headers to the site.

### Modes

| Mode | What it does | Credits per page |
|---|---|---|
| `cached` | Returns a copy we already hold. No request reaches the site. Switched off for now | 0.25 |
| `live` | Fetches the page now, as our declared bot. robots.txt is honoured | 0.5 |
| `rendered` | Loads the page in a browser, so content built by scripts appears. Paid plans | 2 |
| `unblock` | A rendered fetch through a residential or premium proxy, for sites that refuse automated requests. Growth plan and above | 10 |
| `stealth` | A rendered fetch through the hardest-to-block proxy, for sites that refuse even `unblock`. Not switched on yet; when it is, on the plans that include it | 25 |
| `auto` | `cached` when there is a stored copy younger than `max_age_hours`, otherwise `live`. While `cached` is off, `auto` is `live` | By the mode used |

- `auto` never chooses `rendered`, `unblock` or `stealth`. When a live page looks like an empty shell that scripts fill in, the response carries a `looks_script_built` warning that suggests `rendered`.
- `live` identifies itself as `MillionShortBot`. Site owners can address it in robots.txt.
- `rendered`, `unblock` and `stealth` load the page in a browser. We check robots.txt under our own bot's name first, and none of them is ever chosen for you.
- In these three modes, a page the site says does not exist (`404` or `410`) is charged at the mode's price, because the browser reached the site. It comes back with `charged: true` and the site's status in `error.target_status`. See [Credits](#credits).
- There is no option to ignore robots.txt.

### JSON of your shape

`json` asks for each page as an object of the shape you describe. `schema` is a JSON Schema of type `object` with `properties`, at most 8 KB. It may use `type`, `properties`, `required`, `items`, `enum` and `description`, and they are enforced in full; a schema that uses any other keyword is refused with `400 INVALID_PARAM`, so nothing you write is silently ignored. `prompt`, up to 1,000 characters, says what to look for.

```bash
curl https://api.millionshort.com/v1/extract \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": ["https://example.org/products/tide-clock"],
    "mode": "live",
    "json": {
      "schema": {
        "type": "object",
        "properties": { "name": { "type": "string" }, "price": { "type": ["number", "null"] } },
        "required": ["name"]
      },
      "prompt": "The product on the page."
    }
  }'
```

```python
import os

import requests

r = requests.post(
    "https://api.millionshort.com/v1/extract",
    headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]},
    json={
        "urls": [
            "https://example.org/products/tide-clock"
        ],
        "mode": "live",
        "json": {
            "schema": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "price": {
                        "type": [
                            "number",
                            "null"
                        ]
                    }
                },
                "required": [
                    "name"
                ]
            },
            "prompt": "The product on the page."
        }
    },
    timeout=30,
)
r.raise_for_status()
print(r.json()["data"])
```

```ts
const res = await fetch('https://api.millionshort.com/v1/extract', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "urls": [
      "https://example.org/products/tide-clock"
    ],
    "mode": "live",
    "json": {
      "schema": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "price": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "name"
        ]
      },
      "prompt": "The product on the page."
    }
  }),
});
if (!res.ok) throw new Error(`POST /v1/extract failed: ${res.status}`);
const { data } = (await res.json()) as { data: unknown };
console.log(data);
```

- Each page that was fetched is read by a language model, and its answer is checked against your schema. Only an object that fits comes back, as `json` on that URL's result. Keys that are not in `properties` are dropped. Make a property nullable when a page may not have it.
- When it does not work out, the result still carries the page, with `json: null` and `json_error` (`code` and `message`):

| `json_error.code` | Meaning |
|---|---|
| `JSON_SCHEMA_MISMATCH` | What was found did not fit the schema, after one correction |
| `JSON_UNAVAILABLE` | Not read in time, or not now. Try again later |
| `JSON_LIMIT_REACHED` | A daily limit of pages as JSON is used up (a team may have 500 a day) |
| `JSON_NO_CONTENT` | The page had no text to read |

- On Starter and up. On Free, `json` is refused with `400 UNSUPPORTED_OPTION`.
- At most 3 `urls` in a call with `json` (`400 INVALID_PARAM` otherwise). A [batch](https://millionshort.com/docs/extract/batch) does not take it, and neither does the `extract` tool over MCP. A [crawl](https://millionshort.com/docs/crawl/parameters#request) takes the same `json`.
- 3 credits on top of the mode's price for each page that came back as JSON (`extract_json` in `usage.breakdown`). A page whose JSON failed costs only its fetch.
- All the pages of one call share 20 seconds for the reading. A page that does not get its turn answers `JSON_UNAVAILABLE`. The daily limit counts attempts, whether or not they work out.
- The page's main text (its first 24 KB), your schema and your prompt are sent to a model provider to be read. We use only providers that do not keep or train on what they are sent. Nothing else about you is sent.

## Example

```bash
curl https://api.millionshort.com/v1/extract \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": ["https://example.org/guides/tide-tables"],
    "mode": "live",
    "formats": ["markdown", "metadata", "links"]
  }'
```

```python
import os

import httpx

response = httpx.post(
    "https://api.millionshort.com/v1/extract",
    headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]},
    json={"urls": ["https://example.org/guides/tide-tables"], "mode": "live"},
    timeout=60,
)
response.raise_for_status()
body = response.json()
for page in body["data"]["results"]:
    if page["status"] == "ok":
        print(page["title"], page["mode_used"], len(page["markdown"] or page["text"] or ""))
    else:
        print(page["url"], "failed:", page["error"]["code"])
print(body["usage"]["credits"], "credits")
```

```ts
const response = await fetch('https://api.millionshort.com/v1/extract', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ urls: ['https://example.org/guides/tide-tables'], mode: 'live' }),
});
if (!response.ok) throw new Error(`extract failed: ${response.status}`);
const body = await response.json();
for (const page of body.data.results) {
  if (page.status === 'ok') {
    console.log(page.title, page.mode_used, (page.markdown ?? page.text ?? '').length);
  } else {
    console.log(page.url, 'failed:', page.error.code);
  }
}
console.log(body.usage.credits, 'credits');
```

The SDKs do not cover this endpoint yet. Their `extract` method belongs to an older draft and sends a different request: do not use it. Call the endpoint over HTTP as above.

## Response

```json
{
  "data": {
    "results": [
      {
        "url": "https://example.org/guides/tide-tables",
        "final_url": "https://example.org/guides/tide-tables",
        "status": "ok",
        "mode_used": "live",
        "fetched_at": "2026-11-18T10:00:00Z",
        "age_seconds": 0,
        "format": "markdown",
        "title": "How to read a tide table",
        "markdown": "# How to read a tide table\n\nA tide table lists the times of high and low water for one place...",
        "truncated": false,
        "metadata": {
          "description": "Times, heights and what the columns mean.",
          "author": null,
          "published_date": null,
          "language": "en",
          "canonical_url": null,
          "content_type": "text/html",
          "status_code": 200
        },
        "links": [{ "url": "https://example.org/guides/tidal-range", "text": "Tidal range" }],
        "topic": "science",
        "page_type": "tutorials",
        "source_hint": "web",
        "label_confidence": { "topic": 0.84, "page_type": 0.77, "source_hint": 0.77 },
        "site": "example.org",
        "popularity": { "rank": null, "bucket": "long-tail" },
        "risk": null
      },
      {
        "url": "https://example.org/private",
        "status": "error",
        "error": {
          "code": "ROBOTS_DISALLOWED",
          "message": "This site's robots.txt does not allow our bot to fetch this page."
        }
      }
    ],
    "summary": { "requested": 2, "succeeded": 1, "failed": 1, "by_mode": { "live": 1 } }
  },
  "usage": { "credits": 0.5, "cost_usd": 0.0005, "breakdown": { "extract_live": 0.5 } },
  "warnings": [],
  "request_id": "req_..."
}
```

The values are an illustration, for a request with two URLs.

One entry per URL, in the order sent. The HTTP status is `200` whenever the request itself was valid, even when every URL failed: look at each entry's `status`.

### A result

| Field | Type | Notes |
|---|---|---|
| `url` | string | The URL you sent |
| `status` | `ok` or `error` | |
| `final_url` | string | Where the page was after redirects |
| `mode_used` | `cached`, `live`, `rendered`, `unblock`, `stealth` | The mode that produced this result. Also on a failed URL that was charged |
| `fetched_at` | date and time | When the copy was taken |
| `age_seconds` | integer | How old the copy is now. A live page fetched for any caller in the last five minutes is reused, and says so here |
| `format` | `markdown` or `text` | Which of the two content fields is filled in |
| `title` | string or null | |
| `markdown` | string or null | The main content as Markdown |
| `text` | string or null | The main content as plain paragraphs. Present when `text` is in `formats` |
| `truncated` | boolean | `true` when the content was cut at `max_chars` |
| `metadata` | object | Only when asked for: `description`, `author`, `published_date`, `language`, `canonical_url`, `content_type`, `status_code` |
| `links` | array | Only when asked for: up to 2,000 `{url, text}` pairs |
| `topic` | string or null | What the page is about: one of the 24 [topic slugs](https://millionshort.com/docs/search/topics-and-page-types) |
| `page_type` | string or null | What kind of page it is: one of the 23 [page-type slugs](https://millionshort.com/docs/search/topics-and-page-types) |
| `source_hint` | string or null | The [source](https://millionshort.com/docs/search/sources) that holds pages like this one |
| `label_confidence` | object | `topic`, `page_type` and `source_hint`: how sure each label is, each 0 to 1 or `null` |
| `filtered` | boolean | Present, and `true`, on a page left out by `topics`, `page_types` or `source_hints`. See [Labels](https://millionshort.com/docs/extract/parameters#labels) |
| `site` | string | The host name |
| `popularity`, `risk` | objects | The same [signals](https://millionshort.com/docs/search/popularity-and-risk) a search result carries, at no charge |
| `error` | object | On a failed URL: `code`, `message`, `retry_after_seconds` when waiting helps, and `target_status` when the site said the page does not exist in a browser mode |
| `charged` | boolean | Present, and `true`, on a failed URL that was charged: a browser mode reached the site and the page does not exist (`404`, `410`) |

`data.summary` counts what was `requested`, `succeeded` and `failed`, and how many pages each mode served in `by_mode`. When a label list was sent it also has `filtered`: how many pages were left out.

### Per-URL errors

| Code | Meaning | Try next |
|---|---|---|
| `URL_NOT_ALLOWED` | Not a public web page we will fetch: a private address, an unusual port, credentials in the URL, or a page flagged as malicious | |
| `ROBOTS_DISALLOWED` | The site's robots.txt does not allow our bot | |
| `ROBOTS_UNAVAILABLE` | robots.txt could not be read, so we did not fetch | Later |
| `SITE_OPTED_OUT` | The site asked us not to fetch or serve it | |
| `NOT_IN_CACHE` | `cached` mode: we hold no copy | `live` |
| `FETCH_FAILED` | The site did not answer usefully, or answered with an error status. In a browser mode, with `charged: true`: the page does not exist | Later |
| `TIMEOUT` | The site was too slow | Later |
| `TOO_LARGE` | The page is over 10 MiB | |
| `UNSUPPORTED_CONTENT_TYPE` | Not HTML, text, PDF, a word-processing, spreadsheet or slide document, XML or JSON | |
| `BLOCKED_BY_SITE` | The site refused our bot | `unblock` |
| `RENDER_FAILED` | `rendered` or `unblock` could not load the page | Later |
| `HOST_BUSY` | We are already fetching from this site as fast as we allow | After `retry_after_seconds` |
| `HOST_DAILY_LIMIT` | This team reached its [daily limit for this site](#the-daily-limit-per-site) | Tomorrow (UTC) |
| `CAPACITY` | `rendered` and `unblock` are at capacity, for today or for the moment; or, in `cached` mode, the stored copy could not be looked up yet | After `retry_after_seconds` when it is given, else later |

Every redirect is checked again against the same rules as the first URL.

## Labels

Every page that comes back says what it is, in every mode, at no charge:

```text
"topic": "health",
"page_type": "articles",
"source_hint": "medical",
"label_confidence": { "topic": 0.93, "page_type": 0.71, "source_hint": 0.71 }
```

- **`topic`** and **`page_type`** are the same [24 topics and 23 page types](https://millionshort.com/docs/search/topics-and-page-types) a search result carries, made the same way. A program can treat a page it fetched and a page it found with one rule. The two can differ for one URL: the page may have changed since it was indexed, and Extract reads its main content. They are read from the page's title and the start of its text.
- **`source_hint`** names the [source](https://millionshort.com/docs/search/sources) that holds pages like this one: a paper is `academic`, or `medical` when it is about health; a news article is `news`; a forum thread is `discussions`; a personal blog is `smallweb`; a page of no special kind is `web`. It tells an agent where to search for more of the same. It does not say that we hold the page.
- **`label_confidence`** is between 0 and 1 for each label. A label is `null`, with a `null` confidence, when the page has too little text to tell, or when labels could not be made at that moment. Labels never fail a call and never change its price.

### Keep only some pages

`topics`, `page_types` and `source_hints` take lists of those slugs. Within a list, a page needs to match any one entry; it has to pass every list that was sent.

```bash
curl https://api.millionshort.com/v1/extract \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": ["https://example.org/a", "https://example.org/b"],
    "mode": "live",
    "topics": ["health"],
    "page_types": ["articles", "research"]
  }'
```

```python
import os

import requests

r = requests.post(
    "https://api.millionshort.com/v1/extract",
    headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]},
    json={
        "urls": [
            "https://example.org/a",
            "https://example.org/b"
        ],
        "mode": "live",
        "topics": [
            "health"
        ],
        "page_types": [
            "articles",
            "research"
        ]
    },
    timeout=30,
)
r.raise_for_status()
print(r.json()["data"])
```

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

A page that does not pass stays in `results`, in its place, so the answer still has one entry per URL:

```json
{
  "url": "https://example.org/b",
  "final_url": "https://example.org/b",
  "status": "ok",
  "filtered": true,
  "mode_used": "live",
  "fetched_at": "2026-11-18T10:00:00Z",
  "age_seconds": 0,
  "topic": "food",
  "page_type": "products",
  "source_hint": "web",
  "label_confidence": { "topic": 0.88, "page_type": 0.91, "source_hint": 0.88 },
  "site": "example.org",
  "popularity": { "rank": null, "bucket": "long-tail" },
  "risk": null
}
```

- The entry says what the page is and carries none of its content: no `title`, `format`, `markdown`, `text`, `truncated`, `metadata` or `links`.
- **A page left out is still charged for its fetch.** The page had to be fetched to be labelled. The lists save your program the reading, not the fetch.
- A page is never left out for a label it does not have: a `null` label passes. A page whose labels could not be made is kept, and the response carries a `labels_unavailable` warning.
- An empty list, or a slug that is not on the lists of [`GET /v1/sources`](https://millionshort.com/docs/api-reference/sources) is a `400 INVALID_PARAM`.

## Request-level errors

`400 INVALID_PARAM`; `400 UNSUPPORTED_OPTION` for a mode the plan does not include or one that is switched off; `429 INSUFFICIENT_CREDITS`; `429 RATE_LIMITED` when the team has no fetch slot free. See [Errors](https://millionshort.com/docs/errors).

## Limits

| | Free | Starter | Growth | Scale | Business |
|---|---|---|---|---|---|
| Fetches at once, per team | 2 | 4 | 8 | 16 | 32 |
| `rendered` | No | Yes | Yes | Yes | Yes |
| `unblock` | No | No | Yes | Yes | Yes |
| `stealth` (not switched on yet) | No | No | Yes | Yes | Yes |

- **We are polite to sites.** For all customers together, one site gets at most 2 fetches at once and 1 a second.
- Per team, per site, per day: 2,000 fetches in any mode other than `cached`. [What counts as a fetch](#the-daily-limit-per-site) is below.
- 10 MiB per page; 20 seconds for a `live` page, 60 for `rendered`, 130 for `unblock` and `stealth`; up to 5 redirects.
- A call with more URLs than the plan's fetches-at-once runs them in turn. It is refused with `429 RATE_LIMITED` only when no slot is free at all.
- A site that gave no answer at all to your last two fetches of it (no connection, or nothing within the time limit) is not asked again for you for five minutes. Its URLs answer `TIMEOUT` or `FETCH_FAILED` at once in that time. What another team's fetches found never changes what you get.
- When `rendered` or `unblock` are at capacity for the moment, the URL answers `CAPACITY` with `retry_after_seconds`. It is free, and it does not count as one of the day's attempts.

### The daily limit per site

A team may fetch 2,000 pages of one site in a day (UTC), in every mode other than `cached`, [monitor](https://millionshort.com/docs/monitor/parameters) checks included. The limit is there so that nobody copies a site through us. It counts what you take from a site, so looking at a page again and finding it as it was does not count again:

| Fetch | Counts towards the 2,000? |
|---|---|
| The first fetch of an address in a day | Yes |
| The same address again, and the page is as it was at your last fetch | No |
| The same address again, and the page has changed | Yes |
| A fetch that got no page (an error status, a timeout) | Yes, every time |

- **What decides is the page that came back, not how the address is written.** "Changed" means that the page's title, description or cleaned text differs from your last fetch of it, or that the address now redirects somewhere else. An address that redirects and the address it leads to are two addresses. A page that is different on every fetch (a search page, a feed, a page with a clock in its text) counts on every fetch.
- **The same address** is compared without its fragment and with its query parameters in order: `https://example.org/a?x=1&y=2#top` and `https://example.org/a?y=2&x=1` are one address. Adding a parameter makes a new address, which counts.
- A monitor that checks an unchanged page 96 times a day uses one fetch of the day, plus one for each change it finds.
- **At the limit**, an address you already fetched that day can still be fetched, and is returned while the page is unchanged. A page that has changed, and any address not yet fetched that day, answers `HOST_DAILY_LIMIT` until the next day. Nothing is charged for it.
- A fetch that is not counted again is still a request to the site (the politeness limits above hold), and a page that is returned is still charged its credits.

## Credits

The call holds `urls × the price of the mode asked for` before any work (`auto` holds the `live` price), charges each page that succeeded at the price of the mode actually used, and hands the rest back in the same request. `usage.breakdown` has one line per mode used: `extract_cached`, `extract_live`, `extract_rendered`, `extract_unblock`, `extract_stealth`.

A failed URL is free, with one exception: in `rendered`, `unblock` and `stealth`, a page the site says does not exist (`404` or `410`) is charged at the mode's price, because a browser reached the site for you. It is marked `charged: true`. Our own refusals (robots.txt, the URL rules, a site that opted out, our caps, capacity) are never charged.

| Call | Credits |
|---|---|
| 1 URL, `live`, succeeds | 0.5 |
| 10 URLs, `live`, 8 succeed | 4 |
| 1 URL, `rendered`, succeeds | 2 |
| 1 URL, `unblock`, succeeds | 10 |
| 1 URL, `rendered`, the site answers `404` | 2 |
| 5 URLs, all fail | 0 |
| 10 URLs, `live`, all succeed, 6 left out by `page_types` | 5 |

Labels are free in every mode.

## With search

Extract is the second half of a common pair: search for pages, then read the ones worth reading.

1. [Search](https://millionshort.com/docs/search/parameters), and choose results by title, snippet, `popularity` and `risk`.
2. Send the chosen URLs to Extract.

When a snippet is enough, skip the fetch: a search result carries up to 2,000 characters with `max_chars_per_result`.

## Over MCP

The [MCP server](https://millionshort.com/docs/mcp) has an `extract` tool: up to 5 URLs, `mode`, `max_chars` and the three label lists (`topics`, `page_types`, `source_hints`), read-only, for callers with a key. Each page it returns says its topic, page type and source hint.
