> For the complete documentation index, see [llms.txt](https://help.rankability.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.rankability.com/api/api-search-intelligence.md).

# Search Intelligence API endpoints

Run a single query across Google plus the major AI search platforms (ChatGPT, Perplexity, Gemini, Claude, Grok, Bing) and get structured per-platform results in one call. Includes brand and domain extraction.

The Search Intelligence agent API lets you run a single search query in parallel across Google and the major AI platforms, then get back a structured response with per-platform results, citations, and (optionally) brand/domain extraction. Use it to power external dashboards, citation monitors, and AI-search visibility reports.

## Endpoints at a glance

| Method & Path                                        | Scope                       | Purpose                                                                                                                                   |
| ---------------------------------------------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `POST /api/agent/v1/search-intelligence/query`       | `search_intelligence:query` | Run a query across the requested platforms. **Synchronous** — returns once all platforms settle or the 90s budget expires.                |
| `GET /api/agent/v1/search-intelligence/query/:runId` | `search_intelligence:query` | Fetch a previously-run query by `runId`. Useful when the original POST timed out at the wall-clock budget but partial state is in the DB. |

## Authentication and scope

Both endpoints use the standard agent API auth: `Authorization: Bearer rk_live_...`. Add the `search_intelligence:query` scope to your API key under **Settings > API keys** (the scope name in the picker is exactly `search_intelligence:query`).

## Supported platforms

The `platforms` field accepts any subset of the following (max 7):

* `google_organic` — Google organic SERP results (parsed)
* `chatgpt` — ChatGPT response with citations
* `perplexity` — Perplexity answer with sources
* `gemini` — Google Gemini response
* `claude` — Anthropic Claude response
* `grok` — xAI Grok response
* `bing` — Bing organic SERP results

If `platforms` is omitted, the default set is `["google_organic", "chatgpt", "perplexity", "gemini"]`.

## Run a query

```
POST /api/agent/v1/search-intelligence/query
Authorization: Bearer rk_live_YOUR_KEY
Content-Type: application/json

{
  "query": "best crm for small business",
  "platforms": ["google_organic", "chatgpt", "perplexity", "gemini"],
  "location": "United States",
  "gl": "us",
  "language": "en",
  "hl": "en",
  "device": "desktop",
  "includeRaw": false,
  "extract": {
    "brands": ["HubSpot", "Salesforce", "Pipedrive"],
    "domains": ["hubspot.com", "salesforce.com", "pipedrive.com"]
  }
}
```

| Field             | Type    | Required | Default           | Description                                                                              |
| ----------------- | ------- | -------- | ----------------- | ---------------------------------------------------------------------------------------- |
| `query`           | string  | Yes      | —                 | The search query. 1–250 characters.                                                      |
| `platforms`       | array   | No       | see above         | Up to 7 platform identifiers. Duplicates rejected.                                       |
| `location`        | string  | No       | `"United States"` | Display name of the search location (max 255 chars).                                     |
| `gl`              | string  | No       | `"us"`            | Two-letter country code for SERP context.                                                |
| `language`        | string  | No       | `"en"`            | Language code (e.g. `en`, `es`, `de`).                                                   |
| `hl`              | string  | No       | `"en"`            | UI language hint passed to providers that accept it.                                     |
| `device`          | enum    | No       | `"desktop"`       | `"desktop"` or `"mobile"`.                                                               |
| `includeRaw`      | boolean | No       | `false`           | If `true`, the response includes the raw upstream payload per platform (larger payload). |
| `extract.brands`  | array   | No       | —                 | Up to 20 brand names to detect mentions of in each platform's response.                  |
| `extract.domains` | array   | No       | —                 | Up to 20 domains to detect citations of in each platform's response.                     |

## Response (200 OK)

The response includes the `runId`, the query parameters, the requested platforms, and a per-platform result array. Each platform entry contains its raw answer (when `includeRaw: true`), parsed citations, and — when `extract` was provided — brand-mention and domain-citation flags.

```
{
  "runId": "0a1b2c3d-...",
  "query": "best crm for small business",
  "requestedPlatforms": ["google_organic", "chatgpt", "perplexity", "gemini"],
  "completedPlatforms": ["google_organic", "chatgpt", "perplexity", "gemini"],
  "failedPlatforms": [],
  "parameters": {
    "location": "United States",
    "gl": "us",
    "language": "en",
    "hl": "en",
    "device": "desktop"
  },
  "results": [
    {
      "platform": "google_organic",
      "status": "success",
      "answer": null,
      "citations": [ { "url": "https://hubspot.com/...", "title": "..." }, ... ],
      "extract": { "brands": { "HubSpot": true, "Salesforce": true }, "domains": { "hubspot.com": true } }
    },
    {
      "platform": "chatgpt",
      "status": "success",
      "answer": "For small businesses, HubSpot is often recommended ...",
      "citations": [ ... ],
      "extract": { ... }
    }
  ],
  "createdAt": "2026-05-12T15:32:00.000Z"
}
```

## Limits and timing

* **Per-platform timeout:** 45 seconds.
* **Total endpoint budget:** 90 seconds. If the orchestrator overruns, the POST returns `504 timeout`. The 504 envelope does not include a `runId`, so retry the POST rather than trying to hydrate a partial run.
* **Concurrency:** Up to 4 platforms run in parallel internally.
* **Brand / domain extraction:** Up to 20 entries each.

## Partial-failure behaviour

If **some** platforms succeed and others fail, the response is still `200 OK`. Failed platforms appear in `failedPlatforms` with an error code, and successful platforms appear in `results` with `status: "success"`.

If **all** requested platforms fail, the endpoint returns `502` with a top-level `runId` so you can still hydrate the partial DB state. The body shape is:

```
{
  "runId": "0a1b2c3d-...",
  "error": { "code": "all_platforms_failed", "message": "All requested platforms failed" },
  "response": { ...same shape as the success response... }
}
```

## Hydrate a previous run

```
GET /api/agent/v1/search-intelligence/query/{runId}?includeRaw=true
Authorization: Bearer rk_live_YOUR_KEY
```

The `includeRaw` query parameter is optional and defaults to `false`. The response is the same shape as the POST response.

## Error codes

| HTTP | Code                   | When                                                                                                                 |
| ---- | ---------------------- | -------------------------------------------------------------------------------------------------------------------- |
| 400  | `invalid_input`        | Missing or oversized `query`, unknown platform identifier, duplicate platforms, brands/domains array over 20.        |
| 401  | `unauthorized`         | Missing or invalid `Authorization` header.                                                                           |
| 403  | `forbidden`            | API key is missing the `search_intelligence:query` scope.                                                            |
| 404  | `not_found`            | `runId` not found in your org.                                                                                       |
| 429  | `rate_limited`         | Per-minute rate limit exceeded.                                                                                      |
| 502  | `all_platforms_failed` | All requested platforms failed. `runId` is still returned at the top level.                                          |
| 504  | `timeout`              | Wall-clock budget (90s) exceeded. The 504 envelope does not return a `runId` — retry the POST rather than hydrating. |

## Common gotcha

The endpoint is `POST .../search-intelligence/query` — not `GET .../search-intelligence`. A `GET` on the bare path returns the unknown-route fallthrough; make sure you're posting JSON to the `/query` sub-path.

## Related articles

* [Getting started with the API](/api/api-getting-started.md) — Overview of the agent API and authentication.
* [Authentication and API keys](/api/api-authentication.md) — How to create keys and add scopes.
* [Credits, rate limits, and errors](/api/api-credits-rate-limits-and-errors.md) — Per-plan rate limits and a full error code reference.
* [Page Auditor API endpoints](/api/api-page-auditor.md) — The other recently-published agent endpoint.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.rankability.com/api/api-search-intelligence.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
