# Start a search

Starts a signal search and answers **202** with the search. Poll GET /searches/{search_id}, or pass `?wait=1` to `25` to wait that many seconds. Finished in time, the call answers **200**, and a search that succeeded also inlines its rows in `results`.

A search returns the rows of the source and charges per row: a funding company is 1 credit, a technology company is 3, a person from engagement, listening, an event or a new role is 1. No AI judges a row. For the LinkedIn signals a row is a person as LinkedIn shows them next to a post (name, headline, what they did, the post), and you decide who fits: see [Recipes](/docs/guides/recipes). A search that delivers nothing is free. To follow a signal over time, run the search again, for example every week; for keywords there are [monitors](/docs/api-reference/create-monitor).

An unknown technology is `400` with code `unknown_technology` and `suggestions`. An event is never looked up: send its exact name with the year, its hashtags or its organizer page.

`mode` may still be sent as `raw`; screened mode and watches were removed. `"mode": "screened"`, `buyer_profile`, `max_leads`, `just_outside`, `signal.about` and `signal.drop_intents` are `400` `invalid_request`, with `param` naming the field.

## Authentication

Send `Authorization: Bearer gtk_…`. Create the key under **Connect assistant → API keys**. A missing, invalid or revoked key is **401**. A valid key while this API is not enabled for your organization answers **403** `api_not_enabled`, with what the key can do instead. Every response includes `mySDR-Api-Version`, `mySDR-Request-Id` and `Cache-Control: no-store`, and a response to an accepted key also `X-RateLimit-*` (so not a 401, a 405, an OPTIONS or a 404 for an unknown path).

### Query parameters

- **`wait`** `integer` — Seconds to wait before answering, 0 to 25. Defaults to 0, which answers 202 at once.

### Headers

- **`Idempotency-Key`** `string` · **required** — Required on this call. The same key and the same body replay the first response for 24 hours (`Idempotent-Replayed: true`). The same key with a different body is `409` `idempotency_conflict`.

### Body parameters

- **`signal`** `object` · **required** — Required. `type` is `linkedin_engagement` (needs `company.linkedin_url`), `own_engagement` (needs your own `company.linkedin_url`, `people` or both), `social_listening` (needs `query`), `funding_raised` (needs `countries`), `new_in_role` (needs `titles` and `locations`), `events` (needs `event.name`; `event_posts` is the old name) or `tech_adoption` (needs `technologies`). Every field of each type is on its page under Signals, for example [Funding rounds](/docs/api-reference/signals/funding-rounds), and in GET /signals/{signal_type}.
- **`mode`** `string` — Optional, and only `raw`: every search returns the rows of the source, with no AI judging them. Leave it out. One of: `raw`.
- **`exclude_companies`** `object[]` — Up to 20 LinkedIn company pages whose rows are never delivered. Tech adoption uses `signal.exclude_domains` instead.
- **`limit`** `integer` — How many rows. Capped at `max_rows` of the type in GET /signals; defaults to its `default_limit`.
- **`cursor`** `string | null` — `result.next_cursor` of an earlier search with the same signal: this search continues where that one stopped, without the rows it already delivered. 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

- **`id`** `string` · **required** — Search id, `srch_…`.
- **`object`** `string` · **required** — Always `search`. One of: `search`.
- **`status`** `string` · **required** — Where the search is. One of: `queued`, `running`, `succeeded`, `failed`, `cancelled`.
- **`signal_type`** `string` · **required** — The signal you asked for. One of: `linkedin_engagement`, `own_engagement`, `social_listening`, `funding_raised`, `new_in_role`, `events`, `tech_adoption`.
- **`created_at`** `string` · **required** — When the search was created (ISO 8601).
- **`completed_at`** `string | null` — When it finished.
- **`expires_at`** `string | null` — Until when the search and its rows stay readable (30 days after it finished).
- **`progress`** `object | null` — `stage` and `message` while it runs.
- **`funnel`** `object | null` — What the search read on the way, such as the posts and the people seen on them.
- **`result`** `object | null` — Set when `status` is `succeeded`: `rows`, `has_more`, `next_cursor`, `total_estimate` and `truncated_by` (`max_credits` or `daily_limit` when a cap left rows out).
- **`credits`** `object` · **required** — `charged`, `reserved` (worst case while open, 0 when finished) and `max_credits`.
- **`sources`** `string[]` · **required** — Where the rows come from: `funding_data`, `job_postings`, `linkedin` or `web`.
- **`error`** `object | null` — Set when `status` is `failed`: `type`, `message`, `retryable`.
- **`request`** `object` · **required** — The body as validated, with defaults filled in.
- **`notes`** `string[]` · **required** — What was left out and what was not checked, in plain language.

## Credits

Charged per delivered row, at the price in GET /signals. A funding company is 1 credit. A technology company is 3. A person is 1. Nothing delivered, a failure and a cancel are free. Errors and empty lookups are free. A call that spent credits puts that number in `credits_used`, in `X-Credits-Used` and in `X-Credits-Charged`. When the wallet can be read, the response also sends `X-Credits-Remaining`.

## Errors

- **400** `invalid_request` — The body is not valid JSON, a field is unknown or has the wrong type, or a value is not allowed.
- **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.
- **403** `api_not_enabled` — The key is valid, but the Signals API or the Company API is not enabled for your organization yet. The error says what this key can do.
- **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.
- **429** `daily_limit_reached` — The request could take your organization over its daily credit limit. The limit resets at midnight (Europe/Brussels).
- **402** `insufficient_credits` — The credit balance is lower than this request could cost. Nothing was charged. Add credits, or send a smaller request. The error includes code, fix and a link to the credits docs.
- **502** `upstream_error` — The data source did not answer. Retry later.
- **503** `service_unavailable` — The API is temporarily unavailable. Retry later.
- **500** `internal_error` — Something went wrong on our side.
- **402** `max_credits_exceeded` — max_credits is lower than the credits of the first row, so nothing could be returned. Nothing was charged; raise max_credits or ask for fewer rows.
- **409** `idempotency_conflict` — The Idempotency-Key was already used with another request body.
- **409** `idempotency_in_progress` — The first request with this Idempotency-Key is still being processed. Wait for the Retry-After header.

## Example

### cURL

```bash
curl -X POST "https://mysdr.app/api/v1/searches?wait=25" \
  -H "Authorization: Bearer $MYSDR_API_KEY" \
  -H "Idempotency-Key: idem-1" \
  -H "Content-Type: application/json" \
  -d '{
    "signal": {
      "type": "linkedin_engagement",
      "company": {
        "linkedin_url": "https://www.linkedin.com/company/acme-analytics"
      },
      "leads_from": "reactors"
    },
    "limit": 25,
    "max_credits": 25
  }'
```

### JavaScript

```javascript
const response = await fetch('https://mysdr.app/api/v1/searches?wait=25', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.MYSDR_API_KEY}`,
    'Idempotency-Key': 'idem-1',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "signal": {
      "type": "linkedin_engagement",
      "company": {
        "linkedin_url": "https://www.linkedin.com/company/acme-analytics"
      },
      "leads_from": "reactors"
    },
    "limit": 25,
    "max_credits": 25
  })
});
const body = await response.json();
```

### Python

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

payload = {
  "signal": {
    "type": "linkedin_engagement",
    "company": {
      "linkedin_url": "https://www.linkedin.com/company/acme-analytics"
    },
    "leads_from": "reactors"
  },
  "limit": 25,
  "max_credits": 25
}

request = urllib.request.Request(
    "https://mysdr.app/api/v1/searches?wait=25",
    headers={
    "Authorization": f"Bearer {os.environ['MYSDR_API_KEY']}",
    "Idempotency-Key": "idem-1",
    "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
{
  "id": "srch_01J9Z6P8C8V0K3W6T2N8R5M1XA",
  "object": "search",
  "status": "succeeded",
  "signal_type": "linkedin_engagement",
  "funnel": {
    "posts": 10,
    "people": 23
  },
  "result": {
    "rows": 18,
    "has_more": false,
    "next_cursor": null,
    "total_estimate": 18,
    "truncated_by": null
  },
  "credits": {
    "charged": 18,
    "reserved": 0,
    "max_credits": 25
  },
  "sources": [
    "linkedin"
  ],
  "error": null,
  "notes": [
    "Left out, and not charged: 5 people who work at Acme Analytics (by their headline).",
    "No AI judged these rows and no buyer profile filtered them: decide yourself who fits, from each headline and post."
  ]
}
```
