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

# Global search — worked samples

> The one-call cross-pillar fan-out that powers the dashboard's global search, with a populated request and the full response envelope.

## Global search — worked samples

One POST replaces the N parallel per-surface searches a client would
otherwise fan out itself: the query is multiplexed against every product
pillar in a single request, and the response comes back ranked across all of
them. This is the endpoint behind the dashboard's global search palette —
use it the same way when building a custom search widget.

### Request fields

| Field                | Type          | Notes                                                                                                                                                                                                                                                                                       |
| -------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `query`              | string        | Required. 1–200 characters.                                                                                                                                                                                                                                                                 |
| `pillars`            | array of enum | Optional. Any of `contacts`, `conversations`, `tickets`, `agents`, `calls`, `numbers`, `segments` (max 8 entries). Omit (or send `[]`) to query every pillar; send a subset to scope the search.                                                                                            |
| `per_pillar_limit`   | integer       | Optional. 1–10, default 5. Caps how many matches each pillar returns.                                                                                                                                                                                                                       |
| `static_match_count` | integer       | Optional. 0–100, default 0. The count of non-pillar matches your client already rendered for this query (page, setting, or help-article shortcuts); folded into the recorded result count so successful searches are not mis-counted as zero-result. Palette callers should always send it. |

### Multi-pillar query across all seven pillars

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.orbit.devotel.io/api/v1/search/global" \
    -H "X-API-Key: dv_live_sk_your_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "query": "ady",
      "pillars": ["contacts", "conversations", "tickets", "agents", "calls", "numbers", "segments"],
      "per_pillar_limit": 5,
      "static_match_count": 2
    }'
  ```

  ```typescript Node.js theme={null}
  const res = await fetch("https://api.orbit.devotel.io/api/v1/search/global", {
    method: "POST",
    headers: {
      "X-API-Key": process.env.ORBIT_API_KEY!,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      query: "ady",
      pillars: [
        "contacts",
        "conversations",
        "tickets",
        "agents",
        "calls",
        "numbers",
        "segments",
      ],
      per_pillar_limit: 5,
      static_match_count: 2,
    }),
  });
  const body = await res.json();
  for (const hit of body.data.results) {
    console.log(hit.pillar, hit.title, hit.href, hit.score);
  }
  ```

  ```python Python theme={null}
  import os, requests

  r = requests.post(
      "https://api.orbit.devotel.io/api/v1/search/global",
      headers={"X-API-Key": os.environ["ORBIT_API_KEY"]},
      json={
          "query": "ady",
          "pillars": ["contacts", "conversations", "tickets", "agents", "calls", "numbers", "segments"],
          "per_pillar_limit": 5,
          "static_match_count": 2,
      },
  )
  for hit in r.json()["data"]["results"]:
      print(hit["pillar"], hit["title"], hit["href"])
  ```

  ```go Go theme={null}
  package main

  import (
  	"bytes"
  	"encoding/json"
  	"fmt"
  	"net/http"
  	"os"
  )

  func main() {
  	payload, _ := json.Marshal(map[string]interface{}{
  		"query": "ady",
  		"pillars": []string{
  			"contacts", "conversations", "tickets", "agents", "calls", "numbers", "segments",
  		},
  		"per_pillar_limit":  5,
  		"static_match_count": 2,
  	})
  	req, _ := http.NewRequest("POST", "https://api.orbit.devotel.io/api/v1/search/global", bytes.NewReader(payload))
  	req.Header.Set("X-API-Key", os.Getenv("ORBIT_API_KEY"))
  	req.Header.Set("Content-Type", "application/json")
  	res, _ := http.DefaultClient.Do(req)
  	fmt.Println(res.StatusCode)
  }
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'json'

  uri = URI('https://api.orbit.devotel.io/api/v1/search/global')
  req = Net::HTTP::Post.new(uri)
  req['X-API-Key'] = ENV['ORBIT_API_KEY']
  req['Content-Type'] = 'application/json'
  req.body = {
    query: 'ady',
    pillars: %w[contacts conversations tickets agents calls numbers segments],
    per_pillar_limit: 5,
    static_match_count: 2,
  }.to_json
  res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
  JSON.parse(res.body)['data']['results'].each { |hit| puts "#{hit['pillar']}: #{hit['title']}" }
  ```

  ```php PHP theme={null}
  <?php
  $payload = json_encode([
    'query' => 'ady',
    'pillars' => ['contacts', 'conversations', 'tickets', 'agents', 'calls', 'numbers', 'segments'],
    'per_pillar_limit' => 5,
    'static_match_count' => 2,
  ]);
  $ch = curl_init('https://api.orbit.devotel.io/api/v1/search/global');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-API-Key: ' . getenv('ORBIT_API_KEY'),
    'Content-Type: application/json',
  ]);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
  $body = json_decode(curl_exec($ch), true);
  foreach ($body['data']['results'] as $hit) {
    echo $hit['pillar'] . ': ' . $hit['title'] . PHP_EOL;
  }
  ```
</CodeGroup>

```json 200 theme={null}
{
  "data": {
    "query": "ady",
    "results": [
      {
        "id": "agt_01K2N8Q3Z7R4",
        "pillar": "agents",
        "title": "Adyen Routing Agent",
        "subtitle": "Routes Adyen payment-support calls to the billing queue",
        "href": "/agents/agt_01K2N8Q3Z7R4",
        "score": 2
      },
      {
        "id": "cnt_8bTcQ4PaXwE2",
        "pillar": "contacts",
        "title": "Adya Sharma",
        "subtitle": "adya.sharma@example.com",
        "href": "/audience/contacts/cnt_8bTcQ4PaXwE2",
        "score": 1
      }
    ],
    "by_pillar": {
      "agents": [
        {
          "id": "agt_01K2N8Q3Z7R4",
          "pillar": "agents",
          "title": "Adyen Routing Agent",
          "subtitle": "Routes Adyen payment-support calls to the billing queue",
          "href": "/agents/agt_01K2N8Q3Z7R4",
          "score": 2
        }
      ],
      "contacts": [
        {
          "id": "cnt_8bTcQ4PaXwE2",
          "pillar": "contacts",
          "title": "Adya Sharma",
          "subtitle": "adya.sharma@example.com",
          "href": "/audience/contacts/cnt_8bTcQ4PaXwE2",
          "score": 1
        }
      ]
    },
    "counts": {
      "contacts": 1,
      "conversations": 0,
      "tickets": 0,
      "agents": 1,
      "calls": 0,
      "numbers": 0,
      "segments": 0
    },
    "partial": ["conversations"],
    "search_analytics_id": "searchAnalytics_9f2c7a1b4e"
  },
  "meta": {
    "request_id": "req_4c2b11a0",
    "timestamp": "2026-09-11T10:00:00.000Z"
  }
}
```

### Reading the response

Each entry in `results[]` — and in the per-pillar buckets under
`by_pillar` — carries:

* `id` — the entity's own id, so client-render keys stay stable.
* `pillar` — one of the seven pillar buckets above; drives the icon and
  group heading.
* `title` — the headline label (a contact name, an agent name, a number).
* `subtitle` — an optional muted secondary label (for a contact, the
  email or phone).
* `href` — a locale-relative dashboard path; prepend `/${locale}` before
  navigating.
* `score` — per-pillar relevance: exact match > prefix match > substring
  match. Use it as the flat-sort tiebreaker across pillars.

Render either the flat, pre-sorted `results` array or the grouped
`by_pillar` map (keys are only the pillars that returned at least one
match). `counts` reports the match tally for every pillar, including zero,
which is what powers a "1 result in Contacts" summary line. `partial`
names the pillars whose sub-query failed — e.g. a transient database
error on one resolver — so the client can show a discreet "couldn't search
conversations" hint next to the pillars that did succeed. `partial` is
empty on a fully successful fan-out.

`search_analytics_id` is the row this query recorded for search
analytics, or `null` when the write was de-duped. Save it and report the
row the user picks with
`POST /api/v1/search-analytics/click` — that click attribution is what
makes the search-analytics click-through panel non-zero. See the [Search
Analytics API](/api-reference/search-analytics) for the click endpoint
and the reporting reads that back-fill those panels.
