Allow your AI to call an API to fetch data

Go to Workflow
21,483 views
Built by Deborah Deborah
Created on June 05, 2026

Description

Use n8n to bring data from any API to your AI. This workflow uses the Chat Trigger to provide the chat interface, and the Custom n8n Workflow Tool to call a second workflow that calls the API.

The second workflow uses AI functionality to refine the API request based on the user's query. It then makes an API call, and returns the response to the main workflow.

This workflow is used in Advanced AI examples | Call an API to fetch data in the documentation.

To use this workflow:

Load it into your n8n instance.
Add your credentials as prompted by the notes.

Requires n8n 1.28.0 or above

Nodes Used (8)

AI Agent
@n8n/n8n-nodes-langchain.agent
Auto-fixing Output Parser
@n8n/n8n-nodes-langchain.outputParserAutofixing
Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm
Call n8n Workflow Tool
@n8n/n8n-nodes-langchain.toolWorkflow
HTTP Request
n8n-nodes-base.httpRequest
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow
Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured