Menu

Search

Search parameters

Every field of a search request, and everything that comes back.

Copy as MarkdownOpen in ChatGPT (opens in a new tab)Open in Claude (opens in a new tab)

Text
POST https://api.millionshort.com/v1/search

Searches one to five sources and returns one ranked list. Results from several sources are merged by rank and duplicates are removed. The call is synchronous. It needs an API key.

Request

A JSON body. Only query is required. A field that is not listed here is refused with 400 INVALID_PARAM.

FieldTypeDefaultNotes
querystring, 1 to 400 charactersRequired.
sourcesarray of web, news, smallweb, discussions, hn, social, communities, podcasts, academic, medical, law, finance, contracts, 1 to 5 items["web"]Sources to search. Each source searched costs 1 credit.
num_resultsinteger, 1 to 5010How many results to return in total. With several sources this is the length of the one merged list, not a count per source.
remove_top_sitesinteger, 0 to 1,000,0000Remove results from the N most popular sites. 0 keeps everything. Free.
only_top_sitesinteger, 0 to 1,000,0000Keep only results from the N most popular sites. Cannot be combined with remove_top_sites.
include_domainsarray of strings, up to 25Return results from these sites only.
exclude_domainsarray of strings, up to 25Never return results from these sites.
boost_domainsarray of strings, up to 25Move results from these sites ahead of the rest.
bury_domainsarray of strings, up to 25Move results from these sites to the end.
only_domainsarray of strings, up to 25Another name for include_domains. Both sent are merged.
block_domainsarray of strings, up to 25Another name for exclude_domains. Both sent are merged.
page_typesarray of research, directories, creative-writing, support, comments, faqs, reference, legal, listicles, news, articles, companies, press-releases, profiles, blogs, products, forums, spam, data, documentation, transcripts, tutorials, reviewsKeep only these kinds of page, for example [tutorials, documentation]. Applied by web and news; other sources in the call get a filter_not_applied warning.
exclude_page_typesarray of research, directories, creative-writing, support, comments, faqs, reference, legal, listicles, news, articles, companies, press-releases, profiles, blogs, products, forums, spam, data, documentation, transcripts, tutorials, reviewsNever return these kinds of page, for example [listicles, spam].
boost_page_typesarray of research, directories, creative-writing, support, comments, faqs, reference, legal, listicles, news, articles, companies, press-releases, profiles, blogs, products, forums, spam, data, documentation, transcripts, tutorials, reviewsMove these kinds of page ahead of the rest, for example [documentation].
bury_page_typesarray of research, directories, creative-writing, support, comments, faqs, reference, legal, listicles, news, articles, companies, press-releases, profiles, blogs, products, forums, spam, data, documentation, transcripts, tutorials, reviewsMove these kinds of page to the end, for example [forums].
topicsarray of adult, art, programming, law, education, hardware, entertainment, social-life, fashion, business, food, games, health, history, home, industry, literature, politics, religion, science, software, sports, transport, travelKeep only these topics, for example [science, health]. Applied by web and news; other sources in the call get a filter_not_applied warning.
exclude_topicsarray of adult, art, programming, law, education, hardware, entertainment, social-life, fashion, business, food, games, health, history, home, industry, literature, politics, religion, science, software, sports, transport, travelNever return these topics, for example [adult].
boost_topicsarray of adult, art, programming, law, education, hardware, entertainment, social-life, fashion, business, food, games, health, history, home, industry, literature, politics, religion, science, software, sports, transport, travelMove these topics ahead of the rest, for example [programming].
bury_topicsarray of adult, art, programming, law, education, hardware, entertainment, social-life, fashion, business, food, games, health, history, home, industry, literature, politics, religion, science, software, sports, transport, travelMove these topics to the end, for example [entertainment].
popularity_bucketsarray of top-100, top-1k, top-10k, top-100k, top-1m, long-tailKeep results whose site is in one of these popularity buckets, for example [long-tail, top-1m]. See also remove_top_sites and only_top_sites.
traffic_trendarray of rising, spiking, steady, falling, dropped, newKeep results whose site's traffic is moving this way, for example [rising, spiking]. Each result says its own in traffic_trend. The site filters are checked on the best matches for the query, and sites on the move are rare: expect a short list.
popular_inarray of strings, 1 to 10 itemsKeep results whose site is popular in any of these countries, for example [DE, AT]. Each result lists its own in popular_in.
site_techarray of strings (each 1 to 40 characters), 1 to 10 itemsKeep results whose site is built with any of these, for example [wordpress, woocommerce]. Names are matched without regard to case against what results return in site_tech. A name is letters, digits, spaces and . + # / -, starting with a letter or digit.
exclude_riskybooleanfalseDrop results whose site carries a risk label (risk is not null).
start_datestring or nullResults published on or after this day (YYYY-MM-DD). Applied by news, hn, social, communities, podcasts, academic, medical, law, finance and contracts. web pages carry no date: a filter_not_applied warning says so.
end_datestring or nullResults published on or before this day (YYYY-MM-DD). Same sources as start_date.
time_rangeday, week, month, year or nullThe last 1, 7, 30 or 365 days. Cannot be combined with start_date or end_date.
languagestring or nullA two-letter language code such as en or de. Applied by news, hn, social, communities, podcasts and academic, which store a language. web stores none: the language of each web result is detected from its text, the filter is applied to the best matches, and a language_detected warning says so.
countrystring or nullResults from this country. web and news: sites with the country's domain ending (.de, .co.uk; for US also .gov, .edu and .mil). finance: the filer's country. contracts: US or CA. Other sources get a filter_not_applied warning.
max_highlightsinteger, 0 to 50Return up to this many passages per result that best answer the query, in highlights, with highlight_spans. 0 keeps highlights as the snippet alone. Free.
highlight_charactersinteger, 100 to 600300Target length of one highlight. Needs max_highlights.
include_contentbooleanfalseAdd content to each result: the text of the page as we hold it, for web and news results. No request is made to the site. 1 credit per call, covering up to 10 results that come back with content; each further 10 (or part) 1 more; nothing when none comes back with content.
max_charactersinteger, 500 to 50,00010000Longest content.text to return. Needs include_content.
safe_searchoff, moderate, strict"moderate"
max_chars_per_resultinteger, 0 to 2,000800Longest snippet to return per result, in characters. 0 returns no snippets.
explainbooleanfalseAdd why and signals to every result. Free.

Notes:

Every filter below is free.

Boost, bury, block, only

Four verbs, and they work on sites, on page types and on topics:

VerbSitesPage typesTopics
Keep onlyinclude_domains (or only_domains)page_typestopics
Never returnexclude_domains (or block_domains)exclude_page_typesexclude_topics
Move aheadboost_domainsboost_page_typesboost_topics
Move to the endbury_domainsbury_page_typesbury_topics
JSON
{ "query": "rust lifetime elision", "page_types": ["tutorials", "documentation"], "bury_page_types": ["forums"], "exclude_page_types": ["listicles"] }

Page types and topics

Web and news results carry a page type (what kind of page it is) and a topic (what it is about); either can be null when it is not known. The page-type and topic lists act on web and news only. Another source in the same call gets a warning, even where its results carry the labels.

The two lists:

JSON
{ "query": "creatine", "boost_topics": ["science", "health"], "exclude_topics": ["sports"] }

Popularity

remove_top_sites and only_top_sites cut by rank. popularity_buckets keeps the buckets you name: top-100, top-1k, top-10k, top-100k, top-1m, long-tail. popular_in keeps sites that are popular in at least one of the countries you name, and each result lists its own countries in popular_in.

JSON
{ "query": "heat pump grant", "popular_in": ["GB", "IE"] }

Traffic trend

Each result says how visits to its site are moving, in traffic_trend: rising, spiking, steady, falling, dropped, new. rising is growing, spiking jumped sharply in the last days, falling is shrinking, dropped fell sharply, new appeared recently, steady shows no clear change. Send traffic_trend to keep only the sites moving the way you name.

Most sites are steady, and many small sites have no trend at all (null). A filter for rising or spiking therefore keeps few results and often none: use it with a broad query, ask for 20 or more results, and expect a short list, sometimes an empty one (the response then carries a short_results warning). To see the trend without filtering, read traffic_trend on each result.

JSON
{ "query": "best running shoes", "traffic_trend": ["rising", "spiking", "new"], "num_results": 20 }

Site technology

Each result lists what its site is built with in site_tech, for example ["WordPress", "WooCommerce"]. Send site_tech to keep only sites built with one of the names you give. Names are matched without regard to case.

JSON
{ "query": "handmade ceramic mugs", "site_tech": ["woocommerce"], "page_types": ["products"] }

Risk

A result whose site carries a risk label says so in risk. exclude_risky: true drops those results.

JSON
{ "query": "free vpn comparison", "popularity_buckets": ["long-tail", "top-1m"], "exclude_risky": true }

Dates, language and country

start_date and end_date are days written YYYY-MM-DD; both days are included. time_range is a shorthand for the last day, week, month or year and cannot be combined with the two dates. language is a two-letter language code and country a two-letter country code.

JSON
{ "query": "Bundestag Haushalt", "sources": ["news"], "time_range": "week", "language": "de" }

German pages from the web source. Web stores no language, so each result's language is detected from its text; the results say "language": "de" and the response carries a language_detected warning:

JSON
{ "query": "wärmepumpe förderung", "language": "de" }

A web result whose language cannot be told has language: null and does not pass a language filter. The filter is checked on the best matches for the query, not on the whole index, so the list can be short.

JSON
{ "query": "planning permission loft conversion", "country": "GB" }

Not every source can apply every one of these. A filter is never ignored silently: where a source cannot apply it, that source's results come back as if the filter had not been sent, and the response carries a filter_not_applied warning that names the filter and the sources. Three cases are more exact than that: hn and social hold the last 30 days, so a date range that ends earlier returns nothing from them, and the warning says so; a filter that is not available right now carries no sources and was applied nowhere; and include_content on a source without stored page text is reported the same way.

FilterApplied byElsewhere
start_date, end_date, time_rangenews, hn, social, communities, podcasts, academic, medical, law, finance, contractsweb pages carry no date of their own, so web gets a warning. So do smallweb and discussions
languagenews, hn, social, communities, podcasts, academic. web stores no language (it is mostly English, with pages in other languages too): the language of each web result is detected from its text, the filter is applied to the best matches, and a language_detected warning says soa warning
countryweb and news: sites with the country's domain ending, such as .de or .co.uk (for US also .gov, .edu and .mil). finance: the filer's country. contracts: US or CAa warning
page_types, topicsweb, newsa warning
exclude_page_types, boost_page_types, bury_page_types and the three topic listsweb, newsa warning
The domain lists, remove_top_sites, only_top_sites, popularity_buckets, traffic_trend, popular_in, site_tech, exclude_riskyevery source. A result with no site of its own, such as a post on a platform, has no site facts and does not pass a site filter

GET /v1/sources returns the same table as data: each source lists the filters it applies.

Highlights

max_highlights (0 to 5; 0 is off) returns the passages of each result that best answer the query, best first, in highlights. highlight_characters sets how long one passage should be. Highlights are free.

Each highlight has a span in highlight_spans, in the same order:

FieldTypeNotes
startinteger, 0 or more or nullCharacter offset (in Unicode code points) of the highlight in content.text as this result returns it. Null when there is nothing to point into: include_content was not sent, the highlight lies past the max_characters cut, or we hold no page text for the result.
endinteger or nullThe offset just past the highlight. Null with start.
scorenumber, 0 to 11.0 is a full-length passage of plain prose that holds every word of the query.
JSON
{ "query": "sourdough starter hydration", "max_highlights": 3 }

Without max_highlights, highlights is the snippet as a one-item list, as before.

Page content

include_content: true adds content to each web and news result: the text of the page as we hold it. We do not hold text for every result: those have content: null, are not charged, and the response carries a content_partial warning. No request is made to the site, so it is fast and it cannot be blocked. max_characters cuts the text (500 to 50,000, default 10,000).

FieldTypeNotes
textstringThe page's text: menus and page chrome removed, e-mail addresses and phone numbers redacted, cut at max_characters.
charactersintegerLength of text.
truncatedbooleanTrue when the page is longer than text.
captured_fromstringThe earliest day this copy can have been taken. Treat the page as being this old.
captured_tostringThe latest day this copy can have been taken. The same day as captured_from for news.

The text is cleaned: menus and page chrome are taken out, and e-mail addresses and phone numbers are replaced with [email] and [phone]. It is the page as it was when we captured it: for a web result captured_from and captured_to give the window, and you should treat the page as being as old as captured_from; for a news result both are the day the article was collected. A result we hold no text for has content: null.

JSON
{ "query": "sourdough starter hydration", "num_results": 5, "include_content": true, "max_characters": 4000 }

Content adds 1 credit to the call, which covers the page text of up to 10 results; each further 10 results that come back with text (or part of 10) add 1 more. A call where every content is null is not charged for content.

Rules between fields

Each of these is a 400 INVALID_PARAM: a value in both page_types and exclude_page_types (or in both topics and exclude_topics); more than 25 domains in include_domains and only_domains together (the same for exclude_domains and block_domains); a date outside the years 1000 to 2100; time_range together with start_date or end_date; max_characters without include_content; highlight_characters without max_highlights.

A saved scope: space

space searches with a saved scope from Spaces.

FieldTypeDefaultNotes
spacestring, up to 80 charactersThe Space to search with: its id (spc_ and 26 characters), a slug of your team, or curated: and the slug of a curated Space
JSON
{ "query": "sourdough hydration", "space": "baking" }

A Space is a saved set of the fields above: sites, the popularity cut, page types, topics, a lens, site filters, default sources and safe_search. A field you send in the request replaces the Space's value for that setting; everything you do not send comes from the Space. The answer then carries data.space, which names the Space, lists the settings it supplied (applied) and the request fields that replaced one (overridden). A Space costs nothing: the search costs what it would cost without it.

A Space that searches inside a list of sites applies its first 50; a longer list is cut and the answer carries a space_sites_cut warning. A Space that does not exist is a 404 SPACE_NOT_FOUND. Using a Space on a search has the table of which field replaces which setting, the shape of data.space and how such a search is counted.

Accepted for older clients

These fields are accepted so that existing clients keep working.

FieldTypeNotes
index_levelfull, top100, top1k, top10k, top100k, top1mEarlier spelling of remove_top_sites: top10k means remove_top_sites: 10000, full means 0.
modestandardThere is one mode. The field is accepted so existing clients keep working.

Examples

The web without its 10,000 most popular sites:

Example
Shell
curl https://api.millionshort.com/v1/search \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "sourdough starter hydration", "remove_top_sites": 10000 }'

Three sources, twenty results, with the reasons for each result:

Example
Shell
curl https://api.millionshort.com/v1/search \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "transformer interpretability",
    "sources": ["web", "academic", "hn"],
    "num_results": 20,
    "explain": true
  }'

Tutorials and documentation only, with two sites left out and one moved up:

Example
Shell
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"],
    "exclude_domains": ["example.com", "example.net"],
    "boost_domains": ["example.org"],
    "safe_search": "strict",
    "max_chars_per_result": 300
  }'

Response

JSON
{
  "data": {
    "results": [
      {
        "title": "Hydration levels for a sourdough starter, measured",
        "url": "https://example.org/starter-hydration",
        "site": "example.org",
        "source": "web",
        "snippet": "At 100% hydration the starter peaks in four to six hours...",
        "highlights": ["At 100% hydration the starter peaks in four to six hours..."],
        "published_date": null,
        "page_type": "articles",
        "topic": "food",
        "popularity": { "rank": null, "bucket": "long-tail" },
        "risk": null,
        "position": 1,
        "score": 1.0,
        "extra": { "author": "A. Baker" },
        "language": "en",
        "traffic_trend": "steady",
        "popular_in": null,
        "site_tech": ["WordPress"]
      }
    ],
    "summary": {
      "returned": 10,
      "removed": { "popularity": 37, "blocked": 0, "duplicates": 3, "risk": 0, "safe_search": 0, "filters": 0 }
    },
    "warnings": []
  },
  "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "search": 1 } },
  "warnings": [],
  "request_id": "req_..."
}

The values are an illustration and the list is cut to one result; the shape is exact.

A result

FieldTypeNotes
titlestring
urlstring
sitestring or nullThe host name
sourceweb, news, smallweb, discussions, hn, social, communities, podcasts, academic, medical, law, finance, contractsA source slug. GET /v1/sources describes each one.
snippetstringThe passage of the page that matches the query.
highlightsarray of stringsThe snippet as a one-item list. With max_highlights: up to that many passages that best answer the query, best first.
highlight_spansarray of objectsOnly with max_highlights: one entry per highlight, in the same order.
contentobject or nullOnly with include_content: the page's text, or null when we hold none for this result.
languagestring or nullThe result's language as a two-letter code, or null when not known. Stored by the source for news, hn, social, podcasts and academic; detected from the result's text for web, where a result whose language cannot be told has null and does not pass a language filter.
traffic_trendrising, spiking, steady, falling, dropped, new or nullHow visits to the result's site are moving, or null when not known.
popular_inarray of strings, up to 12 or nullThe countries (two-letter codes) where the result's site is among the popular sites, or null when not known.
site_techarray of strings, up to 8 or nullWhat the result's site is built with, for example [WordPress, WooCommerce]. An empty list when we looked and recognised nothing; null when we have not looked.
published_datestring or nullYYYY-MM-DD, or a year, when the source knows it. Web results have no date.
page_typestring or nullA page-type slug from GET /v1/sources.
topicstring or nullA topic slug from GET /v1/sources.
popularityobject
riskobject or null
positioninteger, 1 or more
scorenumberRank-based, from 1.0 for the first result downwards. Not comparable across calls.
extraobjectA few fields that only some sources have, such as authors, venue, year, citations, points or filer. Values are strings, numbers or booleans.
whyarray of stringsOnly with explain: why this result is here, at this position.
signalsobjectOnly with explain.

popularity:

FieldTypeNotes
rankinteger or nullThe site's popularity rank (1 is the most popular), or null when it is outside the top 1,000,000 or unknown.
buckettop-100, top-1k, top-10k, top-100k, top-1m, long-tail, unknown

risk is null for most sites. When a site carries a risk label:

FieldTypeNotes
levellabelled, demoted, blocked
categoriesarray of strings

signals, present only with explain:

FieldTypeNotes
text_rankinteger or nullPosition by text relevance alone.
link_authoritynumber, 0 to 10 or nullHow well linked the site is, 0 to 10. Null when the source has none for the result.
wordsinteger or nullLength of the page in words.

Summary

data.summary.returned is the number of results in the list. data.summary.removed counts what was taken out, by reason:

FieldTypeNotes
popularityintegerRemoved by remove_top_sites or only_top_sites.
blockedintegerRemoved by exclude_domains (block_domains), exclude_page_types or exclude_topics.
duplicatesinteger
riskinteger
safe_searchinteger
filtersintegerRemoved by popularity_buckets, traffic_trend, popular_in, site_tech or exclude_risky.

For some sources, web and news among them, the popularity cut and the domain lists are applied before results are counted, so popularity and blocked can be 0 when the filter plainly worked. Judge by the results that came back.

Usage

FieldTypeNotes
creditsnumberCredits charged for this call.
cost_usdnumberThe same amount in US dollars.
breakdownobjectCredits by line item, for example search and additional_results.

Warnings

A warning is a notice that did not fail the call. The same list appears as data.warnings and as the top-level warnings.

FieldTypeNotes
codeoption_not_supported, source_unavailable, short_results, filter_not_applied, language_detected, content_partial, content_unavailable
messagestring
optionstring
sourcestring
filterstringThe request field that was not applied.
sourcesarray of stringsThe sources it was not applied to. Absent when it was not applied at all.
requestedinteger
returnedinteger
with_contentinteger

A search with a space can also carry a space_sites_cut warning or a space_setting_not_applied warning.

Freshness

Most sources are kept current: social and hn within minutes, news every hour, podcasts twice a day, and academic, medical, contracts and communities every day; law statutes and regulations every day and court opinions every quarter; finance in batches, so its newest filings can be some days old. Results from those sources carry a published_date when the source knows it, and the date filters work on them.

The web source is different. It is a large snapshot that is rebuilt from time to time, not continuously. A page that changed recently may show its earlier text, and a page published after the snapshot is not there yet. Web results carry no date: published_date is null. For recent material, add a source that is kept current to the same call.

GET /v1/sources says how fresh each source is, and for the web source the dates between which its pages were captured, when they are published.

Cost

1 credit per source searched, which covers the first 10 results of the call. Each further 10 results, or part of 10, adds 0.5. explain, highlights and every filter are free. include_content adds 1 for the page text of up to 10 results, and 1 more for each further 10 with text. A call that fails or is refused costs nothing. Credits and limits has the worked examples.

Errors

400 INVALID_PARAM, 400 UNSUPPORTED_OPTION, 401, 429 (RATE_LIMITED, CAPACITY or INSUFFICIENT_CREDITS) and 502 SEARCH_UNAVAILABLE. With space, also 404 SPACE_NOT_FOUND for a Space that does not exist. See Errors.

This page as Markdown · llms.txt