# Preview a search

The most a search can cost, with the same body as POST /searches. No source call and nothing is charged. Use it before you set `max_credits`.

The most a search can cost, with the same body as POST /searches. No source call and nothing is charged. Use it before you set `max_credits`.

## Authentication

Send `Authorization: Bearer gtk_…`. Create the key under **API Access → API Keys**. A missing, invalid or revoked key is **401**, including while this API is closed. A valid key while the API is closed for your organization answers **404**, the same body as an unknown path. Every response includes `FounderMCP-Api-Version` and `FounderMCP-Request-Id`.

### Body parameters

- **`signal`** `object` · **required** — Required. `type` is `linkedin_engagement` (needs `company.linkedin_url`), `social_listening` (needs `query`), `funding_raised` (needs `countries`), `new_in_role` (needs `titles`), `events` (needs `event.event_id` or `event.name`; `event_posts` is the old name) or `tech_adoption` (needs `technologies`, raw only).
- **`mode`** `string` — Left out uses the type default: `raw` for every type. `raw` returns the rows of the source, with no AI judging them. Send `screened` to have our AI check people against `buyer_profile` (not for tech adoption). One of: `raw`, `screened`.
- **`buyer_profile`** `object` — Buyer profile, mode screened only. `roles` (departments: `ceo`, `sales`, `marketing`, `finance`, `operations`, `hr`, `it`, `talent_acquisition`, `engineering`, `product`, `customer_success`, `data`, `procurement`, `legal`), `titles`, `levels` (`c_level`, `vp`, `director`, `manager`), `countries` (ISO alpha-2, or `EUROPE`), `allow_recruiters`, `allow_vendors`. `sectors` and `company_sizes` only on `new_in_role`. Empty means anyone.
- **`exclude_companies`** `object[]` — Up to 20 LinkedIn company pages whose rows are never delivered. Tech adoption uses `signal.exclude_domains` instead.
- **`max_leads`** `integer` — Mode screened. Caps at 10 for engagement, listening and events, and 25 for funding and new-in-role. A higher number is clamped. Defaults to 25, then clamped.
- **`just_outside`** `string` — Mode screened. `auto` (default) and `always` fill up to 10 rows with near-misses. `never` returns exact leads only. One of: `auto`, `never`, `always`.
- **`limit`** `integer` — Mode raw. How many rows. Capped at the type maximum from GET /signals.
- **`cursor`** `string | null` — Mode raw. `result.next_cursor` of an earlier raw search with the same signal. One chain delivers at most 500 rows, kept 30 days.
- **`webhook_endpoint_id`** `string | null` — A webhook endpoint id (`whe_…`) that receives this search’s events.
- **`metadata`** `object` — Up to 10 string values. Keys 1–40 characters, values up to 200.
- **`max_credits`** `integer | null` — Stop before the next row would pass this. Below one row the call is `402` `max_credits_exceeded` and nothing runs.

## Response

- **`object`** `string` · **required** — Always `cost_preview`. One of: `cost_preview`.
- **`endpoint`** `string` · **required** — Which call this previews. One of: `searches`, `leads`, `person.enrich`, `monitors`.
- **`row_key`** `string` · **required** — The row type that sets the headline price.
- **`credits_per_row`** `integer` · **required** — Credits for one row of `row_key`.
- **`max_rows`** `integer` · **required** — The most rows this call can return.
- **`max_credits`** `integer` · **required** — The most the call can spend. A `max_credits` you sent caps it.
- **`period`** `string` · **required** — `call` for one request, `day` for a monitor. One of: `call`, `day`.
- **`rows`** `object[]` · **required** — Every row type the call can deliver: `row_key`, `credits_per_row`, `max_rows`.
- **`notes`** `string[]` · **required** — Plain-language limits of this preview.

## Credits

Free.

## Errors

- **400** `invalid_request` — The body would also be rejected by POST /searches.
- **401** `authentication_error` — The Authorization header is missing, or the key is unknown or revoked.
- **403** `permission_error` — API access is not part of your plan, or your account is suspended.
- **404** `not_found` — The endpoint does not exist.
- **429** `rate_limit_error` — More than 60 requests per minute, or more than 3 at the same time, on one key. Wait for the Retry-After header.
- **500** `internal_error` — Something went wrong on our side.

## Example

### cURL

```bash
curl -X POST "https://foundermcp.dev/api/v1/searches/preview" \
  -H "Authorization: Bearer $FOUNDERMCP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "signal": {
      "type": "funding_raised",
      "countries": [
        "BE"
      ],
      "window_days": 30
    },
    "mode": "raw",
    "limit": 10
  }'
```

### JavaScript

```javascript
const response = await fetch('https://foundermcp.dev/api/v1/searches/preview', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.FOUNDERMCP_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "signal": {
      "type": "funding_raised",
      "countries": [
        "BE"
      ],
      "window_days": 30
    },
    "mode": "raw",
    "limit": 10
  })
});
const body = await response.json();
```

### Python

```python
import json
import os
import urllib.request

payload = {
  "signal": {
    "type": "funding_raised",
    "countries": [
      "BE"
    ],
    "window_days": 30
  },
  "mode": "raw",
  "limit": 10
}

request = urllib.request.Request(
    "https://foundermcp.dev/api/v1/searches/preview",
    headers={
    "Authorization": f"Bearer {os.environ['FOUNDERMCP_API_KEY']}",
    "Content-Type": "application/json"
    },
    data=json.dumps(payload).encode(),
    method="POST",
)
with urllib.request.urlopen(request) as response:
    body = json.load(response)
```

### Example response

```json
{
  "object": "cost_preview",
  "endpoint": "searches",
  "row_key": "funding_company",
  "credits_per_row": 1,
  "max_rows": 10,
  "max_credits": 10,
  "period": "call",
  "rows": [
    {
      "row_key": "funding_company",
      "credits_per_row": 1,
      "max_rows": 10
    }
  ],
  "notes": []
}
```
