> **For coding agents and LLMs:** This is one page from the Social Fetch docs (markdown export). The sections below mirror the orientation block in [`/llms.txt`](https://www.socialfetch.dev/llms.txt); use [`/llms.json`](https://www.socialfetch.dev/llms.json) when you need a structured operation inventory. The catalog covers documented operations with on-site reference pages.

## This page

- **On-site (HTML):** [https://www.socialfetch.dev/docs/integrations/n8n](https://www.socialfetch.dev/docs/integrations/n8n)
- **Markdown (.mdx) URL:** [https://www.socialfetch.dev/docs/integrations/n8n.mdx](https://www.socialfetch.dev/docs/integrations/n8n.mdx)

## API base URL and authentication

- **API origin (from OpenAPI `servers`):** `https://api.socialfetch.dev`
- **Authentication:** send `x-api-key: sfk_...` on `/v1/**` routes unless the operation is explicitly anonymous (check OpenAPI `security`, the [API reference hub](https://www.socialfetch.dev/docs/api.mdx), [`/llms.txt`](https://www.socialfetch.dev/llms.txt), or [`/llms.json`](https://www.socialfetch.dev/llms.json) for each route).
- **OpenAPI JSON:** [https://www.socialfetch.dev/openapi.json](https://www.socialfetch.dev/openapi.json)

## Recommended docs entrypoints (this site)

- [Documentation overview](https://www.socialfetch.dev/docs.mdx) — top-level orientation (markdown).
- [Quickstart](https://www.socialfetch.dev/docs/quickstart.mdx) — authenticate with `x-api-key`, validate auth with `whoami`, and understand the JSON envelope.
- [SDK](https://www.socialfetch.dev/docs/sdk.mdx) — official TypeScript SDK guide, including `SocialFetchClient`, `Result`, and `unwrap()`.
- [SDK reference](https://www.socialfetch.dev/docs/sdk-reference.mdx) — exhaustive SDK method inventory and route mapping for agents, tooling, and power users.
- [Choose the right endpoint](https://www.socialfetch.dev/docs/choose-endpoint.mdx) — task-oriented route selection for smoke tests, profiles, list endpoints, and single-item lookups.
- [Capability matrix](https://www.socialfetch.dev/docs/capability-matrix.mdx) — fast comparison of identifiers, pagination, outcomes, media download, and SDK coverage.
- [Integrations](https://www.socialfetch.dev/docs/integrations.mdx) — MCP for AI clients, n8n community node, SDK, and REST API connection paths.
- [MCP integration](https://www.socialfetch.dev/docs/integrations/mcp.mdx) — hosted `/mcp` server, OAuth, Cursor/VS Code/Claude install snippets, 87 endpoint tools, plus docs_search/docs_read for implementation help.
- [n8n integration](https://www.socialfetch.dev/docs/integrations/n8n.mdx) — install `n8n-nodes-socialfetch`, credentials, and workflow examples.
- [`/llms.json`](https://www.socialfetch.dev/llms.json) — structured machine-readable operation inventory with parameter names, pagination, outcomes, credits, and SDK mapping.
- [API reference hub](https://www.socialfetch.dev/docs/api.mdx) — human-friendly index of operations with links into generated pages.
- [Errors](https://www.socialfetch.dev/docs/errors.mdx) — shared error envelope and HTTP status guidance.
- [Credits](https://www.socialfetch.dev/docs/credits.mdx) — metering, `402`, and planning batch jobs.
- Outcome semantics such as `found`, `not_found`, and `private` are documented in [Errors](https://www.socialfetch.dev/docs/errors.mdx) and on operation pages when present in the OpenAPI contract.

## Markdown docs convention

- Every docs page has a markdown twin: append **`.mdx`** to the docs pathname (for example `/docs/quickstart` → `/docs/quickstart.mdx`).
- Agents that send `Accept: text/markdown` on `/docs/**` HTML URLs may receive markdown directly (same URL, `Vary: Accept`).

---
# n8n (https://www.socialfetch.dev/docs/integrations/n8n)

Add **Social Fetch** to [n8n](https://n8n.io) and every platform we support becomes a drag-and-drop step: pull profiles, posts, and metrics into a workflow, or attach the node to an AI agent as a live data tool. Each operation maps 1:1 to a [public API endpoint](/docs/api&#x29;, so anything in the API reference works as a no-code step — via the **`n8n-nodes-socialfetch`** community node.

What you'll need

* An **n8n instance** — n8n Cloud, or self-hosted with [community nodes enabled](https://docs.n8n.io/integrations/community-nodes/installation/).
* A **Social Fetch API key** (starts with `sfk_`) — create one in your [API Keys](https://app.socialfetch.dev/api-keys) dashboard.
* **Credits** on your account for metered routes — see [Credits & billing](/docs/credits).

<div className="not-prose mt-5 flex flex-wrap gap-2.5">
  <a className="inline-flex items-center gap-2 rounded-lg border border-border/60 bg-muted/20 px-3.5 py-2 text-sm font-medium text-foreground no-underline transition-colors hover:border-border hover:bg-muted/40" href="https://www.npmjs.com/package/n8n-nodes-socialfetch" rel="noreferrer" target="_blank">
    <svg aria-hidden="true" className="size-4 text-[#CB3837]" fill="currentColor" viewBox="0 0 2500 2500">
      <path fill="#c00" d="M0 0h2500v2500H0z" />

      <path fill="#fff" d="M1241.5 268.5h-973v1962.9h972.9V763.5h495v1467.9h495V268.5z" />
    </svg>

    n8n-nodes-socialfetch
  </a>

  <a className="inline-flex items-center gap-2 rounded-lg border border-border/60 bg-muted/20 px-3.5 py-2 text-sm font-medium text-foreground no-underline transition-colors hover:border-border hover:bg-muted/40" href="https://github.com/social-freak-ltd/n8n-nodes-socialfetch" rel="noreferrer" target="_blank">
    <svg aria-hidden="true" className="size-4" fill="currentColor" viewBox="0 0 24 24">
      <path d="M12 .5C5.73.5.5 5.74.5 12.04c0 5.1 3.29 9.42 7.86 10.95.58.11.79-.25.79-.56v-2.02c-3.2.7-3.88-1.38-3.88-1.38-.52-1.34-1.28-1.69-1.28-1.69-1.05-.72.08-.71.08-.71 1.16.08 1.77 1.2 1.77 1.2 1.03 1.78 2.7 1.27 3.36.97.1-.75.4-1.27.73-1.56-2.56-.29-5.26-1.29-5.26-5.74 0-1.27.45-2.31 1.2-3.12-.12-.29-.52-1.46.11-3.05 0 0 .98-.31 3.2 1.19a11 11 0 0 1 5.83 0c2.22-1.5 3.2-1.19 3.2-1.19.63 1.59.23 2.76.11 3.05.75.81 1.2 1.85 1.2 3.12 0 4.46-2.7 5.44-5.27 5.73.41.36.78 1.08.78 2.18v3.23c0 .31.21.68.8.56A11.55 11.55 0 0 0 23.5 12.04C23.5 5.74 18.27.5 12 .5Z" />
    </svg>

    GitHub
  </a>
</div>

Install

Follow n8n's [community nodes installation guide](https://docs.n8n.io/integrations/community-nodes/installation/&#x29; and install the package **`n8n-nodes-socialfetch`**.

1. Open your n8n instance and go to **Settings**.
2. Select **Community nodes**.
3. Click **Install**.
4. Enter the package name: **`n8n-nodes-socialfetch`**
5. Read the risk acknowledgement, tick the checkbox, and click **Install**.

After installation, the **Social Fetch** node appears in the node picker when you add a step to a workflow.

Credentials

You need a Social Fetch API key (it starts with `sfk_`). Create one in your [**API Keys**](https://app.socialfetch.dev/api-keys) dashboard.

In n8n:

1. Go to **Credentials** and click **Add credential**.
2. Search for **Social Fetch API**.
3. Paste your API key and save.

The credential is validated against `GET /v1/whoami` when you save it — if the key is invalid, n8n will show an error immediately.

Using the node

Add a **Social Fetch** node to your workflow and configure:

1. **Credential** — select your Social Fetch API credential.
2. **Resource** — pick the platform (e.g. TikTok, Instagram, Web) or **Account** for whoami/balance.
3. **Operation** — choose the endpoint (e.g. Profile videos, Search, Markdown).
4. **Required fields** — shown as direct inputs on the node.
5. **Additional Fields** — optional query parameters (sort order, limits, etc.).

The node is marked **usable as tool**, so you can also attach it to n8n AI agents that need live social or web data.

Pagination and Return All

Only list endpoints that use Social Fetch's **cursor** query parameter show a **Return All** toggle. When enabled, the node follows `data.page.nextCursor` until `data.page.hasMore` is false. Each page is a separate output item containing the full API JSON body (`data`, `meta`, etc.). Use n8n's **Item Lists** or **Code** node if you need a single merged array.

List endpoints that return everything in one response (no cursor), or that paginate with other parameters such as `page`, do not show **Return All** — you get the first response only unless you pass those parameters under **Additional Fields**.

Credits

Every request consumes credits from your Social Fetch balance (most endpoints cost 1 credit; some search and media-download options cost more). The credits charged for each call are returned in `meta.creditsCharged`. See [Credits & billing](/docs/credits) for details.

Example workflow

This example fetches a TikTok creator's recent videos and keeps only the high-performing ones.

1. **Manual Trigger** — start the workflow manually for testing.
2. **Social Fetch** — set **Resource** to `TikTok` and **Operation** to `Profile videos`.
   * **Handle**: `n8n`
   * Turn on **Return All** to page through every video, or leave it off to fetch the first page.
   * Under **Additional Fields**, set **Sort By** to `Popular`.
3. **Split Out** — field to split out: `data.videos` (one item per video).
4. **Filter** — keep videos above a view threshold:
   * Condition: `{{ $json.stats.views }}` *is greater than* `100000`.

Each Social Fetch item is one API page. With **Return All** off you get a single page; with it on you get one item per page, each containing `data.videos`, `data.page`, and `meta`. **Split Out** turns the videos array into individual items so the Filter node can evaluate `stats.views` on each video.

Example response shape (first video on a page):

```json
{
  "data": {
    "videos": [
      {
        "id": "7639528062975053069",
        "caption": "…",
        "url": "https://www.tiktok.com/@handle/video/7639528062975053069",
        "stats": {
          "views": 302447,
          "likes": 19880,
          "comments": 339,
          "shares": 2232,
          "saves": 389
        }
      }
    ],
    "page": { "nextCursor": "…", "hasMore": true }
  },
  "meta": { "creditsCharged": 1, "requestId": "…", "version": "v1" }
}
```

Enrichment pattern

A second common pattern is enrichment: use **TikTok → User search** (or **Search videos**) to discover handles, then loop those results back into **Profile videos** or **Profile** to pull full details for each match.

Next steps

- [API reference](/docs/api) — Browse every endpoint the n8n node exposes — params, examples, and response shapes.

- [Credits & billing](/docs/credits) — Understand metered routes, 402 handling, and creditsCharged metadata.