# Map

> List the URLs of one onion service without reading each page.

`POST /v2/map` finds the pages of one onion service. It follows links 2 deep, builds no Markdown and stores nothing but the job. Use it to see what a site holds before you [crawl](https://darkcrawl.dev/docs/endpoints/crawl/) it.

**curl**

```bash
curl -X POST https://api.darkcrawl.dev/v2/map \
  -H "Authorization: Bearer $DARKCRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/notice","search":"forum"}'
```

**Python**

```python
import os
import requests

resp = requests.post(
    "https://api.darkcrawl.dev/v2/map",
    headers={"Authorization": "Bearer " + os.environ["DARKCRAWL_API_KEY"]},
    json={
        "url": "http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/notice",
        "search": "forum",
    },
    timeout=330,
)
print(resp.json())
```

**Node**

```javascript
const resp = await fetch("https://api.darkcrawl.dev/v2/map", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.DARKCRAWL_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "url": "http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/notice",
    "search": "forum"
  }),
  signal: AbortSignal.timeout(330000),
});
console.log(await resp.json());
```

## Options

| Option                                       | What it does                                                         |
| -------------------------------------------- | -------------------------------------------------------------------- |
| `url`                                        | The service to map. Required.                                        |
| `search`                                     | Keep links whose URL or title holds this text. Case does not matter. |
| `limit`                                      | The most links to return. 5000 by default.                           |
| `timeout`                                    | Milliseconds, 1000 to 300000, 60000 by default.                      |
| `includeSubdomains`, `ignoreQueryParameters` | Both `true` by default.                                              |
| `sitemap`, `headers`                         | Also accepted.                                                       |

## Reply

`links` holds `{url, title?, description?}` for each page. When the time runs out, the reply carries a `warning` and the links found so far.

```json
{
  "success": true,
  "id": "01K0EXAMPLEMAP000000000000",
  "links": [
    {
      "url": "http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/",
      "title": "Notice"
    },
    {
      "url": "http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/forum",
      "title": "Forum",
      "description": "Sample forum index"
    },
    {
      "url": "http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/forum/rules"
    }
  ]
}
```

## Limits

A map counts as one request. It can reach the plan’s requests a minute and requests a day, shown on [Rate limits](https://darkcrawl.dev/docs/api-reference/rate-limits/).

## Reference

- [POST /v2/map](https://darkcrawl.dev/docs/api-reference/map/post-v2-map/)
