# POST /v2/search

> Search the pages DarkCrawl has stored, and Ahmia for what is missing when the server is set up to ask it.

POST `/v2/search`

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

## Body

| Field                                | Type                                       | Required | Default        |
| ------------------------------------ | ------------------------------------------ | -------- | -------------- |
| `query`                              | `string`                                   | Required |                |
| `includeClones`                      | `boolean`                                  | Optional | `false`        |
| `limit`                              | `integer`                                  | Optional | `5`            |
| `scrapeOptions`                      | `object \| null`                           | Optional |                |
| `scrapeOptions.checkPromptInjection` | `boolean \| null`                          | Optional |                |
| `scrapeOptions.excludeTags`          | `string[]`                                 | Optional | `[]`           |
| `scrapeOptions.formats`              | `(string \| object)[]`                     | Optional | `["markdown"]` |
| `scrapeOptions.headers`              | `object`                                   | Optional | `{}`           |
| `scrapeOptions.includeTags`          | `string[]`                                 | Optional | `[]`           |
| `scrapeOptions.maxTextBytes`         | `integer \| null`                          | Optional |                |
| `scrapeOptions.onlyMainContent`      | `boolean`                                  | Optional | `true`         |
| `scrapeOptions.parsers`              | `(string \| object)[]`                     | Optional |                |
| `scrapeOptions.redactPII`            | `boolean \| object`                        | Optional |                |
| `scrapeOptions.render`               | `string` Values: `auto`, `never`, `always` | Optional | `"auto"`       |
| `scrapeOptions.skipTlsVerification`  | `boolean`                                  | Optional | `false`        |
| `scrapeOptions.timeout`              | `integer \| null`                          | Optional |                |
| `scrapeOptions.waitFor`              | `integer`                                  | Optional | `0`            |
| `siteCategories`                     | `string[] \| null`                         | Optional |                |
| `sources`                            | `(string \| object)[] \| null`             | Optional |                |
| `sources[].type`                     | `string`                                   | Required |                |
| `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                                   |
| ---------------------------------- | ----------------------------------------------------- |
| `categories`                       | Ignored, with a warning when set.                     |
| `country`                          | Ignored, with a warning when set.                     |
| `domainTools`                      | Ignored, with a warning when set.                     |
| `enterprise`                       | Ignored, with a warning when set.                     |
| `excludeDomains`                   | Ignored, with a warning when set.                     |
| `highlights`                       | Ignored, with a warning when set.                     |
| `ignoreInvalidURLs`                | Ignored, with a warning when set.                     |
| `includeDomains`                   | Ignored, with a warning when set.                     |
| `integration`                      | Accepted and ignored.                                 |
| `location`                         | Ignored, with a warning when set.                     |
| `origin`                           | Accepted and ignored.                                 |
| `scrapeOptions.actions`            | Answers 400 NOT_IMPLEMENTED when not empty.           |
| `scrapeOptions.auditMetadata`      | Accepted and ignored.                                 |
| `scrapeOptions.blockAds`           | Ignored, with a warning when not Firecrawl's default. |
| `scrapeOptions.domainTools`        | Accepted and ignored.                                 |
| `scrapeOptions.fastMode`           | Ignored, with a warning when not Firecrawl's default. |
| `scrapeOptions.integration`        | Accepted and ignored.                                 |
| `scrapeOptions.location`           | Ignored, with a warning when not Firecrawl's default. |
| `scrapeOptions.lockdown`           | Answers 400 BAD_REQUEST when true.                    |
| `scrapeOptions.maxAge`             | Ignored, with a warning when not Firecrawl's default. |
| `scrapeOptions.minAge`             | Answers 400 BAD_REQUEST when set.                     |
| `scrapeOptions.mobile`             | Ignored, with a warning when not Firecrawl's default. |
| `scrapeOptions.onlyCleanContent`   | Ignored, with a warning when not Firecrawl's default. |
| `scrapeOptions.origin`             | Accepted and ignored.                                 |
| `scrapeOptions.profile`            | Ignored, with a warning when not Firecrawl's default. |
| `scrapeOptions.proxy`              | Ignored, with a warning when not Firecrawl's default. |
| `scrapeOptions.removeBase64Images` | Accepted and ignored.                                 |
| `scrapeOptions.safeMode`           | Ignored, with a warning when not Firecrawl's default. |
| `scrapeOptions.storeInCache`       | Ignored, with a warning when not Firecrawl's default. |
| `scrapeOptions.threatProtection`   | Accepted and ignored.                                 |
| `scrapeOptions.toolDetail`         | Accepted and ignored.                                 |
| `scrapeOptions.useMock`            | Accepted and ignored.                                 |
| `scrapeOptions.zeroDataRetention`  | Ignored, with a warning when not Firecrawl's default. |
| `tbs`                              | Ignored, with a warning when set.                     |
| `threatProtection`                 | Ignored, with a warning when set.                     |
| `toolDetail`                       | Ignored, with a warning when set.                     |

## Request

**curl**

```bash
curl -X POST https://api.darkcrawl.dev/v2/search \
  -H "Authorization: Bearer $DARKCRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"debian mirror","limit":5}'
```

**Python**

```python
import os
import requests

resp = requests.post(
    "https://api.darkcrawl.dev/v2/search",
    headers={"Authorization": "Bearer " + os.environ["DARKCRAWL_API_KEY"]},
    json={
        "query": "debian mirror",
        "limit": 5,
    },
    timeout=330,
)
print(resp.json())
```

**Node**

```javascript
const resp = await fetch("https://api.darkcrawl.dev/v2/search", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.DARKCRAWL_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "query": "debian mirror",
    "limit": 5
  }),
  signal: AbortSignal.timeout(330000),
});
console.log(await resp.json());
```

## Response

Status `200`.

```json
{
  "success": true,
  "data": {
    "web": [
      {
        "url": "http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/mirrors",
        "title": "Mirror list",
        "description": "A plainly fictional list of mirrors.",
        "position": 1,
        "captureId": "01K0EXAMPLECAPTURE0000000A",
        "fetchedAt": "2026-11-26T10:00:00+00:00"
      },
      {
        "url": "http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/forum/thread/1",
        "title": "Sample thread",
        "description": "Nothing real here.",
        "position": 2
      }
    ]
  }
}
```

## Errors

| Code                    | Status |
| ----------------------- | ------ |
| `BAD_REQUEST`           | 400    |
| `SEARCH_UNAVAILABLE`    | 503    |
| `SCRAPE_TIMEOUT`        | 408    |
| `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

- Stored pages come first, best match first. A stored result also has `captureId` and `fetchedAt`; a result from Ahmia never does.
- With `scrapeOptions` each result is scraped, and the call reserves its pages first, as a crawl does. [Rate limits](https://darkcrawl.dev/docs/api-reference/rate-limits/) says how.
- `warning` is one string when there is something to say, for example that results were dropped.
- The query is read for matching terms and quoted phrases. See the [Search guide](https://darkcrawl.dev/docs/endpoints/search/).
