> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.casestudies.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.casestudies.dev/_mcp/server.

# Semantic search

POST https://whatsapp-backend-knd2.onrender.com/v1/casestudies/semantic
Content-Type: application/json

Search case studies using natural language. Uses vector similarity to find
the most relevant results, even when exact keywords don't match.

Combine with filters to narrow results by company or industry first,
then rank by semantic relevance.


Reference: https://docs.casestudies.dev/api-reference/semantic-search

## Authentication

- `X-API-Key` header (required) — Your casestudy.dev API key. Get one at POST /v1/keys.

## Request

### Body (application/json)

This endpoint expects an object.

- `query` (string, required) — Natural language search query
- `company` (string, optional, nullable) — Filter by company slug
- `industry` (string, optional, nullable) — Filter by industry
- `tag` (string, optional, nullable)
- `limit` (integer, optional, default: 10)
- `similarity_threshold` (double, optional, default: 0.3) — Minimum similarity score (0-1)

## Response

### 200

Ranked case study results

- `data` (list of SemanticResult, optional)
- `query` (string, optional)

## Types

### SemanticResult

- `id` (string, optional)
- `title` (string, optional)
- `summary` (string, optional)
- `featured_client` (string, optional)
- `industry` (string, optional)
- `problem` (string, optional)
- `solution` (string, optional)
- `outcomes` (string, optional)
- `source_url` (string, optional)
- `tags` (list of string, optional)
- `similarity` (double, optional) — Cosine similarity score (0-1). Higher = more relevant.

## Examples

**Request**

```json
{
  "query": "companies that improved sales pipeline with better data enrichment"
}
```

**Response**

```json
{
  "data": [
    {
      "id": "8d25bb21-6fad-471d-9899-8facbe032549",
      "title": "Remote relies on Kernel custom data to build pipeline",
      "summary": "Remote used Kernel to add 15,000 net new accounts in one week and book 130+ extra meetings monthly.",
      "featured_client": "Remote",
      "industry": "hr tech",
      "similarity": 0.4898
    }
  ],
  "query": "companies that improved sales pipeline with better data enrichment"
}
```

**SDK Code**

```python semanticSearch_example
import requests

url = "https://whatsapp-backend-knd2.onrender.com/v1/casestudies/semantic"

payload = { "query": "companies that improved sales pipeline with better data enrichment" }
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript semanticSearch_example
const url = 'https://whatsapp-backend-knd2.onrender.com/v1/casestudies/semantic';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"query":"companies that improved sales pipeline with better data enrichment"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go semanticSearch_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://whatsapp-backend-knd2.onrender.com/v1/casestudies/semantic"

	payload := strings.NewReader("{\n  \"query\": \"companies that improved sales pipeline with better data enrichment\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby semanticSearch_example
require 'uri'
require 'net/http'

url = URI("https://whatsapp-backend-knd2.onrender.com/v1/casestudies/semantic")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"query\": \"companies that improved sales pipeline with better data enrichment\"\n}"

response = http.request(request)
puts response.read_body
```

```java semanticSearch_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://whatsapp-backend-knd2.onrender.com/v1/casestudies/semantic")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"query\": \"companies that improved sales pipeline with better data enrichment\"\n}")
  .asString();
```

```php semanticSearch_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://whatsapp-backend-knd2.onrender.com/v1/casestudies/semantic', [
  'body' => '{
  "query": "companies that improved sales pipeline with better data enrichment"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp semanticSearch_example
using RestSharp;

var client = new RestClient("https://whatsapp-backend-knd2.onrender.com/v1/casestudies/semantic");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"query\": \"companies that improved sales pipeline with better data enrichment\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift semanticSearch_example
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["query": "companies that improved sales pipeline with better data enrichment"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://whatsapp-backend-knd2.onrender.com/v1/casestudies/semantic")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```