# Map quickstart

List a site's URLs, then search inside it, then keep one section.

## 1. List a site

```bash
curl https://api.millionshort.com/v1/map \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.org/", "limit": 100 }'
```

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.map(url="https://example.org/", limit=100)
for u in r.urls:
    print(u["url"], u.get("title"), u["from"])
```

The same call with the TypeScript SDK:

```ts
import { MillionShort } from 'millionshort';

const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY });

const r = await client.map('https://example.org/', { limit: 100 });
for (const u of r.urls) console.log(u.url, u.title, u.from);
```

The answer lists the URLs in `data.urls`. Each one says where it was found, and carries what that source knew about it:

```json
{
  "data": {
    "url": "https://example.org/",
    "urls": [
      { "url": "https://example.org/", "title": "Example", "from": "links" },
      { "url": "https://example.org/docs/start", "title": "Getting started", "last_modified": "2026-11-01", "from": "links" },
      { "url": "https://example.org/pricing", "last_modified": "2026-10-14", "from": "sitemap" },
      { "url": "https://example.org/guides/tide-tables", "title": "Reading a tide table", "from": "index", "topic": "science", "page_type": "tutorials" }
    ],
    "summary": {
      "found": 4,
      "returned": 4,
      "truncated": false,
      "by_source": { "links": 2, "sitemap": 1, "index": 1 }
    }
  },
  "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "map": 1 } },
  "warnings": [],
  "request_id": "req_..."
}
```

`limit` is the most URLs you get back, and the credits for that many are held while the call runs. Ask for what you need: the default is 500.

## 2. Search inside the site

```bash
curl https://api.millionshort.com/v1/map \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.org/", "search": "pricing", "limit": 20 }'
```

```python
import os

import requests

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

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

With `search`, only matching URLs come back. The pages our index finds for the words in the page text come first. Then come the URLs whose address or title has every word.

## 3. Keep one section

```bash
curl https://api.millionshort.com/v1/map \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.org/docs",
    "include": ["^/docs/"],
    "exclude": ["^/docs/archive/"]
  }'
```

```python
import os

import requests

r = requests.post(
    "https://api.millionshort.com/v1/map",
    headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]},
    json={
        "url": "https://example.org/docs",
        "include": [
            "^/docs/"
        ],
        "exclude": [
            "^/docs/archive/"
        ]
    },
    timeout=30,
)
r.raise_for_status()
print(r.json()["data"])
```

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

`include` and `exclude` are regular expressions on the path of a URL. `^/docs/` keeps the paths that start with `/docs/`. `exclude` wins over `include`.

## 4. Check `truncated` and the warnings

`summary.truncated` is `true` when the site has more than you were given: `limit` cut the list, or the sitemaps were too large to read to the end. When one source could not be read, the answer still comes, with a `source_unavailable` warning that names the source.

## Next

- [Parameters](https://millionshort.com/docs/map/parameters): every field and the response.
- [Guides](https://millionshort.com/docs/map/guides): map a site, then read the pages you chose.
- [Crawl](https://millionshort.com/docs/crawl): the pages themselves, as a job.
