---
title: "Connect n8n workflows and AI agents"
description: "Call the hosted v1 API from n8n HTTP Request nodes, connect n8n AI Agents, and check request schemas with OpenAPI."
canonical_url: "https://gscdump.com/gscdump-sdk/guides/build-integrations/n8n"
---

> Index of every page on this site: [llms.txt](https://gscdump.com/llms.txt)

# Connect n8n workflows and AI agents

Read hosted Search Console data in n8n using built-in HTTP and MCP nodes. Use the HTTP Request node for scheduled automations, or attach an HTTP Request Tool or MCP Client Tool to an n8n AI Agent.

::pre{tabindex="0" svg="<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 959.499 182.5\" width=\"959.499\" height=\"182.5\" style=\"--bg:var(--ui-bg-muted);--fg:var(--ui-text-highlighted);--accent:var(--ui-link)\">
<style>
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&amp;display=swap');
  text { font-family: 'Inter', system-ui, sans-serif; }
  svg {
    /* Derived from --bg and --fg (overridable via --line, --accent, etc.) */
    --_text:          var(--fg);
    --_text-sec:      var(--muted, color-mix(in srgb, var(--fg) 60%, var(--bg)));
    --_text-muted:    var(--muted, color-mix(in srgb, var(--fg) 40%, var(--bg)));
    --_text-faint:    color-mix(in srgb, var(--fg) 25%, var(--bg));
    --_line:          var(--line, color-mix(in srgb, var(--fg) 50%, var(--bg)));
    --_arrow:         var(--accent, color-mix(in srgb, var(--fg) 85%, var(--bg)));
    --_node-fill:     var(--surface, color-mix(in srgb, var(--fg) 3%, var(--bg)));
    --_node-stroke:   var(--border, color-mix(in srgb, var(--fg) 20%, var(--bg)));
    --_group-fill:    var(--bg);
    --_group-hdr:     color-mix(in srgb, var(--fg) 5%, var(--bg));
    --_inner-stroke:  color-mix(in srgb, var(--fg) 12%, var(--bg));
    --_key-badge:     color-mix(in srgb, var(--fg) 10%, var(--bg));
  }
</style>
<defs>
  <marker id=\"arrowhead\" markerWidth=\"8\" markerHeight=\"5\" refX=\"7\" refY=\"2.5\" orient=\"auto\">
    <polygon points=\"0 0, 8 2.5, 0 5\" fill=\"var(--_arrow)\" stroke=\"var(--_arrow)\" stroke-width=\"0.75\" stroke-linejoin=\"round\" />
  </marker>
  <marker id=\"arrowhead-start\" markerWidth=\"8\" markerHeight=\"5\" refX=\"1\" refY=\"2.5\" orient=\"auto-start-reverse\">
    <polygon points=\"8 0, 0 2.5, 8 5\" fill=\"var(--_arrow)\" stroke=\"var(--_arrow)\" stroke-width=\"0.75\" stroke-linejoin=\"round\" />
  </marker>
</defs>
<polyline class=\"edge\" data-from=\"Schedule\" data-to=\"V1\" data-style=\"solid\" data-arrow-start=\"false\" data-arrow-end=\"true\" data-label=\"Authorization: Bearer\" points=\"555.47,123.35000000000001 762.6940000000001,123.35000000000001\" fill=\"none\" stroke=\"var(--_line)\" stroke-width=\"1\" marker-end=\"url(#arrowhead)\" />
<polyline class=\"edge\" data-from=\"Agent\" data-to=\"MCP\" data-style=\"solid\" data-arrow-start=\"false\" data-arrow-end=\"true\" data-label=\"X-API-Key\" points=\"154.56799999999998,58.45 308.926,58.45\" fill=\"none\" stroke=\"var(--_line)\" stroke-width=\"1\" marker-end=\"url(#arrowhead)\" />
<polyline class=\"edge\" data-from=\"OpenAPI\" data-to=\"Schedule\" data-style=\"dotted\" data-arrow-start=\"false\" data-arrow-end=\"true\" data-label=\"Schema reference\" points=\"184.20800000000003,123.35000000000001 377.17600000000004,123.35000000000001\" fill=\"none\" stroke=\"var(--_line)\" stroke-width=\"1\" stroke-dasharray=\"4 4\" marker-end=\"url(#arrowhead)\" />
<g class=\"edge-label\" data-from=\"Schedule\" data-to=\"V1\" data-label=\"Authorization: Bearer\">
  <rect x=\"599.47\" y=\"107.35000000000001\" width=\"119.22400000000002\" height=\"30.3\" rx=\"2\" ry=\"2\" fill=\"var(--bg)\" stroke=\"var(--_inner-stroke)\" stroke-width=\"1\" />
  <text x=\"659.082\" y=\"122.50000000000001\" text-anchor=\"middle\" font-size=\"11\" font-weight=\"400\" fill=\"var(--_text-sec)\" dy=\"3.8499999999999996\">Authorization: Bearer</text>
</g>
<g class=\"edge-label\" data-from=\"Agent\" data-to=\"MCP\" data-label=\"X-API-Key\">
  <rect x=\"198.56799999999998\" y=\"42.45\" width=\"66.358\" height=\"30.3\" rx=\"2\" ry=\"2\" fill=\"var(--bg)\" stroke=\"var(--_inner-stroke)\" stroke-width=\"1\" />
  <text x=\"231.74699999999999\" y=\"57.6\" text-anchor=\"middle\" font-size=\"11\" font-weight=\"400\" fill=\"var(--_text-sec)\" dy=\"3.8499999999999996\">X-API-Key</text>
</g>
<g class=\"edge-label\" data-from=\"OpenAPI\" data-to=\"Schedule\" data-label=\"Schema reference\">
  <rect x=\"228.208\" y=\"107.35000000000001\" width=\"104.96800000000002\" height=\"30.3\" rx=\"2\" ry=\"2\" fill=\"var(--bg)\" stroke=\"var(--_inner-stroke)\" stroke-width=\"1\" />
  <text x=\"280.692\" y=\"122.50000000000001\" text-anchor=\"middle\" font-size=\"11\" font-weight=\"400\" fill=\"var(--_text-sec)\" dy=\"3.8499999999999996\">Schema reference</text>
</g>
<g class=\"node\" data-id=\"Schedule\" data-label=\"n8n Trigger or AI Agent\" data-shape=\"rectangle\">
  <rect x=\"377.17600000000004\" y=\"104.9\" width=\"178.29399999999998\" height=\"36.900000000000006\" rx=\"0\" ry=\"0\" fill=\"var(--_node-fill)\" stroke=\"var(--_node-stroke)\" stroke-width=\"0.75\" />
  <text x=\"466.32300000000004\" y=\"123.35000000000001\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"500\" fill=\"var(--_text)\" dy=\"4.55\">n8n Trigger or AI Agent</text>
</g>
<g class=\"node\" data-id=\"V1\" data-label=\"Hosted v1 HTTP API\" data-shape=\"rectangle\">
  <rect x=\"762.6940000000001\" y=\"104.9\" width=\"156.80499999999995\" height=\"36.900000000000006\" rx=\"0\" ry=\"0\" fill=\"var(--_node-fill)\" stroke=\"var(--_node-stroke)\" stroke-width=\"0.75\" />
  <text x=\"841.0965000000001\" y=\"123.35000000000001\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"500\" fill=\"var(--_text)\" dy=\"4.55\">Hosted v1 HTTP API</text>
</g>
<g class=\"node\" data-id=\"Agent\" data-label=\"n8n AI Agent\" data-shape=\"rectangle\">
  <rect x=\"40\" y=\"40\" width=\"114.568\" height=\"36.900000000000006\" rx=\"0\" ry=\"0\" fill=\"var(--_node-fill)\" stroke=\"var(--_node-stroke)\" stroke-width=\"0.75\" />
  <text x=\"97.28399999999999\" y=\"58.45\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"500\" fill=\"var(--_text)\" dy=\"4.55\">n8n AI Agent</text>
</g>
<g class=\"node\" data-id=\"MCP\" data-label=\"Hosted MCP (/mcp)\" data-shape=\"rectangle\">
  <rect x=\"308.926\" y=\"40\" width=\"151.618\" height=\"36.900000000000006\" rx=\"0\" ry=\"0\" fill=\"var(--_node-fill)\" stroke=\"var(--_node-stroke)\" stroke-width=\"0.75\" />
  <text x=\"384.735\" y=\"58.45\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"500\" fill=\"var(--_text)\" dy=\"4.55\">Hosted MCP (/mcp)</text>
</g>
<g class=\"node\" data-id=\"OpenAPI\" data-label=\"v1 OpenAPI JSON\" data-shape=\"rectangle\">
  <rect x=\"40.00000000000007\" y=\"104.9\" width=\"144.20799999999997\" height=\"36.900000000000006\" rx=\"0\" ry=\"0\" fill=\"var(--_node-fill)\" stroke=\"var(--_node-stroke)\" stroke-width=\"0.75\" />
  <text x=\"112.10400000000006\" y=\"123.35000000000001\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"500\" fill=\"var(--_text)\" dy=\"4.55\">v1 OpenAPI JSON</text>
</g>
</svg>"}
```mermaid
flowchart LR
  Schedule["n8n Trigger or AI Agent"] -->|Authorization: Bearer| V1["Hosted v1 HTTP API"]
  Agent["n8n AI Agent"] -->|X-API-Key| MCP["Hosted MCP (/mcp)"]
  OpenAPI["v1 OpenAPI JSON"] -.->|Schema reference| Schedule
```
::

## Before you start

Complete [Hosted first result](https://gscdump.com/gscdump-sdk/guides/start/hosted-first-result) to create a user API key and copy your Site ID (`s_...`).

Hosted v1 HTTP endpoints and hosted MCP use different authentication headers:

::table{tabindex="0"}
| Surface            | URL prefix                                                                           | Header in n8n                                                     |
| ------------------ | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------- |
| Hosted v1 HTTP API | `https://gscdump.com/api/analytics/v1/...`, `https://gscdump.com/api/partner/v1/...` | `Authorization: Bearer <GSCDUMP_API_KEY>` via **Bearer Auth**     |
| Hosted MCP server  | `https://gscdump.com/mcp`                                                            | `X-API-Key: <GSCDUMP_API_KEY>` via **Header Auth** (or OAuth 2.0) |
::

Do not send `X-API-Key` to hosted v1 HTTP endpoints.

## Query rows or Fleet totals from an HTTP Request node

Use the **HTTP Request** node for scheduled workflows, such as a weekly Slack digest or a database sync.

1. Add an **HTTP Request** node after a **Schedule Trigger** node.
2. Set **Method** to `POST`.
3. Set **URL** to `https://gscdump.com/api/analytics/v1/sites/YOUR_SITE_ID/rows`, replacing `YOUR_SITE_ID` with your `s_...` Site ID.
4. Set **Authentication** to **Generic Credential Type**, then select **Bearer Auth**.
5. Create a new credential named `gscdump Hosted v1`, paste your user API key into **Bearer Token**, and save it.
6. Enable **Send Body**, set **Body Content Type** to **JSON**, and choose **Specify Body: Using JSON**.
7. Paste this request body:

::pre{tabindex="0"}
```json
{
  "dimensions": ["query"],
  "metrics": ["clicks", "impressions", "ctr", "position"],
  "searchType": "web",
  "orderBy": {
    "column": "clicks",
    "dir": "desc"
  },
  "rowLimit": 25
}
```
::

Run the node. A successful call returns `{ "data": { "rows": [...] }, "meta": { "requestId": "..." } }`.

Connect a **Split Out** node on `data.rows` to pass each query row to Slack, Notion, or Sheets.

To check click changes across every connected Site in one call, send a `POST` request to `https://gscdump.com/api/analytics/v1/fleet/summary`:

::pre{tabindex="0"}
```json
{
  "period": "last-7d",
  "comparison": "prev-period",
  "searchType": "web",
  "sortBy": "clicksDelta",
  "sortDir": "asc"
}
```
::

Read `{{ $json.data.sites }}` for per-Site deltas. Read `{{ $json.data.deduplicatedTotals }}` for Fleet totals.

## Connect an n8n AI Agent

Choose the tool node that fits how much freedom the agent should have.

### Narrow scope: HTTP Request Tool

Use **HTTP Request Tool** when the agent should call one fixed endpoint.

1. Attach an **HTTP Request Tool** node to the **AI Agent** node's **Tool** port.
2. Select your `gscdump Hosted v1` Bearer Auth credential.
3. Set the endpoint URL and JSON payload template.
4. Name the fields the model may fill, such as `rowLimit` or `searchType`, in the tool description.

### Full toolset: MCP Client Tool

Use **MCP Client Tool** when the agent should choose from all Search Console tools.

1. Attach an **MCP Client Tool** node to the **AI Agent** node.
2. Set the server URL to `https://gscdump.com/mcp`.
3. Choose **Header Auth** with header name `X-API-Key` and your user API key as the value.

See the [MCP setup guide](https://gscdump.com/mcp) for the full tool list.

## Check schemas with OpenAPI

The hosted API publishes OpenAPI 3.1 JSON documents for each HTTP surface:

- Analytics surface: `https://gscdump.com/openapi/analytics.v1.json`
- Partner surface: `https://gscdump.com/openapi/partner.v1.json`
- Realtime HTTP surface: `https://gscdump.com/openapi/realtime.v1.json`

Check these documents for valid enum values, required fields, and response keys when building n8n payloads or Code nodes.

## Configure retries and handle errors

Every v1 failure returns `{ "error": { "code", "message", "requestId", "retryable", "details" } }`.

- **Retries:** Turn on **Retry On Fail** in node **Settings** only for idempotent reads (`rows`, `reports`, `fleet/summary`, and `GET` calls). Set **Wait Between Tries** to at least `2000` ms and cap **Max Tries** at `3`.
- **Non-idempotent mutations:** Leave retries off on mutations marked `retry: "never"`. See the [hosted HTTP reference](https://gscdump.com/gscdump-sdk/api/hosted-http#idempotency-and-retries) for that list.
- **`401` or `403`:** Confirm you selected **Bearer Auth** on v1 URLs and that the key holds the required scope.
- **`409 invalid_request`:** Read `error.details.reason`, such as `record_not_ready` or `range_not_synced`. Retrying immediately returns the same refusal.
- **Error logs:** Log `error.code` and `error.requestId` in your n8n error workflow. Never log the `Authorization` header.

## Check the result

1. Run **Test step** on your HTTP Request node with a valid Site ID.
2. Confirm the output includes `data.rows` (or `data.sites` for Fleet summary) and `meta.requestId`.
3. To verify `GSCdump-API-Version: 1.0`, temporarily enable **Options → Response → Include Response Headers and Status** (turn it back off so `data.rows` stays at the top level).
4. Test once with an invalid API key to confirm your error workflow catches `401` cleanly.

Continue with [Hosted analytics](https://gscdump.com/gscdump-sdk/guides/read-data/hosted-analytics) for Report filters and comparison windows.

## Sitemap

See the full [sitemap](https://gscdump.com/sitemap.md) for all pages.
