Menu

Build with

Spaces API

Create, list, change, delete and import Spaces: the saved scopes a search uses with one parameter.

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

A Space is a saved, named scope for POST /v1/search: a list of sites, a popularity cut, page types and topics to keep or leave out, what to boost, bury or block, site filters, default sources and safe search. Name it once, then pass space on any search. Spaces, under Search, says when one is worth making.

Spaces are free. Creating, keeping, reading, changing and deleting a Space costs 0 credits. A search that uses a Space costs what that search costs without it.

Endpoints

EndpointWhat it does
POST /v1/spacesCreate a Space. Answers 201 with the Space
GET /v1/spacesList Spaces: your team's, the curated ones, or both
GET /v1/spaces/{id}Read one
PATCH /v1/spaces/{id}Change the fields you send. The others stay
DELETE /v1/spaces/{id}Delete it
POST /v1/spaces/importLoad Spaces exported from the MillionShort search site
POST /v1/search with spaceSearch with a Space

All of them are free. The two reads do not count against your requests a minute.

{id} is any of three things, here and in space on a search:

FormExampleMeans
An idspc_01jd3v9k2m8q4r6s0t1u2v3w4xspc_ and 26 characters. Ours, and it never changes
A slugbakingA Space of your team, by the slug you gave it
curated: and a slugcurated:home-cookingOne of our curated Spaces

Create a Space

Only name is required.

Example
Shell
curl https://api.millionshort.com/v1/spaces \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Baking",
    "sites": ["example.org", "example.com/blog", "docs.example.net"],
    "remove_top_sites": 1000
  }'

The answer is the Space:

JSON
{
  "data": {
    "id": "spc_01jd3v9k2m8q4r6s0t1u2v3w4x",
    "slug": "baking",
    "name": "Baking",
    "description": null,
    "emoji": null,
    "curated": false,
    "mode": "only",
    "sites": ["example.org", "example.com/blog", "docs.example.net"],
    "exclude_sites": [],
    "remove_top_sites": 1000,
    "only_top_sites": 0,
    "page_types": [],
    "topics": [],
    "exclude_page_types": [],
    "exclude_topics": [],
    "lens": { "boost": [], "bury": [], "block": [] },
    "sources": null,
    "safe_search": null,
    "popularity_buckets": [],
    "traffic_trend": [],
    "popular_in": [],
    "site_tech": [],
    "exclude_risky": false,
    "created_at": "2026-11-18T10:00:00Z",
    "updated_at": "2026-11-18T10:00:00Z"
  },
  "usage": null,
  "warnings": [],
  "request_id": "req_..."
}

The values are an illustration; the fields are exact. usage is null on the Space endpoints: nothing is metered.

A Space that prefers some sites instead of searching inside them, with a lens and a site filter:

Example
Shell
curl https://api.millionshort.com/v1/spaces \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Primary sources",
    "mode": "boost",
    "sites": ["example.org", "example.edu"],
    "lens": {
      "boost": ["type:research"],
      "bury": ["type:listicles"],
      "block": ["topic:adult", "site:example.net"]
    },
    "exclude_risky": true
  }'

The Space object

FieldTypeDefaultNotes
idstringspc_ and 26 characters. Set by us; it never changes
slugstring, 1 to 40 charactersmade from nameLower-case letters, digits and hyphens, starting with a letter or a digit. Unique in your team. Made from name when not sent; if that one is taken it gets -2, -3 and so on
namestring, 1 to 60 charactersRequired when creating
descriptionstring or null, up to 200 charactersnull
emojistring or null, up to 16 charactersnull
curatedbooleantrue for a Space of ours: readable by everyone, and read-only. Set by us
modeonly or boost"only"What sites means: search inside these sites, or prefer them
sitesarray of strings, up to 200[]A host (example.com, docs.example.com) or a host with a path prefix (example.com/blog). May be empty
exclude_sitesarray of strings, up to 150[]Hosts. Never return results from these. The limit of 150 is shared with the site: targets of lens.block
remove_top_sitesinteger, 0 to 1,000,0000Remove results from the N most popular sites. 0 is off
only_top_sitesinteger, 0 to 1,000,0000Keep only the N most popular sites. Cannot be set together with remove_top_sites
page_typesarray of strings[]Keep only these page types. Slugs from GET /v1/sources
topicsarray of strings[]Keep only these topics
exclude_page_typesarray of strings[]Leave these page types out
exclude_topicsarray of strings[]Leave these topics out
lensobjectboost, bury and block: three lists of targets. See below
sourcesarray of strings, 1 to 5 items, or nullnullDefault sources for a search with this Space. null: the search's own sources, or web
safe_searchoff, moderate, strict or nullnullnull: the search's own, or moderate
popularity_bucketsarray of strings[]As on a search
traffic_trendarray of strings[]As on a search
popular_inarray of strings, up to 10[]Two-letter country codes, as on a search
site_techarray of strings, up to 10[]As on a search
exclude_riskybooleanfalseAs on a search
created_at, updated_atdate and timeUTC

id, curated, created_at and updated_at are ours: sending one is a 400 INVALID_PARAM, like any field this table does not list.

The lens

lens holds three lists, boost, bury and block, of up to 100 targets each. A target is one of:

TargetExampleActs on
site: and a hostsite:example.orgResults from that site
type: and a page type slugtype:forumsResults of that kind of page
topic: and a topic slugtopic:scienceResults on that topic

A target can be in one of the three lists only. Boost moves results ahead, bury moves them to the end, block removes them: the same verbs as the lenses of a search.

Blocking through the lens and through the plain fields is the same thing. lens.block with a site: target does what exclude_sites does, and with a type: or topic: target what exclude_page_types or exclude_topics does. Both spellings are stored as you sent them and applied together.

Rules

Each of these is a 400 INVALID_PARAM:

Limits

PlanSpaces per team
Trial key, Free10
Starter, Growth, Scale100
Business, Enterprise1,000

Creating one more than the plan allows is refused with 403 QUOTA_EXCEEDED; error.details.limit is the plan's number. Delete a Space or move to a larger plan.

List Spaces

Example
Shell
curl "https://api.millionshort.com/v1/spaces?scope=all" \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY"
scopeReturns
ownYour team's Spaces, newest first. The default
curatedOur curated Spaces, by name
allBoth, your team's first
JSON
{
  "data": {
    "spaces": [
      {
        "id": "spc_01jd3v9k2m8q4r6s0t1u2v3w4x",
        "slug": "baking",
        "name": "Baking",
        "curated": false,
        "mode": "only",
        "sites": ["example.org", "example.com/blog", "docs.example.net"],
        "remove_top_sites": 1000,
        "created_at": "2026-11-18T10:00:00Z",
        "updated_at": "2026-11-18T10:00:00Z"
      }
    ]
  },
  "usage": null,
  "warnings": [],
  "request_id": "req_..."
}

Each entry is a whole Space; the sample is shortened.

Read a Space

By id, by your slug, or a curated one:

Example
Shell
curl https://api.millionshort.com/v1/spaces/$SPACE_ID \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY"
Example
Shell
curl https://api.millionshort.com/v1/spaces/curated:home-cooking \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY"

The answer is the Space, in data, as in the answer to a create. curated:home-cooking stands for any curated slug; GET /v1/spaces?scope=curated lists the real ones.

Change a Space

PATCH takes the same fields as a create, all optional. A field you send replaces the stored value; a field you leave out stays as it is. lens is one field: a lens you send replaces all three of its lists, so send the lists you want to keep. A PATCH with no field is a 400 INVALID_PARAM.

Example
Shell
curl -X PATCH https://api.millionshort.com/v1/spaces/$SPACE_ID \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "remove_top_sites": 10000, "exclude_page_types": ["listicles"] }'

The answer is the Space after the change.

Sending slug renames the Space. Searches that pass the old slug stop finding it, so update them first or refer to the Space by its id, which keeps working.

Delete a Space

Example
Shell
curl -X DELETE https://api.millionshort.com/v1/spaces/$SPACE_ID \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY"
JSON
{
  "data": { "id": "spc_01jd3v9k2m8q4r6s0t1u2v3w4x", "deleted": true },
  "usage": null,
  "warnings": [],
  "request_id": "req_..."
}

A search that still names a deleted Space is answered with 404 SPACE_NOT_FOUND.

Import from the search site

A Space here is the same object as a Space on the MillionShort search site. POST /v1/spaces/import takes the search site's export file as it is, so the Spaces you made by hand there can be used by your agent.

Example
Shell
curl https://api.millionshort.com/v1/spaces/import \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "millionshort_spaces": 1,
    "spaces": [
      {
        "id": "baking",
        "name": "Baking",
        "about": "Bread, mostly",
        "mode": "only",
        "sites": ["example.org", "example.com/blog"],
        "remove_top": 1000,
        "lens": { "boost": ["type:tutorials"], "bury": [], "block": ["type:products"] }
      }
    ]
  }'

The body is the export file, or {"spaces": [...]} with 1 to 100 entries. An entry is a Space as the search site writes it, or a Space as this API returns it. The search site's fields map like this:

Search siteHere
idslug
name, emoji, mode, sites, lensThe same
aboutdescription
remove_topremove_top_sites
JSON
{
  "data": {
    "imported": [
      {
        "id": "spc_01jd3v9k2m8q4r6s0t1u2v3w4x",
        "slug": "baking",
        "name": "Baking",
        "description": "Bread, mostly",
        "curated": false,
        "mode": "only",
        "sites": ["example.org", "example.com/blog"],
        "remove_top_sites": 1000,
        "lens": { "boost": ["type:tutorials"], "bury": [], "block": ["type:products"] },
        "created_at": "2026-11-18T10:00:00Z",
        "updated_at": "2026-11-18T10:00:00Z"
      }
    ],
    "skipped": []
  },
  "usage": null,
  "warnings": [],
  "request_id": "req_..."
}

Pass space on POST /v1/search: an id, a slug of your team, or curated: and a slug.

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

The request wins

A parameter you send in the request replaces the Space's value for that setting. Everything you do not send comes from the Space. So a Space is a set of defaults, and one search can step outside it without changing it.

Setting of the SpaceReplaced when the request sends
sourcessources
sites, with mode: onlyinclude_domains or only_domains
sites, with mode: boost, and the site: targets of lens.boostboost_domains
The site: targets of lens.burybury_domains
exclude_sites, and the site: targets of lens.blockexclude_domains or block_domains
remove_top_sites, only_top_sitesremove_top_sites, only_top_sites or index_level. Any one of them replaces both
page_typespage_types
topicstopics
exclude_page_types, and the type: targets of lens.blockexclude_page_types
exclude_topics, and the topic: targets of lens.blockexclude_topics
The type: targets of lens.boostboost_page_types
The type: targets of lens.burybury_page_types
The topic: targets of lens.boostboost_topics
The topic: targets of lens.burybury_topics
safe_search, popularity_buckets, traffic_trend, popular_in, site_tech, exclude_riskyThe parameter of the same name

A replacement is whole: a list in the request takes the place of the Space's list, and the two are not merged.

When the request keeps a page type or topic that the Space leaves out, or leaves out one the Space keeps, the request's list stands and that slug is dropped from the Space's list for this search. The call is not refused.

Everything else on the request (query, num_results, dates, language, country, highlights, include_content, explain) works as on any search.

mode: only applies the first 50 sites

A Space can hold up to 200 sites. A search inside a list of sites uses the first 50 of them, in the order of sites. A longer list is cut, and the answer says so twice: a space_sites_cut warning, and sites_applied lower than sites_total in data.space. Put the sites that matter most first, or split a long list into two Spaces.

With mode: boost the search is not limited to the sites, so nothing is cut out of the results. A path prefix does not narrow a preference: example.com/blog prefers the whole of example.com.

What the answer adds

A search with a Space has data.space: the Space that was used and what it supplied.

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": {}
      }
    ],
    "summary": {
      "returned": 10,
      "removed": { "popularity": 0, "blocked": 0, "duplicates": 1, "risk": 0, "safe_search": 0, "filters": 0 }
    },
    "warnings": [],
    "space": {
      "id": "spc_01jd3v9k2m8q4r6s0t1u2v3w4x",
      "slug": "baking",
      "name": "Baking",
      "curated": false,
      "mode": "only",
      "sites_total": 3,
      "sites_applied": 3,
      "applied": {
        "include_domains": ["example.org", "example.com/blog", "docs.example.net"],
        "remove_top_sites": 1000
      },
      "overridden": []
    }
  },
  "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "search": 1 } },
  "warnings": [],
  "request_id": "req_..."
}
FieldTypeNotes
id, slug, name, curated, modeOf the Space that was used
sites_totalintegerHow many sites the Space holds
sites_appliedintegerHow many of them this search used. Lower than sites_total when the list was cut, or when the request replaced it
appliedobjectThe settings the Space supplied to this search, under the names of the search parameters
overriddenarray of stringsThe request parameters that replaced a setting of the Space

Read applied and overridden to see exactly what was searched: together with your own request they are the whole scope.

Warnings

Warning codeMeaning
space_sites_cutThe Space has mode: only and lists more sites than one search uses (50; 20 without a key). sites_total and sites_applied in the warning give the numbers
space_setting_not_appliedSomething the Space asks for was left out: a setting that cannot be applied right now (named in settings), or a page type, topic or source that no longer exists (named in values). The search ran without it

A setting of a Space is never dropped silently. The warnings a search can carry on its own, such as a filter_not_applied warning for page types on a source that has none, apply to settings that came from a Space as well.

How a search inside a list of sites is counted

A search inside a list of sites on the web source, whether the list comes from a Space with mode: only or from include_domains in the request, is more work than a plain search. Its price is the same, 1 credit per source. Two limits count it differently:

Credits and limits has each plan's numbers.

Without a key

The playground and the no-key mode of the MCP server can list the curated Spaces and search with one, as curated: and its slug. Their own bounds stay: one source (the first, when the Space names several), up to five results, and the first 20 sites of a Space with mode: only, said in a space_sites_cut warning. Making a Space needs a key.

Curated Spaces

Curated Spaces are ours: scopes we have put together for a subject, the same ones the MillionShort search site offers. Every caller can read them and search with them, and nobody but us can change them.

Errors

CodeHTTPMeaningRetry?
SPACE_NOT_FOUND404No such Space for this caller: it does not exist, or it belongs to another team. The two are not told apart.No.
SPACE_READ_ONLY403A curated Space cannot be changed or deleted.No. Create your own Space from its fields.

Also: 400 INVALID_PARAM for the cases under Rules; 403 QUOTA_EXCEEDED at the plan's number of Spaces; 401 for a missing or refused key; 429. A search that names a Space that does not exist is answered with 404 SPACE_NOT_FOUND and charged nothing. See Errors.

In the SDKs

Both SDKs carry one method per endpoint, and space on search:

EndpointPythonTypeScript
POST /v1/spacescreate_spacecreateSpace
GET /v1/spaceslist_spaceslistSpaces
GET /v1/spaces/{id}get_spacegetSpace
PATCH /v1/spaces/{id}update_spaceupdateSpace
DELETE /v1/spaces/{id}delete_spacedeleteSpace
POST /v1/spaces/importimport_spacesimportSpaces
POST /v1/search with spacesearch(..., space="baking")search(..., { space: 'baking' })

The Python and TypeScript pages have samples.

Over MCP

Two tools of the MCP server work with Spaces: list_spaces, which only reads and lists the curated Spaces without a key, and create_space, which needs a key. The search tool takes space.

Without a Space

A Space saves what a search request can already say. To keep the scope in your own store instead, send it with each search: include_domains or boost_domains for the sites, remove_top_sites, the page-type and topic lists, and the site filters. Lenses and Filters for agents show each one.

This page as Markdown · llms.txt