# Quickstart

Get a key, send one request, read the results.

MillionShort searches the web and 13 sources in all from one endpoint, on our own independent index. This page takes you from nothing to a first result.

## 1. Get a key

Create a key in the [dashboard](https://millionshort.com/app/). The Free plan needs no card. A key starts with `ms-` and is shown once, so copy it when it appears.

Keep the key in an environment variable so it stays out of your code:

```bash
export MILLIONSHORT_API_KEY="ms-YOUR_API_KEY"
```

An agent that cannot sign up can ask for a short-lived trial key instead. See [Authentication](https://millionshort.com/docs/authentication#trial-key-for-agents).

## 2. Send a search

This asks for five results from the web with the 10,000 most popular sites removed:

```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",
    "remove_top_sites": 10000,
    "num_results": 5
  }'
```

The same call with the Python SDK:

```python
import os

from millionshort import MillionShort

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

r = client.search(
    "restoring a cast iron skillet",
    remove_top_sites=10000,
    num_results=5,
)
for hit in r.results:
    print(hit["position"], hit["title"], hit["url"])
print(r.usage.credits, r.request_id)
```

And with the TypeScript SDK:

```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', {
  removeTopSites: 10000,
  numResults: 5,
});
for (const hit of r.results) {
  console.log(hit.position, hit.title, hit.url);
}
console.log(r.usage?.credits, r.requestId);
```

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",
      "remove_top_sites": 10000,
      "num_results": 5
    }
  }
}
```

The SDKs install with `pip install millionshort` and `npm install millionshort`. **Neither package is published yet**, so until they are, use `curl` or any HTTP client as above. The SDK pages cover both: [Python](https://millionshort.com/docs/sdks/python), [TypeScript](https://millionshort.com/docs/sdks/typescript).

## 3. Read the response

Every success has the same four parts: `data`, `usage`, `warnings` and `request_id`.

```json
{
  "data": {
    "results": [
      {
        "title": "Restoring a rusted skillet: notes from thirty years at a foundry",
        "url": "https://example.org/skillet-restoration",
        "site": "example.org",
        "source": "web",
        "snippet": "Strip the old seasoning down to bare iron before you start...",
        "highlights": ["Strip the old seasoning down to bare iron before you start..."],
        "published_date": null,
        "page_type": "articles",
        "topic": "home",
        "popularity": { "rank": null, "bucket": "long-tail" },
        "risk": null,
        "position": 1,
        "score": 1.0,
        "extra": {}
      }
    ],
    "summary": {
      "returned": 5,
      "removed": { "popularity": 41, "blocked": 0, "duplicates": 2, "risk": 0, "safe_search": 0 }
    },
    "warnings": []
  },
  "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "search": 1 } },
  "warnings": [],
  "request_id": "req_..."
}
```

The values above are an illustration, and the list is cut to one result. `popularity.bucket` says how popular the result's site is, and `summary.removed.popularity` counts results the popularity cut took out of the list (for some sources, `web` and `news` among them, the cut is applied before results are counted and this stays 0). The SDKs unwrap `data`, so `results` and `summary` sit directly on the object they return.

## 4. Try more

- Search several sources at once: `"sources": ["web", "news", "academic"]`. The [Sources](https://millionshort.com/docs/api-reference/sources) page lists all of them.
- Keep only the most popular sites instead, with `only_top_sites`.
- Add `"explain": true` to see why each result is where it is. It is free.
- Give the same search to an agent through the [MCP server](https://millionshort.com/docs/mcp).

The [Search reference](https://millionshort.com/docs/search/parameters) has every field. [Credits and limits](https://millionshort.com/docs/credits-and-limits) says what a call costs.
