# POST /v2/map

> List the pages of one onion site, found by a short crawl of its links.

POST `/v2/map`

**Authentication:** your key as a [bearer token](https://darkcrawl.dev/docs/api-reference/authentication/).

## Body

| Field                   | Type                                       | Required | Default     |
| ----------------------- | ------------------------------------------ | -------- | ----------- |
| `url`                   | `string`                                   | Required |             |
| `headers`               | `object`                                   | Optional | `{}`        |
| `ignoreQueryParameters` | `boolean`                                  | Optional | `true`      |
| `includeSubdomains`     | `boolean`                                  | Optional | `true`      |
| `limit`                 | `integer`                                  | Optional | `5000`      |
| `search`                | `string \| null`                           | Optional |             |
| `sitemap`               | `string` Values: `skip`, `include`, `only` | Optional | `"include"` |
| `timeout`               | `integer \| null`                          | Optional |             |

Firecrawl compatibility fields

Firecrawl fields DarkCrawl does not offer. It takes them so the Firecrawl SDKs keep working, then ignores or refuses each one as the table says.

| Field              | What DarkCrawl does               |
| ------------------ | --------------------------------- |
| `auditMetadata`    | Accepted and ignored.             |
| `filterByPath`     | Ignored, with a warning when set. |
| `ignoreCache`      | Ignored, with a warning when set. |
| `integration`      | Accepted and ignored.             |
| `location`         | Ignored, with a warning when set. |
| `origin`           | Accepted and ignored.             |
| `threatProtection` | Accepted and ignored.             |
| `useIndex`         | Ignored, with a warning when set. |
| `useMock`          | Accepted and ignored.             |

## Request

**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());
```

## Response

Status `200`.

```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"
    }
  ]
}
```

## Errors

| Code                    | Status |
| ----------------------- | ------ |
| `BAD_REQUEST`           | 400    |
| `INVALID_ONION`         | 400    |
| `POLICY_FORBIDDEN`      | 400    |
| `BLOCKLISTED`           | 403    |
| `ONION_UNREACHABLE`     | 502    |
| `TOR_NOT_READY`         | 503    |
| `BLOCKLIST_UNAVAILABLE` | 503    |

What each code means, and what to do about it: [Errors](https://darkcrawl.dev/docs/api-reference/errors/).

## Notes

- Map follows links two levels deep, builds no Markdown and stores nothing but the job. `search` keeps the links whose address or title holds that text, whatever its case.
- `warning` is in the reply when the time box ran out before the walk ended.
- `title` and `description` are in a link only when the page gave one.
