# n8n

[n8n](https://n8n.io/) is a **workflow automation tool** that allows users to connect different applications and services to automate tasks. It provides a way to build complex workflows using a visual editor, integrate APIs, databases, and cloud services to streamline processes such as data synchronization, notifications, and system integrations.

Connecting **n8n’s open automation engine** with **nexos.ai’s models and assistants** gives teams instant, secure workflow intelligence. Every interaction uses authenticated **API‑key access**, ensuring sensitive company data remains safe within nexos.ai while providing full observability and control over API usage.

For example, raw financial data can be analyzed entirely inside a nexos.ai assistant. It processes internal figures, then sends back a single sanitized insight—*“Expenses increased 12% from Q2”*—to an **n8n workflow** through a secure API call, triggering automated follow‑ups such as dispatching reports or updating dashboards.

To connect your nexos.ai API and n8n go through the following steps:

{% stepper %}
{% step %}

### Generate an API key

Within workspace, navigate to:&#x20;

{% tabs %}
{% tab title="Personal API key" %}
Top-right corner "profile → User profile → Generate API Key

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDcOhapgXnoeDvgGQ8Jm4%2Fuploads%2F0LGvNLlyqKw42xaiWCWB%2F1_nexos_roocode_API00000000.mp4?alt=media&token=4699eed3-4720-464c-9a70-b960aa573c68>" %}
How to generate a personal API key
{% endembed %}
{% endtab %}

{% tab title="Team API key" %}
Management → Teams tab → Select team → Generate API Key

Each team can have its API Key with custom settings: models enabled, fallbacks, etc.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDcOhapgXnoeDvgGQ8Jm4%2Fuploads%2FZYaLEEUa4M42yQAh1fbN%2FteamAPI.mp4?alt=media&token=1dd97740-f689-4654-af9f-345909ac7bf2>" %}
{% endtab %}
{% endtabs %}

If needed, you can rotate the API Key within API keys tab settings. This will rotate the API Key so the old one is deprecated, and you can change it to a new one.

{% hint style="danger" %}
Make sure to store your API key safely and securely. Never share it with anyone.&#x20;
{% endhint %}

{% hint style="danger" %}
Make sure you save your API key - you won't be able to access it again after closing the dialog.
{% endhint %}
{% endstep %}

{% step %}

### Create a new workflow in n8n

On the homepage of your n8n instance click the orange button labeled "Create Workflow"

Next, in the top left corner name your workflow, additionally you can add tags here, too.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDcOhapgXnoeDvgGQ8Jm4%2Fuploads%2FERQU4wQWXDwJVkiy6f6Y%2Fn8n_1.mp4?alt=media&token=cdddb045-fd40-4803-a862-f470a79f1b34>" %}
{% endstep %}

{% step %}

### Configuring the workflow

{% hint style="info" %}
This guide uses a chat node as the trigger for the AI Agent, however other nodes can also be used.
{% endhint %}

Add a trigger node that will start the workflow, then add the AI Agent node and make sure they are connected. Next, add the "OpenAI Chat Model" node.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDcOhapgXnoeDvgGQ8Jm4%2Fuploads%2FkI0R3JqXGPUEtpF9wl9T%2Fn8n_2.mp4?alt=media&token=d41d2697-7ab5-444e-867c-82cb6369a107>" %}
{% endstep %}

{% step %}

### Configuring API credentials

From the "OpenAI Chat Model" node select the "Credential to connect with" dropdown, then "Create new credential". This will open a new window where you can paste your nexos.ai API key and set the API URL.&#x20;

The API URL is [`https://api.nexos.ai/v1`](https://api.nexos.ai/v1)&#x20;

Make sure to name your credentials by clicking on the "OpenAI account" text in top right corner.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDcOhapgXnoeDvgGQ8Jm4%2Fuploads%2F6RsOYrO7ReXR0TfxnEdk%2Fn8n_3.mp4?alt=media&token=6a2af784-7e1b-46ca-b208-2aac08810d3b>" %}

Save and close the API credential window
{% endstep %}

{% step %}

### Selecting a model or assistant

The available models **and assistants** can be selected by using their unique IDs. The nexos.ai Gateway API provides an endpoint that lists available models and assistants.

Alternatively, you can also select the model from the list drop down.

{% hint style="warning" %}
Assistants are **only** available when using personal API key.
{% endhint %}

{% hint style="success" %}
For the model list see the following link - <https://docs.nexos.ai/gateway-api#get-v1-models>

For user's assistant list  see the following link - <https://docs.nexos.ai/gateway-api#get-v1-assistants>
{% endhint %}

{% tabs %}
{% tab title="Model list" %}
{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDcOhapgXnoeDvgGQ8Jm4%2Fuploads%2FYp4iKvSLX8etB8NxaKEI%2FlistModel.mp4?alt=media&token=2b07a91a-a259-485e-b282-8df241cd5055>" %}

Model list does not contain personal Assistants.
{% endtab %}

{% tab title="Model ID" %}
{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDcOhapgXnoeDvgGQ8Jm4%2Fuploads%2FTUIASV0cS5IKly8AC2BM%2Fn8n_4.mp4?alt=media&token=934aac05-09e4-485b-8015-5b4ec5094373>" %}

Once you have the model or assistant ID you can copy and paste it in the AI model node.
{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

### Adding memory

{% hint style="warning" %}
Adding memory is optional and might not be applicable to your workflow.
{% endhint %}

For some use cases short memory retention is required. In those situations the "Simple Memory" node becomes very useful.
{% endstep %}

{% step %}

### Testing

{% hint style="info" %}
This guide uses a chat node as the main touch point, some nodes are only relevant for this specific example. Other node combinations are also possible.
{% endhint %}

Try out your workflow to see if the nodes have been configured correctly.&#x20;

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDcOhapgXnoeDvgGQ8Jm4%2Fuploads%2Fa2GWm3U9U6Ajrvr0My9L%2Fn8n_5.mp4?alt=media&token=33854c79-97c0-4d0a-8a1a-e33bbb0d5cb9>" %}
{% endstep %}
{% endstepper %}


---

# Agent Instructions: 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:

```
GET https://docs.nexos.ai/gateway-api/integrations/n8n.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
