# Get a search

Poll a search. While it is `queued` or `running`, the response sets `Retry-After`. The search and its rows stay readable for 30 days.

## 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).

### Path parameters

- **`search_id`** `string` · **required** — A search id (`srch_…`) from POST /searches.

## 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

Free. Reading a search does not charge again. `credits.charged` is what the search already cost.

## Errors

- **404** `not_found` — No search with this id exists for your organization.
- **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.
- **500** `internal_error` — Something went wrong on our side.

## Example

### cURL

```bash
curl "https://mysdr.app/api/v1/searches/srch_01J9Z6P8C8V0K3W6T2N8R5M1XA" \
  -H "Authorization: Bearer $MYSDR_API_KEY"
```

### JavaScript

```javascript
const response = await fetch('https://mysdr.app/api/v1/searches/srch_01J9Z6P8C8V0K3W6T2N8R5M1XA', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.MYSDR_API_KEY}`
  }
});
const body = await response.json();
```

### Python

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

request = urllib.request.Request(
    "https://mysdr.app/api/v1/searches/srch_01J9Z6P8C8V0K3W6T2N8R5M1XA",
    headers={
    "Authorization": f"Bearer {os.environ['MYSDR_API_KEY']}"
    },
    method="GET",
)
with urllib.request.urlopen(request) as response:
    body = json.load(response)
```

### Example response

```json
{
  "id": "srch_01J9Z6P8C8V0K3W6T2N8R5M1XA",
  "object": "search",
  "status": "running",
  "signal_type": "linkedin_engagement",
  "progress": {
    "stage": "reading_engagement",
    "message": "Reading the reactions and comments on those posts…"
  },
  "result": null,
  "credits": {
    "charged": 0,
    "reserved": 25,
    "max_credits": 25
  },
  "error": null
}
```
