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

# Search

> Search the web with domain filtering, date ranges, and content extraction

```bash title="Endpoint" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
POST /search/v1/search
```

<CodeGroup>
  ```bash title="cURL" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  curl -X POST https://api.case.dev/search/v1/search \
    -H "Authorization: Bearer sk_case_YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "query": "medical malpractice statute of limitations California",
      "numResults": 20,
      "includeText": true
    }'
  ```

  ```bash title="CLI" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  casedev search:v1 search \
    --query "search query" \
    --num-results 20 --include-text
  ```

  ```typescript title="Typescript" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  import Casedev from 'casedev';

  const client = new Casedev({ apiKey: 'sk_case_YOUR_API_KEY' });

  const results = await client.search.v1.search({
    query: 'medical malpractice statute of limitations California',
    numResults: 20,
    includeText: true
  });

  for (const result of results.results) {
    console.log(result.title, result.url);
  }
  ```

  ```python title="Python" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  import casedev

  client = casedev.Casedev(api_key='sk_case_YOUR_API_KEY')

  results = client.search.v1.search(
      query='medical malpractice statute of limitations California',
      num_results=20,
      include_text=True
  )

  for result in results.results:
      print(result.title, result.url)
  ```

  ```go title="Go" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  results, _ := client.Search.V1.Search(ctx, casedev.SearchV1SearchParams{
  	Query:      casedev.F("search query"),
  	NumResults: casedev.F(int64(20)),
  	IncludeText: casedev.F(true),
  })
  for _, r := range results.Results {
  	fmt.Println(r.Title, r.URL)
  }
  ```
</CodeGroup>

```json title="Response" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
{
  "results": [
    {
      "title": "California Medical Malpractice Laws",
      "url": "https://law.cornell.edu/california/medical-malpractice",
      "publishedDate": "2024-03-15",
      "score": 0.95,
      "text": "California Code of Civil Procedure Section 340.5..."
    }
  ]
}
```

## Parameters

| Parameter            | Type    | Default      | Description                    |
| -------------------- | ------- | ------------ | ------------------------------ |
| `query`              | string  | **Required** | Search query                   |
| `numResults`         | number  | 10           | Number of results (max 100)    |
| `type`               | string  | `auto`       | `auto`, `keyword`, or `neural` |
| `includeDomains`     | array   | —            | Only include these domains     |
| `excludeDomains`     | array   | —            | Exclude these domains          |
| `startPublishedDate` | string  | —            | Published after (ISO date)     |
| `endPublishedDate`   | string  | —            | Published before (ISO date)    |
| `includeText`        | boolean | `false`      | Include page text in results   |

## Examples

### Legal research with trusted sources

<CodeGroup>
  ```bash title="CLI" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  casedev search:v1 search \
    --query "HIPAA compliance requirements" \
    --include-domain law.cornell.edu \
    --include-domain hhs.gov \
    --include-domain findlaw.com \
    --num-results 20 --include-text
  ```

  ```typescript title="Typescript" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  const results = await client.search.v1.search({
    query: 'HIPAA compliance requirements',
    includeDomains: ['law.cornell.edu', 'hhs.gov', 'findlaw.com'],
    numResults: 20,
    includeText: true
  });
  ```

  ```python title="Python" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  results = client.search.v1.search(
      query='HIPAA compliance requirements',
      include_domains=['law.cornell.edu', 'hhs.gov', 'findlaw.com'],
      num_results=20,
      include_text=True
  )
  ```

  ```go title="Go" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  results, _ := client.Search.V1.Search(ctx, casedev.SearchV1SearchParams{
      Query:          casedev.F("HIPAA compliance requirements"),
      IncludeDomains: casedev.F([]string{"law.cornell.edu", "hhs.gov", "findlaw.com"}),
      NumResults:     casedev.F(int64(20)),
      IncludeText:    casedev.F(true),
  })
  ```
</CodeGroup>

### News search with date range

<CodeGroup>
  ```bash title="CLI" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  casedev search:v1 search \
    --query "SEC cryptocurrency enforcement" \
    --start-published-date 2024-01-01 \
    --exclude-domain reddit.com \
    --exclude-domain twitter.com \
    --type keyword
  ```

  ```typescript title="Typescript" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  const results = await client.search.v1.search({
    query: 'SEC cryptocurrency enforcement',
    startPublishedDate: '2024-01-01',
    excludeDomains: ['reddit.com', 'twitter.com'],
    type: 'keyword'
  });
  ```

  ```python title="Python" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  results = client.search.v1.search(
      query='SEC cryptocurrency enforcement',
      start_published_date='2024-01-01',
      exclude_domains=['reddit.com', 'twitter.com'],
      type='keyword'
  )
  ```

  ```go title="Go" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  results, _ := client.Search.V1.Search(ctx, casedev.SearchV1SearchParams{
      Query:              casedev.F("SEC cryptocurrency enforcement"),
      StartPublishedDate: casedev.F("2024-01-01"),
      ExcludeDomains:     casedev.F([]string{"reddit.com", "twitter.com"}),
      Type:               casedev.F(casedev.SearchV1SearchParamsTypeKeyword),
  })
  ```
</CodeGroup>

### Company research

<CodeGroup>
  ```bash title="CLI" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  casedev search:v1 search \
    --query "Acme Corporation lawsuit settlement" \
    --include-domain reuters.com \
    --include-domain bloomberg.com \
    --include-domain wsj.com \
    --start-published-date 2023-01-01 \
    --include-text
  ```

  ```typescript title="Typescript" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  const results = await client.search.v1.search({
    query: 'Acme Corporation lawsuit settlement',
    includeDomains: ['reuters.com', 'bloomberg.com', 'wsj.com'],
    startPublishedDate: '2023-01-01',
    includeText: true
  });
  ```

  ```python title="Python" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  results = client.search.v1.search(
      query='Acme Corporation lawsuit settlement',
      include_domains=['reuters.com', 'bloomberg.com', 'wsj.com'],
      start_published_date='2023-01-01',
      include_text=True
  )
  ```

  ```go title="Go" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  results, _ := client.Search.V1.Search(ctx, casedev.SearchV1SearchParams{
      Query:              casedev.F("Acme Corporation lawsuit settlement"),
      IncludeDomains:     casedev.F([]string{"reuters.com", "bloomberg.com", "wsj.com"}),
      StartPublishedDate: casedev.F("2023-01-01"),
      IncludeText:        casedev.F(true),
  })
  ```
</CodeGroup>

<Info>
  **Tip:** Use `includeDomains` to restrict results to authoritative sources.
</Info>
