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

# n8n

> Build Cognee memory workflows in n8n.

Connect [n8n](https://n8n.io/) to cognee's AI memory engine and build powerful automation workflows with persistent knowledge graphs. Add data, process it into memory, and run semantic searches - all without writing code.

## Why Use This Integration

* **No-Code Memory**: Build AI memory pipelines using n8n's visual workflow editor
* **Knowledge Graph Search**: Query your data using natural language with graph-enhanced retrieval within n8n workflows
* **Workflow Automation**: Combine cognee memory with 400+ n8n integrations
* **Self-Hosted Ready**: Works with self-hosted n8n instances out of the box

## Installation

The cognee node is available as an n8n community node. Install it directly from n8n:

1. Login to your self-hosted n8n
2. Go to **Settings → Community Nodes**
3. Click **Install** button to add a new node and search for `n8n-nodes-cognee`
4. Click **Install** to complete.

Or install via npm in your n8n instance directory:

```bash theme={null}
npm install n8n-nodes-cognee
```

<Info>
  For self-hosted n8n, you can quickly spin up an instance following their [documentation](https://docs.n8n.io/hosting/installation/docker/#starting-n8n):

  Don't forget to set your timezone. After setup, access n8n at `localhost:5678`.
</Info>

## Credentials Setup

Before using the cognee node in your workflows, configure your API credentials:

1. Get your API key and Base URL from your [Cognee Cloud dashboard](https://platform.cognee.ai) (API Keys page)
2. In your workflow, click the + icon and search for cognee — you'll see the available resources (Add Data, Cognify, Search, Delete, Skill)
3. Click on the Add Data action to start
4. Create credentials of type `Cognee API` using the values below

| Field    | Value                                                              |
| -------- | ------------------------------------------------------------------ |
| Base URL | `https://tenant-xxx.aws.cognee.ai`                                 |
| API Key  | Your key from platform.cognee.ai (sent via the `X-Api-Key` header) |

<Info>
  Do not include a trailing `/api` in the Base URL — the node appends it automatically. The connection test hits `GET /health`.
</Info>

## Quick Start

Build a complete Add → Cognify → Search workflow in minutes:

### Step 1: Add Data

Add the cognee node to your workflow and configure it:

* **Resource**: Add Data
* **Operation**: Add
* **Dataset Name**: `my-dataset`
* **Text Data**: Your content to store

```json theme={null}
{
  "datasetName": "my-dataset",
  "text_data": ["Natural language processing is an interdisciplinary subfield of computer science and information retrieval."]
}
```

### Step 2: Cognify

Process your data into cognee's knowledge graph memory:

* **Resource**: Cognify
* **Operation**: Cognify
* **Datasets**: `my-dataset`

### Step 3: Search

Query your memory using natural language:

* **Resource**: Search
* **Operation**: Search
* **Search Type**: GraphCompletion
* **Datasets**: `my-dataset`
* **Query**: `Tell me about NLP`
* **Top K**: `10`

## Operations Reference

You can interact with your data cross platform. You can query a dataset that you already have in your [Cognee Cloud](/cognee-cloud/overview) or you can view and interact with your new data from n8n in Cognee Cloud thanks to your cognee credentials.

### Add Data

Stores text content in a cognee dataset for later processing.

| Parameter    | Required | Description                          |
| ------------ | -------- | ------------------------------------ |
| Dataset Name | Yes      | Name of the dataset to store data in |
| Text Data    | Yes      | One or more text strings to add      |

**API Endpoint**: `POST /api/add_text`

Text strings added through the n8n node are stored under an auto-generated filename of the form `text_<md5_hash>.txt`, derived from an MD5 hash of the content. The n8n node does not expose a filename, label, or metadata override. If you need custom labels or arbitrary metadata per item, ingest via the [Python SDK](/python-api/remember) using the `DataItem` wrapper (`DataItem(data=..., label=..., external_metadata=...)`) — see [DataItem metadata and labels](/core-concepts/main-operations/legacy-operations/add#dataitem-metadata-and-labels).

### Cognify

Transforms raw data into structured knowledge graph memory with embeddings.

| Parameter | Required | Description                          |
| --------- | -------- | ------------------------------------ |
| Datasets  | Yes      | One or more dataset names to process |

**API Endpoint**: `POST /api/cognify`

### Search

Queries the knowledge graph memory using semantic search.

| Parameter   | Required | Description                                 |
| ----------- | -------- | ------------------------------------------- |
| Search Type | Yes      | Search algorithm to use                     |
| Datasets    | Yes      | Datasets to search within                   |
| Query       | Yes      | Natural language search query               |
| Top K       | No       | Number of results to retrieve (default: 10) |

**API Endpoint**: `POST /api/search`

### Delete

Removes a whole dataset or a single data item.

| Operation      | Endpoint                                         | Parameters                  |
| -------------- | ------------------------------------------------ | --------------------------- |
| Delete Dataset | `DELETE /api/datasets/{datasetId}`               | Dataset ID (UUID)           |
| Delete Data    | `DELETE /api/datasets/{datasetId}/data/{dataId}` | Dataset ID, Data ID (UUIDs) |

### Skill

The self-improving skill loop, targeting the `/api/v1` endpoints. A weak run becomes a reviewable, approvable edit to a skill's instructions.

| Operation           | Endpoint                                     | Purpose                                                                           |
| ------------------- | -------------------------------------------- | --------------------------------------------------------------------------------- |
| Ingest Skill        | `POST /api/v1/skills`                        | Ingest a `SKILL.md` body as a dataset-scoped skill node                           |
| Review Skill        | `POST /api/v1/search` (`AGENTIC_COMPLETION`) | Run an agentic completion with the skill loaded so you can grade it               |
| Propose Improvement | `POST /api/v1/remember/entry`                | Record a weak run and create a `SkillImprovementProposal` (returns `proposal_id`) |
| Get Proposal        | `GET /api/v1/proposals/{proposalId}`         | Review the `old`/`proposed` procedure diff before approving                       |
| Apply Improvement   | `POST /api/v1/remember/entry` (`apply=true`) | Apply the approved proposal into the skill                                        |
| Get Skill           | `GET /api/v1/skills/{skillId}`               | Return the full skill, including its `procedure` body                             |

Loop wiring: **Ingest Skill** → **Review Skill** → (score in n8n) → **Propose Improvement** → **Get Proposal** (show diff for approval) → **Apply Improvement** → **Get Skill**.

<Info>
  The Add Data / Cognify / Search / Delete resources call Cognee Cloud's `/api/*` endpoints. The **Skill** resource calls `/api/v1/*`, available on a self-hosted Cognee server today and rolling out to Cognee Cloud. Point the credential Base URL at whichever backend exposes the routes you need (e.g. `http://localhost:8000` for self-hosted).
</Info>

## Search Types

Choose the search type that best fits your use case:

<AccordionGroup>
  <Accordion title="GraphCompletion">
    Combines graph traversal with vector search for comprehensive retrieval. Best for:

    * General-purpose queries
    * Finding related entities and relationships
    * Balanced accuracy and context

    ```json theme={null}
    { "searchType": "GRAPH_COMPLETION" }
    ```
  </Accordion>

  <Accordion title="ChainOfThought">
    Uses step-by-step reasoning over the knowledge graph. Best for:

    * Complex multi-hop questions
    * Queries requiring logical inference
    * Detailed explanations

    ```json theme={null}
    { "searchType": "GRAPH_COMPLETION_COT" }
    ```
  </Accordion>

  <Accordion title="RagCompletion">
    Standard RAG (Retrieval-Augmented Generation) search. Best for:

    * Simple factual queries
    * Direct document retrieval
    * Fast response times

    ```json theme={null}
    { "searchType": "RAG_COMPLETION" }
    ```
  </Accordion>
</AccordionGroup>

Learn more about search [here](/guides/search-basics)

## Use Cases

<AccordionGroup>
  <Accordion title="Customer Support Automation">
    Build a support bot that learns from your documentation:

    1. **Add** FAQ documents, guides, and knowledge base articles
    2. **Cognify** to build searchable memory
    3. **Search** with customer questions to retrieve relevant answers

    Connect to Slack, email, or chat integrations in n8n for end-to-end automation.
  </Accordion>

  <Accordion title="Document Intelligence Pipeline">
    Process and query large document collections:

    1. Use n8n's file triggers to watch for new documents
    2. Extract text and **Add** to cognee datasets
    3. Schedule periodic **Cognify** runs
    4. Build search interfaces or connect to chatbots
  </Accordion>

  <Accordion title="Research Assistant">
    Create a research workflow that accumulates knowledge:

    1. Pull data from RSS feeds, APIs, or web scraping nodes
    2. **Add** relevant content to topic-specific datasets
    3. **Cognify** to extract entities and relationships
    4. **Search** across all research to find connections
  </Accordion>

  <Accordion title="Sales Intelligence">
    Build memory from sales interactions:

    1. Connect CRM triggers (HubSpot, Salesforce)
    2. **Add** meeting notes, emails, and deal information
    3. **Cognify** to build relationship graphs
    4. **Search** for context before calls: "What do we know about Acme Corp?"
  </Accordion>
</AccordionGroup>

## Example Workflow

Here's a complete workflow configuration:

```json theme={null}
{
  "nodes": [
    {
      "name": "Add Data",
      "type": "n8n-nodes-cognee.cognee",
      "parameters": {
        "resource": "addData",
        "operation": "add",
        "datasetName": "support_docs",
        "textData": ["FAQ: Reset password via account settings.", "Guide: Export data as CSV from dashboard."]
      }
    },
    {
      "name": "Cognify",
      "type": "n8n-nodes-cognee.cognee",
      "parameters": {
        "resource": "cognify",
        "operation": "cognify",
        "datasets": ["support_docs"]
      }
    },
    {
      "name": "Search",
      "type": "n8n-nodes-cognee.cognee",
      "parameters": {
        "resource": "search",
        "operation": "search",
        "searchType": "GRAPH_COMPLETION",
        "datasets": ["support_docs"],
        "query": "How do I export my data?",
        "topK": 5
      }
    }
  ]
}
```

## Troubleshooting

| Issue                | Solution                                                 |
| -------------------- | -------------------------------------------------------- |
| 401/403 errors       | Verify your API key is correct and active                |
| Connection errors    | Check the Base URL and network access from your n8n host |
| Empty search results | Ensure you've run Cognify after adding data              |

***

<CardGroup cols={2}>
  <Card title="GitHub Repository" icon="github" href="https://github.com/topoteretes/cognee-integrations/tree/main/integrations/n8n">
    View source code and contribute
  </Card>

  <Card title="n8n Documentation" icon="book" href="https://docs.n8n.io/integrations/community-nodes/">
    Learn more about n8n community nodes
  </Card>
</CardGroup>
