URL: /docs/api/insights

---
title: "Insights API"
sidebarTitle: Insights API
description: "Read-only HTTP endpoints for search, leads, analytics and GEO data, authenticated with a Pagecog API key."
icon: code
---

The insights API gives read-only data for each site, covering whatever features an admin has switched on: analytics, search, leads and GEO. It uses the same API keys as the [insights MCP server](/docs/api/insights-mcp). It is for admins and content tools, not for the member [AI connector](/docs/agent-setup).

## How do I get a key?

Sign in as an admin, then go to Admin, then API keys. Name the key, choose **All sites (admin)** or **One site**, and copy the secret straight away. It is shown once and only its SHA-256 hash is stored. Revoke a key from the same page.

- Format: `pgc_<8 chars>_<32 chars>`. Send it as `Authorization: Bearer <key>`.
- An **admin key** reads every site and may ask for lead messages. Pass `site` on every call.
- A **site key** reads its own site only, and `site` is optional. Asking for another site is a 404. Asking for lead messages is a 403.
- Keys are never logged.

## How do I call it?

`GET /api/insights/v1/<endpoint>?site=<id or domain>&...` with the Bearer header. Replies are JSON with `Cache-Control: no-store`.

| Endpoint | Parameters |
| --- | --- |
| `sites` | none |
| `search` | `site`, `days` (7 to 90, default 28), `top` (default 25), `limit` (default 25), `min_impressions` (default 5) |
| `leads` | `site`, `days`, `include_messages=true` (admin key only) |
| `analytics` | `site`, `days`, `top` |
| `geo` | `site`, `limit` |
| `content-inputs` | `site`, `days` |

```bash
curl -H "Authorization: Bearer $PAGECOG_API_KEY" \
  "https://pagecog.com.au/api/insights/v1/content-inputs?site=example.com.au"
```

## What status codes can come back?

| Code | Meaning |
| --- | --- |
| 401 | The key is missing, wrong or revoked. |
| 400 | `site_required`: pass `site`. |
| 403 | Lead messages were requested without an admin key. |
| 404 | Unknown site or endpoint. |

Trouble with an upstream source is reported inside the body for that source (`not_connected` or `error`) and never fails the whole call. A feature that is off is a normal result: `{ "status": "feature_off", "feature": "geo" }`.

## What does content-inputs return?

One call per site that bundles the rest for a content writer, under 30 KB. It returns:

- `search.google` and `search.bing`, each with `questions`, `long_tail_queries`, `striking_distance_queries`, `striking_distance_pages`, `rising_queries` and `falling_pages`.
- `leads`.
- `analytics`, with `pages_that_bring_leads`, `entry_pages_with_leads`, `top_pages` and `ai_assistant`.
- `geo`.

Lists are cut evenly until the whole reply is under 30 KB. `trimmed_to` says how many rows each kept.

## What do the terms mean?

- **Search windows**: the last `days` days ending three days ago, because Search Console lags, compared with the same number of days before. Bing returns the current window only, so its `rising` and `falling` are null and `prev_*` are 0.
- **long_tail**: queries of 8 or more words, by impressions.
- **striking_distance**: average position 11 to 40 with at least `min_impressions`.
- **rising and falling**: more or fewer clicks (then impressions) than the previous window.
- **Leads**: stored web-form leads, with spam and duplicates excluded, limited to the lead types enabled for the site. Calls and shop clicks are counted in analytics.
- **Lead messages**: private customer text for question mining. Emails, links and phone numbers are redacted and names are never returned. Never quote or publish them.
- **AI-assistant sessions**: medium `ai-assistant`, or a source naming ChatGPT, OpenAI, Perplexity, Gemini, Copilot, Claude, Anthropic, DeepSeek or meta.ai.
- **Analytics**: completed Sydney days, with traffic exclusions applied.
- **GEO**: `share` lists every engine. An engine that never produced an answer is `measured: false` with null percentages, meaning not measured and never 0. `cited_pct` is the headline and `mentioned_pct` is separate. `gaps` are discovery prompts where no engine cites the site, with the winning domains. `discovery` lists candidate prompts. `not_available` means the site has no GEO settings yet.
