> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# कन्वर्सेशन संदेशों में स्मार्ट खोज

GET https://api.elevenlabs.io/v1/convai/conversations/messages/smart-search

सटीक keyword matches के बजाय अर्थ और इरादे के आधार पर प्रासंगिक messages दिखाने के लिए conversation transcripts में semantic similarity से खोजें

Reference: https://elevenlabs.io/docs/eleven-agents/api-reference/conversations/messages/search

## Servers

- `https://api.elevenlabs.io` (Production, default)
- `https://api.us.elevenlabs.io` (Production US)
- `https://api.eu.residency.elevenlabs.io` (Production EU)
- `https://api.in.residency.elevenlabs.io` (Production India)
- `https://api.sg.residency.elevenlabs.io` (Production Singapore)

## Request

### Query parameters

- `text_query` (string, required) — सेमांटिक समानता मैचिंग के लिए खोज क्वेरी टेक्स्ट
- `agent_id` (string, optional) — एजेंट id (agent_…) या स्पीच इंजन बाहरी id (seng_), जो उसी अंतर्निहित रिसोर्स पर रिज़ॉल्व होती है।
- `branch_id` (string, optional) — ब्रांच ID के अनुसार बातचीत फ़िल्टर करें।
- `page_size` (integer, optional, default: 20) — हर पेज पर results की संख्या। अधिकतम 50।
- `cursor` (string, optional) — अगला पेज फ़ेच करने के लिए इस्तेमाल होता है। रिस्पॉन्स में cursor लौटाया जाता है।

## Response

### 200

सफल रिस्पॉन्स

- `results` (list of MessagesSearchResult, required)
- `has_more` (boolean, required) — क्या और नतीजे उपलब्ध हैं
- `meta` (ListResponseMeta, optional)
- `next_cursor` (string, optional) — नतीजों का अगला पेज फ़ेच करने के लिए कर्सर

## Errors

### 422 Messages Search Request Unprocessable Entity Error

वैलिडेशन एरर

- `detail` (list of ValidationError, optional)

## Types

### MessagesSearchResult

transcript_index: बातचीत के ट्रांसक्रिप्ट में संदेश का इंडेक्स chunk_text: ट्रांसक्रिप्ट का टेक्स्ट; बहुत लंबे ट्रांसक्रिप्ट संदेशों के कई चंक्स हो सकते हैं। chunk_highlights: हाइलाइट करने के लिए मिलान वाले/न मिलने वाले सेगमेंट्स में विभाजित chunk_text। केवल कीवर्ड/टेक्स्ट खोज के लिए भरा जाता है, सिमैंटिक खोज के लिए नहीं। score: खोज क्वेरी से संदेश का समानता स्कोर

- `conversation_id` (string, required)
- `agent_id` (string, required)
- `transcript_index` (integer, required)
- `chunk_text` (string, required)
- `score` (double, required)
- `conversation_start_time_unix_secs` (integer, required)
- `agent_name` (string, optional)
- `chunk_highlights` (list of SearchHighlightSegment, optional)

### ListResponseMeta

- `total` (integer, optional)
- `page` (integer, optional)
- `page_size` (integer, optional)

### ValidationError

- `loc` (list of ValidationErrorLocItem, required)
- `msg` (string, required)
- `type` (string, required)

### SearchHighlightSegment

- `value` (string, required)
- `is_hit` (boolean, required)

### ValidationErrorLocItem

## Examples

**Response**

```json
{
  "results": [
    {
      "conversation_id": "conversation_id",
      "agent_id": "agent_id",
      "transcript_index": 1,
      "chunk_text": "chunk_text",
      "score": 1.1,
      "conversation_start_time_unix_secs": 1,
      "agent_name": "agent_name",
      "chunk_highlights": [
        {
          "value": "value",
          "is_hit": true
        }
      ]
    }
  ],
  "has_more": true,
  "meta": {
    "total": 1,
    "page": 1,
    "page_size": 1
  },
  "next_cursor": "next_cursor"
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/convai/conversations/messages/smart-search"

querystring = {"agent_id":"agent_id","branch_id":"branch_id","cursor":"cursor","page_size":"1","text_query":"Customer asking to cancel and get money back"}

response = requests.get(url, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/convai/conversations/messages/smart-search?agent_id=agent_id&branch_id=branch_id&cursor=cursor&page_size=1&text_query=Customer+asking+to+cancel+and+get+money+back';
const options = {method: 'GET'};

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

```go
package main

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

func main() {

	url := "https://api.elevenlabs.io/v1/convai/conversations/messages/smart-search?agent_id=agent_id&branch_id=branch_id&cursor=cursor&page_size=1&text_query=Customer+asking+to+cancel+and+get+money+back"

	req, _ := http.NewRequest("GET", url, nil)

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

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

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

}
```

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

url = URI("https://api.elevenlabs.io/v1/convai/conversations/messages/smart-search?agent_id=agent_id&branch_id=branch_id&cursor=cursor&page_size=1&text_query=Customer+asking+to+cancel+and+get+money+back")

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

request = Net::HTTP::Get.new(url)

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

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

HttpResponse<String> response = Unirest.get("https://api.elevenlabs.io/v1/convai/conversations/messages/smart-search?agent_id=agent_id&branch_id=branch_id&cursor=cursor&page_size=1&text_query=Customer+asking+to+cancel+and+get+money+back")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/convai/conversations/messages/smart-search?agent_id=agent_id&branch_id=branch_id&cursor=cursor&page_size=1&text_query=Customer+asking+to+cancel+and+get+money+back');

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/convai/conversations/messages/smart-search?agent_id=agent_id&branch_id=branch_id&cursor=cursor&page_size=1&text_query=Customer+asking+to+cancel+and+get+money+back");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/conversations/messages/smart-search?agent_id=agent_id&branch_id=branch_id&cursor=cursor&page_size=1&text_query=Customer+asking+to+cancel+and+get+money+back")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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()
```