> ## Documentation Index
> Fetch the complete documentation index at: https://docs.llmlayer.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Map API

> Discover URLs on a website without scraping page content.

## Overview

Use Map when you need a list of URLs from a website before deciding what to scrape, crawl, or analyze. Map discovers links; it does not return page body content.

For multi-page content extraction, use [Crawl](/crawl). For a single page, use [Scraper](/scrape) or [Extract](/extract).

## Endpoint

`POST /api/v2/map`

## Quickstart

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { LLMLayerClient } from 'llmlayer';

  const client = new LLMLayerClient({
    apiKey: process.env.LLMLAYER_API_KEY,
  });

  const site = await client.map('https://www.ycombinator.com', {
    limit: 100,
    search: 'blog',
  });

  for (const link of site.links.slice(0, 10)) {
    console.log(link.url, link.title);
  }
  ```

  ```python Python theme={null}
  from llmlayer import LLMLayerClient

  client = LLMLayerClient(api_key="YOUR_LLMLAYER_API_KEY")

  site = client.map(
      "https://www.ycombinator.com",
      limit=100,
      search="blog",
  )

  for link in site.links[:10]:
      print(str(link.url), link.title)
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.llmlayer.dev/api/v2/map \
    -H "Authorization: Bearer YOUR_LLMLAYER_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "url": "https://www.ycombinator.com",
      "limit": 100,
      "search": "blog"
    }'
  ```
</CodeGroup>

## Request Parameters

| Parameter           | Type              | Required | Default | Description                           |
| ------------------- | ----------------- | -------- | ------- | ------------------------------------- |
| `url`               | `string`          | Yes      | -       | Website URL to map                    |
| `ignoreSitemap`     | `boolean`         | No       | `false` | Ignore sitemap.xml discovery          |
| `includeSubdomains` | `boolean`         | No       | `false` | Include subdomains                    |
| `search`            | `string \| null`  | No       | `null`  | Filter discovered URLs/titles by text |
| `limit`             | `integer`         | No       | `5000`  | Maximum links to return               |
| `timeout`           | `integer \| null` | No       | `45000` | Timeout in milliseconds               |

<Note>
  The raw API uses camelCase for map request fields: `ignoreSitemap` and `includeSubdomains`. The Python SDK maps these to `ignore_sitemap` and `include_subdomains`.
</Note>

## Response

```json theme={null}
{
  "links": [
    {
      "url": "https://www.ycombinator.com/blog",
      "title": "YC Blog"
    }
  ],
  "statusCode": 200,
  "cost": 0.002
}
```

| Field        | Type             | Description                             |
| ------------ | ---------------- | --------------------------------------- |
| `links`      | `array`          | Discovered links with `url` and `title` |
| `statusCode` | `integer`        | `200` on success                        |
| `cost`       | `number \| null` | Cost in USD                             |

## Common Patterns

### Map then crawl

Use Map to inspect the URL surface before crawling.

```typescript theme={null}
const site = await client.map('https://www.ycombinator.com', {
  limit: 50,
});

const blogPages = site.links.filter((link) => link.url.includes('/blog'));
console.log(blogPages.map((link) => link.url));
```

### Map then scrape selected pages

```python theme={null}
site = client.map("https://www.ycombinator.com", search="blog", limit=20)

for link in site.links[:3]:
    page = client.scrape(str(link.url), formats=["markdown"], main_content_only=True)
    print(page.title, page.markdown[:200] if page.markdown else "")
```

## Pricing

Map costs `$0.002` per request.

## Errors

| Status | Meaning                             |
| ------ | ----------------------------------- |
| `400`  | Invalid URL or request parameters   |
| `401`  | Missing or invalid LLMLayer API key |
| `403`  | Blocked private/unsafe target       |
| `500`  | Mapping provider or internal error  |

See [Errors & Refunds](/errors) for the shared error format.

## More Examples

<CardGroup cols={2}>
  <Card title="Search + Scrape Pipeline" icon="diagram-project" href="/examples/search-scrape">
    Find and process selected pages.
  </Card>

  <Card title="Crawl API" icon="spider" href="/crawl">
    Stream markdown from multiple pages.
  </Card>
</CardGroup>
