> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getpg.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Search

> Unified semantic search across all data PG:AI holds for your accounts

## Unified Search

Search semantically across everything PG:AI holds for your accounts — public filings and news, uploaded materials, web pages, job postings, technologies, contacts, conversations, insights, and more. Results are ranked by relevance.

<ParamField query="scope" type="string" required>
  Defines which accounts to search across.

  * `organisation` — searches every account tracked in your workspace
  * `companies` — restricts the search to the accounts you specify in `company_ids`
</ParamField>

<ParamField query="q" type="string" required>
  The search query. Must be at least 1 character.
</ParamField>

<ParamField query="company_ids" type="string">
  Comma-separated list of company UUIDs. Required when `scope=companies`. Ignored when `scope=organisation`.
</ParamField>

<ParamField query="page" type="integer" default="1">
  Page number for pagination.
</ParamField>

<ParamField query="per_source" type="integer" default="25">
  Maximum number of results returned per vector source. Range: 1–100.
</ParamField>

<ParamField query="date_from" type="string">
  ISO 8601 lower bound on result date (e.g. `2025-01-01`).
</ParamField>

<ParamField query="date_to" type="string">
  ISO 8601 upper bound on result date (e.g. `2025-12-31`).
</ParamField>

**Permission:** `companies:read`

<RequestExample>
  ```bash Organisation scope theme={null}
  curl -X GET "https://api.getpg.ai/public-api/v1/search?scope=organisation&q=AI+strategy&per_source=10" \
    -H "x-api-key: your_api_key"
  ```

  ```bash Companies scope theme={null}
  curl -X GET "https://api.getpg.ai/public-api/v1/search?scope=companies&q=product+launch&company_ids=304599c3-212f-4122-b84a-d655a1455d31,0472a8a1-bdc4-4f53-93f6-7d9a967beb76" \
    -H "x-api-key: your_api_key"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "items": [
      {
        "id": "abc123",
        "company_id": "304599c3-212f-4122-b84a-d655a1455d31",
        "company_name": "Tesco",
        "source_type": "news",
        "title": "Tesco announces AI-driven supply chain strategy",
        "excerpt": "Tesco's leadership outlined a multi-year plan to deploy AI across logistics...",
        "date": "2025-11-14T00:00:00.000Z",
        "score": 0.91
      }
    ],
    "total": 48,
    "page": 1,
    "per_page": 25,
    "resolved_company_count": 12
  }
  ```
</ResponseExample>

<Note>
  `resolved_company_count` is only present when `scope=organisation`. It shows how many distinct companies were searched.
</Note>

### Search Behavior

* Results are ranked by semantic relevance, not recency. Use `date_from` / `date_to` to narrow to a time window.
* `per_source` applies per vector source independently — the total number of results can exceed this value when multiple sources return results.
* If a downstream source fails, the API still returns results from the remaining sources.
